changeset 20376:7a4797910205

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.
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 22 Jan 2014 17:38:05 -0600
parents 81cf597dafa9
children 5842d63cfe56
files hgext/convert/hg.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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: