Mercurial > treepkg > treepkg
diff 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 |
line wrap: on
line diff
--- a/treepkg/git.py Tue Jan 11 16:04:05 2011 +0000 +++ b/treepkg/git.py Tue Jan 11 16:27:02 2011 +0000 @@ -128,7 +128,7 @@ def last_changed_revision(self): """Returns the last changed rev of the working copy""" - return self.repository.last_changed_revision(self.localdir) + return self.get_revision() def list_tags(self, pattern): output = run.capture_output(cmdexpand("git tag -l $pattern", @@ -144,6 +144,11 @@ % self.localdir) return output.strip() + def get_short_revision(self, refname="HEAD"): + """Return the short SHA1 sum of the latest commit""" + revision = self.get_revision(refname) + return revision[:7] + class TagDetector: """Class to detect tags from a git repository