Skip to content

Commit

Permalink
And _more_ debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmoore committed Aug 29, 2018
1 parent 025936d commit 5e8f22b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions scc/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def is_merged(self):
class GitHubRepository(object):

def __init__(self, gh, user_name, repo_name):
self.log = logging.getLogger("scc.repo")
self.log = logging.getLogger("scc.repo.%s.%s" % (repo_name, user_name))
self.dbg = self.log.debug
self.gh = gh
self.user_name = user_name
Expand Down Expand Up @@ -1007,23 +1007,26 @@ def find_candidate_branches(self, filters,

class GitRepository(object):

def __initlog__(self, name):
self.log = logging.getLogger(name)
self.dbg = self.log.debug
self.info = self.log.info
self.debugWrap = LoggerWrapper(self.log, logging.DEBUG)
self.infoWrap = LoggerWrapper(self.log, logging.INFO)

def __init__(self, gh, path, remote="origin", push_branch=None,
repository_config=None):
"""
Register the git repository path, return the current status and
register the GitHub origin remote.
"""

self.log = logging.getLogger("scc.git")
self.dbg = self.log.debug
self.info = self.log.info
self.debugWrap = LoggerWrapper(self.log, logging.DEBUG)
self.infoWrap = LoggerWrapper(self.log, logging.INFO)

self.__initlog__("scc.git")
self.gh = gh
self.path = path
root_path = self.communicate("git", "rev-parse", "--show-toplevel")
self.path = os.path.abspath(root_path.strip())
self.__initlog__("scc.git.%s" % os.path.basename(self.path))

self.get_status()

Expand Down Expand Up @@ -1077,9 +1080,9 @@ def __enter__(self):

def __exit__(self, *args):
os.chdir(self.original)
self.dbg("<cd: %s --> %s", os.getcwd(), self.original)
self.dbg(" < cd: %s" % self.original)

self.dbg(">cd: %s --> %s", os.getcwd(), directory)
self.dbg(" > cd: %s" % directory)
os.chdir(directory)
return DirectoryChanger(self.dbg)

Expand Down

0 comments on commit 5e8f22b

Please sign in to comment.