changeset 541:8b49548aa8d4

provide stubs for short_revision number
author Bjoern Ricks <bricks@intevation.de>
date Tue, 11 Jan 2011 16:27:02 +0000
parents f7613aaa6a4e
children dc17b62d3cdd
files treepkg/git.py treepkg/packager.py treepkg/subversion.py
diffstat 3 files changed, 14 insertions(+), 1 deletions(-) [+]
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
--- a/treepkg/packager.py	Tue Jan 11 16:04:05 2011 +0000
+++ b/treepkg/packager.py	Tue Jan 11 16:27:02 2011 +0000
@@ -57,6 +57,7 @@
     def __init__(self, parent):
         self.parent = parent
         self.rules_revision = self.parent.rules_revision
+        # TODO short revision should be determined with scm working copy
         self.short_revision = self.revision
         if len(self.pkg_revision) > 7:
             self.short_revision = self.short_revision[:7]
--- a/treepkg/subversion.py	Tue Jan 11 16:04:05 2011 +0000
+++ b/treepkg/subversion.py	Tue Jan 11 16:27:02 2011 +0000
@@ -268,6 +268,13 @@
         """Returns the last changed rev of the working copy"""
         return self.repository.last_changed_revision(self.localdir)
 
+    def get_revision(self):
+        return self.last_changed_revision()
+
+    def get_short_revision(self):
+        # TODO: revision should be cached to avoid several calls to svn
+        return self.get_revision()
+
 
 class ManualWorkingCopy(object):
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)