[Pkg-ocaml-maint-commits] r5917 - /trunk/tools/svn2git/glondu_svn2git.py

glondu-guest at users.alioth.debian.org glondu-guest at users.alioth.debian.org
Sat Aug 9 14:40:12 UTC 2008


Author: glondu-guest
Date: Sat Aug  9 14:40:12 2008
New Revision: 5917

URL: http://svn.debian.org/wsvn/?sc=1&rev=5917
Log:
Code cleanup and handle tag deletion

Modified:
    trunk/tools/svn2git/glondu_svn2git.py

Modified: trunk/tools/svn2git/glondu_svn2git.py
URL: http://svn.debian.org/wsvn/trunk/tools/svn2git/glondu_svn2git.py?rev=5917&op=diff
==============================================================================
--- trunk/tools/svn2git/glondu_svn2git.py (original)
+++ trunk/tools/svn2git/glondu_svn2git.py Sat Aug  9 14:40:12 2008
@@ -57,7 +57,7 @@
 
 # SVN revision touching several packages known to be harmless
 # (used to remove warnings)
-harmless_svn_revs = set((3052, 3055, 3158, 3216, 3577, 4560, 4565, 4753, 4997, 5001, 5637))
+harmless_svn_revs = set((2674, 3052, 3055, 3158, 3216, 3577, 4560, 4565, 4753, 4997, 5001, 5637))
 
 
 def run_command(name, cmd):
@@ -105,6 +105,9 @@
         return "%s@%s" % (path.getAttribute("copyfrom-path"), path.getAttribute("copyfrom-rev"))
     else:
         return None
+
+def is_tarball(file):
+    return file.endswith(".tar.gz") or file.endswith("tar.bz2")
 
 
 class GitCommit:
@@ -149,8 +152,7 @@
                 if working_dir:
                     if (file+"/").startswith(working_dir):
                         nb_files += 1
-                    elif self.rev not in harmless_svn_revs and \
-                            not (file.endswith(".tar.gz") or file.endswith(".tar.bz2")):
+                    elif not is_tarball(file) and self.rev not in harmless_svn_revs:
                         print "# unrecognized file (%s) %s (will probably be skipped)" % (action, file)
                 else:
                     m = svnwdir_re.match(file)
@@ -158,9 +160,9 @@
                         working_dir = m.group(1) + "/"
                         local_wdir = m.group(2) or m.group(3)
                         nb_files += 1
-                    elif self.rev not in harmless_svn_revs:
+                    elif not is_tarball(file) and self.rev not in harmless_svn_revs:
                         print "# cannot recognize working dir in (%s) %s" % (action, file)
-                if file.endswith(".tar.gz") or file.endswith(".tar.bz2"):
+                if is_tarball(file):
                     m = svntgz_re.match(file)
                     if tgz or not m:
                         print "# deal with (%s) %s manually" % (action, file)
@@ -298,6 +300,7 @@
         tag_name = None
         parent_rev = None
         for (action, file, copyfrom) in self.files:
+            tag_delete = False
             if action == "A":
                 m = svntag_path_re.match(file)
                 if m:
@@ -308,12 +311,20 @@
                         parent_rev = rev
                     elif parent_rev != rev:
                         print "# duplicate parent %s" % rev
+            elif action == "D":
+                m = svntag_path_re.match(file)
+                if m:
+                    tag_name = m.group(4)
+                    tag_delete = True
             else:
                 print "# unrecognized operation (%s) %s (will probably be skipped)" % (action, file)
         if tag_name:
             # '~' is not valid in tag names
             tag_name = tag_name.replace('~', '.')
-            cmd = "git tag debian/%s -m %s" % (tag_name, escape_for_shell(self.msg))
+            if tag_delete:
+                cmd = "git tag -d debian/%s" % tag_name
+            else:
+                cmd = "git tag debian/%s -m %s" % (tag_name, escape_for_shell(self.msg))
         else:
             print "# unable to find tag name"
             for (action, file, copyfrom) in self.files:




More information about the Pkg-ocaml-maint-commits mailing list