changeset 311:d0acc0614de5

Implement tag exports in the subversion base classes.
author Bernhard Herzog <bh@intevation.de>
date Wed, 02 Dec 2009 15:37:46 +0000
parents 26c15a0f0e52
children 2d6915bce473
files treepkg/subversion.py
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/treepkg/subversion.py	Wed Dec 02 14:46:37 2009 +0000
+++ b/treepkg/subversion.py	Wed Dec 02 15:37:46 2009 +0000
@@ -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)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)