Mercurial > treepkg > treepkg
comparison treepkg/git.py @ 541:8b49548aa8d4
provide stubs for short_revision number
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Tue, 11 Jan 2011 16:27:02 +0000 |
parents | b5e0c81c9bcc |
children | 991bc01ae668 |
comparison
equal
deleted
inserted
replaced
540:f7613aaa6a4e | 541:8b49548aa8d4 |
---|---|
126 """Export tag to destir """ | 126 """Export tag to destir """ |
127 self.export(destdir) | 127 self.export(destdir) |
128 | 128 |
129 def last_changed_revision(self): | 129 def last_changed_revision(self): |
130 """Returns the last changed rev of the working copy""" | 130 """Returns the last changed rev of the working copy""" |
131 return self.repository.last_changed_revision(self.localdir) | 131 return self.get_revision() |
132 | 132 |
133 def list_tags(self, pattern): | 133 def list_tags(self, pattern): |
134 output = run.capture_output(cmdexpand("git tag -l $pattern", | 134 output = run.capture_output(cmdexpand("git tag -l $pattern", |
135 pattern=pattern), cwd=self.localdir) | 135 pattern=pattern), cwd=self.localdir) |
136 return output.splitlines() | 136 return output.splitlines() |
141 refname=refname), cwd=self.localdir) | 141 refname=refname), cwd=self.localdir) |
142 if output is None: | 142 if output is None: |
143 raise GitError("Cannot determine revision for %r" | 143 raise GitError("Cannot determine revision for %r" |
144 % self.localdir) | 144 % self.localdir) |
145 return output.strip() | 145 return output.strip() |
146 | |
147 def get_short_revision(self, refname="HEAD"): | |
148 """Return the short SHA1 sum of the latest commit""" | |
149 revision = self.get_revision(refname) | |
150 return revision[:7] | |
146 | 151 |
147 class TagDetector: | 152 class TagDetector: |
148 | 153 |
149 """Class to detect tags from a git repository | 154 """Class to detect tags from a git repository |
150 | 155 |