diff hgsubversion/stupid.py @ 447:0d3b5acb1d51

tags: handle edits to tags as gracefully as possible
author Augie Fackler <durin42@gmail.com>
date Tue, 23 Jun 2009 21:38:27 -0500
parents 8c545dcad7b1
children ae35c389cdef
line wrap: on
line diff
--- a/hgsubversion/stupid.py
+++ b/hgsubversion/stupid.py
@@ -601,9 +601,18 @@ def convert_rev(ui, meta, svn, r, tbdelt
                 assert f[0] != '/'
 
         extra = meta.genextra(r.revnum, b)
-        if not meta.usebranchnames:
-            extra.pop('branch', None)
 
+        tag = False
+        tag = meta.is_path_tag(meta.remotename(b))
+
+        if tag:
+            if parentctx.node() == node.nullid:
+                continue
+            extra.update({'branch': parentctx.extra().get('branch', None),
+                          'close': 1})
+
+        if not meta.usebranchnames or extra.get('branch', None) == 'default':
+            extra.pop('branch', None)
         current_ctx = context.memctx(meta.repo,
                                      [parentctx.node(), revlog.nullid],
                                      r.message or util.default_commit_msg,
@@ -615,10 +624,14 @@ def convert_rev(ui, meta, svn, r, tbdelt
         ha = meta.repo.commitctx(current_ctx)
 
         branch = extra.get('branch', None)
-        if not branch in meta.branches:
+        if (not branch in meta.branches
+            and not meta.is_path_tag(meta.remotename(branch))):
             meta.branches[branch] = None, 0, r.revnum
-        meta.revmap[r.revnum, b] = ha
+        if not tag:
+            meta.revmap[r.revnum, b] = ha
         util.describe_commit(ui, ha, b)
+        if tag:
+            meta.movetag(tag, ha, parentctx.extra().get('branch', None), r, date)
 
     # These are branches with an 'R' status in svn log. This means they were
     # replaced by some other branch, so we need to verify they get marked as closed.