# HG changeset patch # User Bernhard Herzog # Date 1259768266 0 # Node ID d0acc0614de5b58517c73ce9ad0ba481bcfc4021 # Parent 26c15a0f0e52d362fbc9615252324b6cb5a2a70e Implement tag exports in the subversion base classes. diff -r 26c15a0f0e52 -r d0acc0614de5 treepkg/subversion.py --- 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)