[Treepkg-commits] r504 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 11 17:27:03 CET 2011


Author: bricks
Date: 2011-01-11 17:27:02 +0100 (Tue, 11 Jan 2011)
New Revision: 504

Modified:
   trunk/treepkg/git.py
   trunk/treepkg/packager.py
   trunk/treepkg/subversion.py
Log:
provide stubs for short_revision number


Modified: trunk/treepkg/git.py
===================================================================
--- trunk/treepkg/git.py	2011-01-11 16:04:05 UTC (rev 503)
+++ trunk/treepkg/git.py	2011-01-11 16:27:02 UTC (rev 504)
@@ -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

Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2011-01-11 16:04:05 UTC (rev 503)
+++ trunk/treepkg/packager.py	2011-01-11 16:27:02 UTC (rev 504)
@@ -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]

Modified: trunk/treepkg/subversion.py
===================================================================
--- trunk/treepkg/subversion.py	2011-01-11 16:04:05 UTC (rev 503)
+++ trunk/treepkg/subversion.py	2011-01-11 16:27:02 UTC (rev 504)
@@ -268,7 +268,14 @@
         """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):
 
     """A manually managed working copy"""



More information about the Treepkg-commits mailing list