[Treepkg-commits] r254 - in trunk: bin treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 17 15:26:16 CET 2010


Author: aheinecke
Date: 2010-03-17 15:26:16 +0100 (Wed, 17 Mar 2010)
New Revision: 254

Modified:
   trunk/bin/listpackages.py
   trunk/bin/listpendingnotifications.py
   trunk/treepkg/git.py
   trunk/treepkg/packager.py
Log:
Revisions are now handled as strings


Modified: trunk/bin/listpackages.py
===================================================================
--- trunk/bin/listpackages.py	2010-03-17 13:42:42 UTC (rev 253)
+++ trunk/bin/listpackages.py	2010-03-17 14:26:16 UTC (rev 254)
@@ -43,11 +43,11 @@
     if len(split_revision) > 2:
         raise ValueError("Cannot parse revision %r; too many '-' signs"
                          % raw_revision)
-    revision = int(split_revision[0])
+    revision = split_revision[0]
     if len(split_revision) == 1:
         rulesrev = None
     else:
-        rulesrev = int(split_revision[1])
+        rulesrev = split_revision[1]
 
     return revision, rulesrev
 

Modified: trunk/bin/listpendingnotifications.py
===================================================================
--- trunk/bin/listpendingnotifications.py	2010-03-17 13:42:42 UTC (rev 253)
+++ trunk/bin/listpendingnotifications.py	2010-03-17 14:26:16 UTC (rev 254)
@@ -20,7 +20,7 @@
     for track in group.get_package_tracks():
         for revision in track.get_revisions():
             if revision.status.notification_mail.name == "notification_pending":
-                print "%s %s %d %d" % (revision.status.status.name,
+                print "%s %s %s %s" % (revision.status.status.name,
                                        track.name, revision.revision,
                                        revision.rules_revision)
                 revision.status.notification_sent()

Modified: trunk/treepkg/git.py
===================================================================
--- trunk/treepkg/git.py	2010-03-17 13:42:42 UTC (rev 253)
+++ trunk/treepkg/git.py	2010-03-17 14:26:16 UTC (rev 254)
@@ -41,14 +41,13 @@
              cwd=src)
 
 def last_changed_revision(git_working_copy):
-    """Return the number of commits in the current branch"""
-    output = run.capture_output(cmdexpand("/bin/bash -c \
-                                \"git rev-list local | wc -l \""
-                                , **locals()), cwd=git_working_copy)
+    """Return the SHA1 sum of the latest commit"""
+    output = run.capture_output(cmdexpand("git rev-parse HEAD"),
+                                cwd=git_working_copy)
     if output is None:
         raise GitError("Cannot determine last changed revision for %r"
-                              % git_working_copy)
-    return int(output)
+                       % git_working_copy)
+    return output.strip()
 
 class GitRepository(object):
 

Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2010-03-17 13:42:42 UTC (rev 253)
+++ trunk/treepkg/packager.py	2010-03-17 14:26:16 UTC (rev 254)
@@ -366,9 +366,9 @@
         self.do_build = do_build
         self.handle_dependencies = handle_dependencies
         self.dependencies = None
-        self.pkg_dir_template = "%(revision)d-%(rules_revision)d"
-        self.pkg_dir_regex = re.compile(r"(?P<revision>[0-9]+)"
-                                        r"-(?P<rules_revision>[0-9]+)$")
+        self.pkg_dir_template = "%(revision)s-%(rules_revision)s"
+        self.pkg_dir_regex = re.compile(r"(?P<revision>[0-9a-f]+)"
+                                        r"-(?P<rules_revision>[0-9a-f]+)$")
         externals = svn_externals
         if not externals:
             externals = self.svn_external_subdirs
@@ -380,9 +380,6 @@
             repo = GitRepository(git_url, branch=git_branch)
             self.working_copy = GitWorkingCopy(repo, self.checkout_dir,
                                               logger=logging) 
-        else:
-            print "No Repository URL for %s" % name
-            raise    
         if rules_svn_url:
             repo = SvnRepository(rules_svn_url)
             self.rules_working_copy = SvnWorkingCopy(repo, self.debian_dir,
@@ -444,16 +441,15 @@
         return self.working_copy.last_changed_revision()
 
     def get_revision_numbers(self):
-        """Returns a list of the numbers of the packaged revisions"""
+        """Returns a list of the packaged revisions"""
         revisions = []
         if os.path.exists(self.pkg_dir):
             for filename in os.listdir(self.pkg_dir):
                 match = self.pkg_dir_regex.match(filename)
                 if match:
-                    revisions.append((int(match.group("revision")),
-                                      int(match.group("rules_revision"))))
-        revisions.sort()
-        return revisions
+                    revisions.append((match.group("revision"),
+                                      match.group("rules_revision")))
+        return sorted(revisions)
 
     def update_checkout(self, revision=None):
         """Updates the working copy.



More information about the Treepkg-commits mailing list