# HG changeset patch # User Sean Farley # Date 2014-01-22 21:31:24 # Node ID 5842d63cfe56b32a8d09ee78e028b64a51c5b4f6 # Parent 7a479791020585f377cac0da9f287d2becd1439a convert: avoid updating tags when there is nothing new Previously, when converting from a mercurial repo there would be an extraneous commit at the end of the convert process that would rewrite tags. Now, we check if there are any new tags before doing this rewriting. diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -212,6 +212,25 @@ class mercurial_sink(converter_sink): newlines = sorted([("%s %s\n" % (tags[tag], tag)) for tag in tags]) if newlines == oldlines: return None, None + + # if the old and new tags match, then there is nothing to update + oldtags = set() + newtags = set() + for line in oldlines: + s = line.strip().split(' ', 1) + if len(s) != 2: + continue + oldtags.add(s[1]) + for line in newlines: + s = line.strip().split(' ', 1) + if len(s) != 2: + continue + if s[1] not in oldtags: + newtags.add(s[1].strip()) + + if not newtags: + return None, None + data = "".join(newlines) def getfilectx(repo, memctx, f): return context.memfilectx(f, data, False, False, None)