| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,6 @@ | |||
| 21 | 21 | # absolute, like shown here. | |
| 22 | 22 | #sys.path.append(os.path.abspath('.')) | |
| 23 | 23 | sys.path.insert(0, os.path.abspath('../..')) | |
| 24 | - print sys.path | ||
| 25 | 24 | ||
| 26 | 25 | # General configuration | |
| 27 | 26 | # --------------------- | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | 7 | import os | |
| 8 | 8 | import sys | |
| 9 | + import logging | ||
| 9 | 10 | from util import ( | |
| 10 | 11 | LazyMixin, | |
| 11 | 12 | stream_copy | |
@@ -22,6 +23,8 @@ | |||
| 22 | 23 | 'with_exceptions', 'as_process', | |
| 23 | 24 | 'output_stream') | |
| 24 | 25 | ||
| 26 | + log = logging.getLogger('git.cmd') | ||
| 27 | + | ||
| 25 | 28 | __all__ = ('Git', ) | |
| 26 | 29 | ||
| 27 | 30 | ||
@@ -334,7 +337,7 @@ def execute(self, command, | |||
| 334 | 337 | If you add additional keyword arguments to the signature of this method, | |
| 335 | 338 | you must update the execute_kwargs tuple housed in this module.""" | |
| 336 | 339 | if self.GIT_PYTHON_TRACE and (self.GIT_PYTHON_TRACE != 'full' or as_process): | |
| 337 | - print(' '.join(command)) | ||
| 340 | + log.info(' '.join(command)) | ||
| 338 | 341 | ||
| 339 | 342 | # Allow the user to have the command executed in their working dir. | |
| 340 | 343 | if with_keep_cwd or self._working_dir is None: | |
@@ -389,11 +392,11 @@ def execute(self, command, | |||
| 389 | 392 | if self.GIT_PYTHON_TRACE == 'full': | |
| 390 | 393 | cmdstr = " ".join(command) | |
| 391 | 394 | if stderr_value: | |
| 392 | - print("%s -> %d; stdout: '%s'; stderr: '%s'" % (cmdstr, status, stdout_value, stderr_value)) | ||
| 395 | + log.info("%s -> %d; stdout: '%s'; stderr: '%s'", cmdstr, status, stdout_value, stderr_value) | ||
| 393 | 396 | elif stdout_value: | |
| 394 | - print("%s -> %d; stdout: '%s'" % (cmdstr, status, stdout_value)) | ||
| 397 | + log.info("%s -> %d; stdout: '%s'", cmdstr, status, stdout_value) | ||
| 395 | 398 | else: | |
| 396 | - print("%s -> %d" % (cmdstr, status)) | ||
| 399 | + log.info("%s -> %d", cmdstr, status) | ||
| 397 | 400 | # END handle debug printing | |
| 398 | 401 | ||
| 399 | 402 | if with_exceptions and status != 0: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,13 +9,17 @@ | |||
| 9 | 9 | import re | |
| 10 | 10 | import ConfigParser as cp | |
| 11 | 11 | import inspect | |
| 12 | + import logging | ||
| 12 | 13 | ||
| 13 | 14 | from git.odict import OrderedDict | |
| 14 | 15 | from git.util import LockFile | |
| 15 | 16 | ||
| 16 | 17 | __all__ = ('GitConfigParser', 'SectionConstraint') | |
| 17 | 18 | ||
| 18 | 19 | ||
| 20 | + log = logging.getLogger('git.config') | ||
| 21 | + | ||
| 22 | + | ||
| 19 | 23 | class MetaParserBuilder(type): | |
| 20 | 24 | ||
| 21 | 25 | """Utlity class wrapping base-class methods into decorators that assure read-only properties""" | |
@@ -186,8 +190,8 @@ def __del__(self): | |||
| 186 | 190 | try: | |
| 187 | 191 | try: | |
| 188 | 192 | self.write() | |
| 189 | - except IOError as e: | ||
| 190 | - print("Exception during destruction of GitConfigParser: %s" % str(e)) | ||
| 193 | + except IOError: | ||
| 194 | + log.error("Exception during destruction of GitConfigParser", exc_info=True) | ||
| 191 | 195 | finally: | |
| 192 | 196 | self._lock._release_lock() | |
| 193 | 197 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,9 @@ | |||
| 31 | 31 | altzone | |
| 32 | 32 | ) | |
| 33 | 33 | import os | |
| 34 | - import sys | ||
| 34 | + import logging | ||
| 35 | + | ||
| 36 | + log = logging.getLogger('git.objects.commit') | ||
| 35 | 37 | ||
| 36 | 38 | __all__ = ('Commit', ) | |
| 37 | 39 | ||
@@ -473,16 +475,16 @@ def _deserialize(self, stream): | |||
| 473 | 475 | try: | |
| 474 | 476 | self.author.name = self.author.name.decode(self.encoding) | |
| 475 | 477 | except UnicodeDecodeError: | |
| 476 | - print >> sys.stderr, "Failed to decode author name '%s' using encoding %s" % ( | ||
| 477 | - self.author.name, self.encoding) | ||
| 478 | + log.error("Failed to decode author name '%s' using encoding %s", self.author.name, self.encoding, | ||
| 479 | + exc_info=True) | ||
| 478 | 480 | # END handle author's encoding | |
| 479 | 481 | ||
| 480 | 482 | # decode committer name | |
| 481 | 483 | try: | |
| 482 | 484 | self.committer.name = self.committer.name.decode(self.encoding) | |
| 483 | 485 | except UnicodeDecodeError: | |
| 484 | - print >> sys.stderr, "Failed to decode committer name '%s' using encoding %s" % ( | ||
| 485 | - self.committer.name, self.encoding) | ||
| 486 | + log.error("Failed to decode committer name '%s' using encoding %s", self.committer.name, self.encoding, | ||
| 487 | + exc_info=True) | ||
| 486 | 488 | # END handle author's encoding | |
| 487 | 489 | ||
| 488 | 490 | # a stream from our data simply gives us the plain message | |
@@ -491,7 +493,7 @@ def _deserialize(self, stream): | |||
| 491 | 493 | try: | |
| 492 | 494 | self.message = self.message.decode(self.encoding) | |
| 493 | 495 | except UnicodeDecodeError: | |
| 494 | - print >> sys.stderr, "Failed to decode message '%s' using encoding %s" % (self.message, self.encoding) | ||
| 496 | + log.error("Failed to decode message '%s' using encoding %s", self.message, self.encoding, exc_info=True) | ||
| 495 | 497 | # END exception handling | |
| 496 | 498 | return self | |
| 497 | 499 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,11 +27,14 @@ | |||
| 27 | 27 | import git | |
| 28 | 28 | ||
| 29 | 29 | import os | |
| 30 | - import sys | ||
| 30 | + import logging | ||
| 31 | 31 | ||
| 32 | 32 | __all__ = ["Submodule", "UpdateProgress"] | |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | + log = logging.getLogger('git.objects.submodule.base') | ||
| 36 | + | ||
| 37 | + | ||
| 35 | 38 | class UpdateProgress(RemoteProgress): | |
| 36 | 39 | ||
| 37 | 40 | """Class providing detailed progress information to the caller who should | |
@@ -408,7 +411,7 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 408 | 411 | mrepo.head.set_reference(local_branch, logmsg="submodule: attaching head to %s" % local_branch) | |
| 409 | 412 | mrepo.head.ref.set_tracking_branch(remote_branch) | |
| 410 | 413 | except IndexError: | |
| 411 | - print >> sys.stderr, "Warning: Failed to checkout tracking branch %s" % self.branch_path | ||
| 414 | + log.warn("Failed to checkout tracking branch %s", self.branch_path) | ||
| 412 | 415 | # END handle tracking branch | |
| 413 | 416 | ||
| 414 | 417 | # NOTE: Have to write the repo config file as well, otherwise | |
@@ -437,11 +440,10 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 437 | 440 | binsha = rcommit.binsha | |
| 438 | 441 | hexsha = rcommit.hexsha | |
| 439 | 442 | else: | |
| 440 | - print >> sys.stderr, "%s a tracking branch was not set for local branch '%s'" % ( | ||
| 441 | - msg_base, mrepo.head.ref) | ||
| 443 | + log.error("%s a tracking branch was not set for local branch '%s'", msg_base, mrepo.head.ref) | ||
| 442 | 444 | # END handle remote ref | |
| 443 | 445 | else: | |
| 444 | - print >> sys.stderr, "%s there was no local tracking branch" % msg_base | ||
| 446 | + log.error("%s there was no local tracking branch", msg_base) | ||
| 445 | 447 | # END handle detached head | |
| 446 | 448 | # END handle to_latest_revision option | |
| 447 | 449 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,10 +5,12 @@ | |||
| 5 | 5 | from git.exc import InvalidGitRepositoryError | |
| 6 | 6 | import git | |
| 7 | 7 | ||
| 8 | - import sys | ||
| 8 | + import logging | ||
| 9 | 9 | ||
| 10 | 10 | __all__ = ["RootModule", "RootUpdateProgress"] | |
| 11 | 11 | ||
| 12 | + log = logging.getLogger('git.objects.submodule.root') | ||
| 13 | + | ||
| 12 | 14 | ||
| 13 | 15 | class RootUpdateProgress(UpdateProgress): | |
| 14 | 16 | ||
@@ -247,8 +249,8 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init= | |||
| 247 | 249 | # this way, it will be checked out in the next step | |
| 248 | 250 | # This will change the submodule relative to us, so | |
| 249 | 251 | # the user will be able to commit the change easily | |
| 250 | - print >> sys.stderr, "WARNING: Current sha %s was not contained in the tracking\ | ||
| 251 | - branch at the new remote, setting it the the remote's tracking branch" % sm.hexsha | ||
| 252 | + log.warn("Current sha %s was not contained in the tracking\ | ||
| 253 | + branch at the new remote, setting it the the remote's tracking branch", sm.hexsha) | ||
| 252 | 254 | sm.binsha = rref.commit.binsha | |
| 253 | 255 | # END reset binsha | |
| 254 | 256 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments