convert: compare tags from all heads instead of just one
authorSean Farley <sean.michael.farley@gmail.com>
Wed, 22 Jan 2014 17:38:05 -0600
changeset 20376 7a4797910205
parent 20375 81cf597dafa9
child 20377 5842d63cfe56
convert: compare tags from all heads instead of just one Previously, the hg sink for puttags would just use one head for getting the old tags which would sometimes lead to tags disappearing. Now, we iterate over all heads and merge the results.
hgext/convert/hg.py
--- a/hgext/convert/hg.py	Tue Jan 21 11:35:17 2014 -0600
+++ b/hgext/convert/hg.py	Wed Jan 22 17:38:05 2014 -0600
@@ -201,10 +201,13 @@
             parentctx = None
             tagparent = nullid
 
-        try:
-            oldlines = sorted(parentctx['.hgtags'].data().splitlines(True))
-        except Exception:
-            oldlines = []
+        oldlines = set()
+        for branch, heads in self.repo.branchmap().iteritems():
+            for h in heads:
+                if '.hgtags' in self.repo[h]:
+                    oldlines.update(
+                        set(self.repo[h]['.hgtags'].data().splitlines(True)))
+        oldlines = sorted(list(oldlines))
 
         newlines = sorted([("%s %s\n" % (tags[tag], tag)) for tag in tags])
         if newlines == oldlines: