Mercurial > treepkg > treepkg
comparison treepkg/git.py @ 570:44c0f8404983
Refactor git pull command out of update
Tag MUST NOT use update because therefore it always changes the current local branch!
For listing the tags it's enough to pull the latest repo changes
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Fri, 02 Sep 2011 11:46:29 +0000 |
parents | aaeca9cf0143 |
children | 7d5abf0bba91 |
comparison
equal
deleted
inserted
replaced
569:aaeca9cf0143 | 570:44c0f8404983 |
---|---|
70 | 70 |
71 def copy(self, localdir, destdir): | 71 def copy(self, localdir, destdir): |
72 """Copies the working copy to destdir (including .git dir)""" | 72 """Copies the working copy to destdir (including .git dir)""" |
73 shutils.copytree(localdir, destdir) | 73 shutils.copytree(localdir, destdir) |
74 | 74 |
75 def pull(self, localdir): | |
76 self.log_info("Pulling the repo in '%s'" % localdir) | |
77 run.call(cmdexpand("git pull -q"), cwd=localdir) | |
78 | |
75 def update(self, localdir): | 79 def update(self, localdir): |
76 """Runs git pull on the localdir.""" | 80 """Runs git pull on the localdir.""" |
77 run.call(cmdexpand("git pull -q"), cwd=localdir) | 81 self.pull() |
78 output = capture_output(cmdexpand("git branch"), cwd=localdir) | 82 output = capture_output(cmdexpand("git branch"), cwd=localdir) |
79 branches = output.splitlines() | 83 branches = output.splitlines() |
80 cur_branch = None | 84 cur_branch = None |
81 all_branches = [] | 85 all_branches = [] |
82 for tbranch in branches: | 86 for tbranch in branches: |
201 self.pattern = pattern | 205 self.pattern = pattern |
202 repo = GitRepository(url) | 206 repo = GitRepository(url) |
203 self.workingcopy = GitWorkingCopy(repo, localdir) | 207 self.workingcopy = GitWorkingCopy(repo, localdir) |
204 | 208 |
205 def list_tags(self): | 209 def list_tags(self): |
206 self.workingcopy.update_or_checkout() | 210 self.workingcopy.pull() |
207 tags = self.workingcopy.list_tags(self.pattern) | 211 tags = self.workingcopy.list_tags(self.pattern) |
208 return sorted(tags) | 212 return sorted(tags) |
209 | 213 |
210 def newest_tag_revision(self): | 214 def newest_tag_revision(self): |
211 candidates = self.list_tags() | 215 candidates = self.list_tags() |