[PATCH 11 of 12] Commit tags only when required
Edouard Gomez
ed.gomez at free.fr
Tue Dec 19 06:05:52 UTC 2006
# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1166511815 -3600
# Node ID 8a1695aef27b7106f483c947cb793816464fafe8
# Parent 08ce30bd66126628d355090eeefba8990da54a0b
Commit tags only when required
diff -r 08ce30bd6612 -r 8a1695aef27b hg-cvs-import
--- a/hg-cvs-import Tue Dec 19 08:03:35 2006 +0100
+++ b/hg-cvs-import Tue Dec 19 08:03:35 2006 +0100
@@ -156,31 +156,36 @@ def committags(patchset):
if not alltags:
return
- if alltags:
- repotags = repo.tags()
- lines = {}
- for tag in repotags:
- lines[tag] = hg.hex(repotags[tag])
-
- for tag in alltags:
- for r in alltags[tag]:
- lines[tag] = r
-
- ar = []
- for x in lines:
- if x != 'tip':
- ar.append("%s %s\n" % (lines[x], x))
- ar.sort()
- f = repo.wfile(".hgtags", 'w')
- f.write("".join(ar))
- f.close()
-
- date = "%s 0" % int(time.mktime(time.gmtime()))
- user = namemap.get('convert-repo', 'convert-repo')
- node = map.get(0, hg.hex(repo.changelog.node(0)))
- n = repo.rawcommit([".hgtags"], "Update tags", user,
+ writetags = False
+ repotags = repo.tags()
+ lines = {}
+ for tag in repotags:
+ lines[tag] = hg.hex(repotags[tag])
+
+ for tag in alltags:
+ r = alltags[tag][-1]
+ if tag not in lines or lines[tag] != r:
+ lines[tag] = r
+ writetags = True
+
+ if not writetags:
+ return
+
+ ar = []
+ for x in lines:
+ if x != 'tip':
+ ar.append("%s %s\n" % (lines[x], x))
+ ar.sort()
+ f = repo.wfile(".hgtags", 'w')
+ f.write("".join(ar))
+ f.close()
+
+ date = "%s 0" % int(time.mktime(time.gmtime()))
+ user = namemap.get('convert-repo', 'convert-repo')
+ node = map.get(0, hg.hex(repo.changelog.node(0)))
+ n = repo.rawcommit([".hgtags"], "Update tags", user,
date, hg.bin(node), hg.nullid)
- mapf.write("%d %s\n" % (0, hg.hex(repo.changelog.tip())))
+ mapf.write("%d %s\n" % (0, hg.hex(repo.changelog.tip())))
def branchlookup(branch):
# XXX: Flush the repo branch cache
More information about the Mercurial-devel
mailing list