# HG changeset patch # User Bjoern Ricks # Date 1314962343 0 # Node ID bf8114a762245dbdea5f60c568e9991cb3cbb019 # Parent 9d44d4da3411e46c63538b9bb757c158ca986df5 Add more debug output diff -r 9d44d4da3411 -r bf8114a76224 treepkg/git.py --- a/treepkg/git.py Fri Sep 02 11:04:07 2011 +0000 +++ b/treepkg/git.py Fri Sep 02 11:19:03 2011 +0000 @@ -27,7 +27,7 @@ """Describes a git repository""" - def __init__(self, url, branch=None): + def __init__(self, url, branch=None, logger=None): """Initialize the git repository description Parameters: url -- The url of the repository @@ -36,6 +36,7 @@ defaults to master """ self.url = url + self.log = logger if not branch: # as default track master as local-master self.local_branch = "local-master" @@ -51,10 +52,12 @@ def checkout(self, localdir): """Clones the repository at url into the localdir""" run.call(cmdexpand("git clone -q $url $localdir", **locals())) - if branch: + if self.branch: self.checkout_branch(localdir) def checkout_branch(self, localdir): + self.log_info("Switching to local branch '%s' for branch '%s'" %\ + (self.local_branch, self.branch)) run.call(cmdexpand("git checkout -q --track -b $local $branch", branch=self.branch, local=self.local_branch), cwd=localdir) @@ -84,12 +87,17 @@ all_branches.append(tbranch) if not self.local_branch in all_branches: self.checkout_branch(localdir) + self.log_info("Current branch is '%s'" % cur_branch) # TODO: check if self.local_branch is curbranch # doesn't hurt if a checkout is done on the current branch if self.branch: + self.log_info("Switching to local branch '%s'" % self.local_branch) run.call(cmdexpand("git checkout -q $branch", branch=self.local_branch), cwd=localdir) + def log_info(self, *args): + if self.logger is not None: + self.logger.info(*args) def last_changed_revision(self, localdir): """Returns the SHA1 sum of the latest commit in the working copy in localdir""" diff -r 9d44d4da3411 -r bf8114a76224 treepkg/packager.py --- a/treepkg/packager.py Fri Sep 02 11:04:07 2011 +0000 +++ b/treepkg/packager.py Fri Sep 02 11:19:03 2011 +0000 @@ -569,7 +569,7 @@ self.working_copy = SvnWorkingCopy(repo, self.checkout_dir, logger=logging) elif scm_type == "git": - repo = GitRepository(url, branch=branch) + repo = GitRepository(url, branch=branch, logger=logging) self.working_copy = GitWorkingCopy(repo, self.checkout_dir, logger=logging) else: