[Treepkg-commits] r237 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Dec 2 16:37:47 CET 2009


Author: bh
Date: 2009-12-02 16:37:46 +0100 (Wed, 02 Dec 2009)
New Revision: 237

Modified:
   trunk/treepkg/subversion.py
Log:
Implement tag exports in the subversion base classes.


Modified: trunk/treepkg/subversion.py
===================================================================
--- trunk/treepkg/subversion.py	2009-12-02 14:46:37 UTC (rev 236)
+++ trunk/treepkg/subversion.py	2009-12-02 15:37:46 UTC (rev 237)
@@ -183,6 +183,19 @@
             if not os.path.isdir(absdir):
                 export(os.path.join(localdir, subdir), absdir)
 
+    def export_tag(self, url, destdir, revision=None):
+        """Exports the tag at url to destdir.
+        Note: the implementation of this method would work for any URL
+        but it really is intended to only be used for URLs to tags of
+        the same code as represented by this object.
+        """
+        base_url = url
+        if not base_url.endswith("/"):
+            base_url += "/"
+        for subdir, recurse in self.subset:
+            export(base_url + "/" + subdir, os.path.join(destdir, subdir),
+                   revision=revision, recurse=recurse)
+
     def last_changed_revision(self, localdir):
         """Returns the last changed revision of the working copy in localdir"""
         return max([last_changed_revision(os.path.join(localdir, d))
@@ -240,6 +253,16 @@
         """Exports the working copy to destdir"""
         self.repository.export(self.localdir, destdir)
 
+    def export_tag(self, url, destdir, revision=None):
+        """Exports the tag at url to destdir.
+        The URL is expected to point to the same repository as the one
+        used by the working copy and is intended to be used when
+        exporting tagged versions of the code in the working copy.  It's
+        a method on the working copy so that the repository description
+        including the subset settings are used.
+        """
+        self.repository.export_tag(url, destdir, revision=revision)
+
     def last_changed_revision(self):
         """Returns the last changed rev of the working copy"""
         return self.repository.last_changed_revision(self.localdir)



More information about the Treepkg-commits mailing list