Subversion: Add 'Tags' for target (basic implements)
Default directory for tags is 'tags', can confgure with "tags-path".

# TODO:
# * Set the origin author.
# * Tags as source.

# QUESTION:
# * If supporting tags, the directory structure should more typicaly
#   to subversion defaults (see SVN book, I'm missing the "trunk"):
#
# / (Base-Root)
# |
# +-- Module-Name (Projects)
#     |
#     +-- "trunk"
#     |    +-- ... directories
#     |    +-- and files ...
#     |
#     +-- "branches"
#     |    +-- Branch-names...
#     |
#     +-- "tags"
#          +-- Tag-names...
#
# Current implementation hase this layout:
# / (Base-Root)
# |
# +-- Module-Name (Projects)
# |    +-- ... directories
# |    +-- and files ...
# |
# +-- "tags"
#      +-- Tag-names...
#
# 2007-06-05 Henry (at) Bigfoot.de

============================================================
--- README      c93232247e6653830f5312013a6771084a469515
+++ README      e19558119c8704694a746fa0ae3f79d8bf7e753c
@@ -872,6 +872,11 @@
   references defined in the source repository.  This option force
   Tailor to behave as it did up to 0.9.20.

+tags-path : string
+  Tagged revisions will copy under that directory.
+
+  *tags* by default.
+
 tla
 %%%

============================================================
--- vcpx/repository/svn.py      2d00ea555cc1bc41cafea6997d39f32504d8696a
+++ vcpx/repository/svn.py      ad2b34131fbcd863eb14dbf0ca2f2c1a0511c35a
@@ -38,7 +38,43 @@ class SvnRepository(Repository):
         self.use_limit = cget(self.name, 'use-limit', True)
         self.trust_root = cget(self.name, 'trust-root', False)
         self.ignore_externals = cget(self.name, 'ignore-externals', True)
+        self.tags_path = cget(self.name, 'tags-path', 'tags')
+        self._setupTagsDirectory = None

+    def setupTagsDirectory(self):
+        if self._setupTagsDirectory == None:
+            self._setupTagsDirectory = False
+            if self.module and self.module <> '/':
+
+                if not self.tags_path.startswith('/'):
+                    self.log.debug("Prepending '/' to tags-path %r in %r",
+                                   self.tags_path, self.name)
+                    self.tags_path = '/' + self.tags_path
+
+                # Check the existing tags directory
+                cmd = self.command("ls")
+                svnls = ExternalCommand(command=cmd)
+                svnls.execute(self.repository + self.tags_path)
+                if svnls.exit_status:
+                    # create it, if not exist
+                    cmd = self.command("mkdir", "-m",
+                                       "This directory will host the tags")
+                    svnmkdir = ExternalCommand(command=cmd)
+                    svnmkdir.execute(self.repository + self.tags_path)
+                    if svnmkdir.exit_status:
+                        raise TargetInitializationFailure(
+ "Was not able to create tags directory '%s'"
+                                    % self.tags_path)
+                else:
+                    self.log.debug("Directory '%s' already exists"
+                                   % self.tags_path)
+                self._setupTagsDirectory = True
+            else:
+                self.log.debug("Tags needs module setup other than '/'")
+
+        return self._setupTagsDirectory
+
+
     def _validateConfiguration(self):
         from vcpx.config import ConfigurationError

@@ -526,6 +562,20 @@ class SvnWorkingDir(UpdatableSourceWorki
                                       "--non-recursive")
ExternalCommand(cwd=self.repository.basedir, command=cmd).execute(names)

+    def _tag(self, tag):
+        """
+        TAG current revision.
+        """
+        if self.repository.setupTagsDirectory():
+            src = self.repository.repository + self.repository.module
+            dest = self.repository.repository + self.repository.tags_path \
+                                              + '/' + tag.replace('/', '_')
+
+            # FIXME: Set origin author
+            cmd = self.repository.command("copy", src, dest, "-m", tag)
+ svntag = ExternalCommand(cwd=self.repository.basedir, command=cmd)
+            svntag.execute(stdout=PIPE, stderr=PIPE)
+
def _commit(self, date, author, patchname, changelog=None, entries=None,
                 tags = [], isinitialcommit = False):
         """
_______________________________________________
Tailor mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/tailor

Reply via email to