comparison contrib/convert-repo @ 1387:0c7e8d345564

convert-repo: linearize the tag commit
author Matt Mackall <mpm@selenic.com>
date Wed, 05 Oct 2005 19:25:45 -0700
parents a1040345fdda
children 5eb2d3c54165
comparison
equal deleted inserted replaced
1386:a1040345fdda 1387:0c7e8d345564
158 f.close() 158 f.close()
159 if not oldlines: self.repo.add([".hgtags"]) 159 if not oldlines: self.repo.add([".hgtags"])
160 date = "%s 0" % int(time.mktime(time.gmtime())) 160 date = "%s 0" % int(time.mktime(time.gmtime()))
161 self.repo.rawcommit([".hgtags"], "update tags", "convert-repo", 161 self.repo.rawcommit([".hgtags"], "update tags", "convert-repo",
162 date, self.repo.changelog.tip(), hg.nullid) 162 date, self.repo.changelog.tip(), hg.nullid)
163 return hg.hex(self.repo.changelog.tip())
163 164
164 class convert: 165 class convert:
165 def __init__(self, source, dest, mapfile): 166 def __init__(self, source, dest, mapfile):
166 self.source = source 167 self.source = source
167 self.dest = dest 168 self.dest = dest
267 for k in tags: 268 for k in tags:
268 v = tags[k] 269 v = tags[k]
269 if v in self.map: 270 if v in self.map:
270 ctags[k] = self.map[v] 271 ctags[k] = self.map[v]
271 272
272 self.dest.puttags(ctags) 273 if ctags:
274 nrev = self.dest.puttags(ctags)
275 # write another hash correspondence to override the previous
276 # one so we don't end up with extra tag heads
277 file(self.mapfile, "a").write("%s %s\n" % (c, nrev))
273 278
274 gitpath, hgpath, mapfile = sys.argv[1:] 279 gitpath, hgpath, mapfile = sys.argv[1:]
275 if os.path.isdir(gitpath + "/.git"): 280 if os.path.isdir(gitpath + "/.git"):
276 gitpath += "/.git" 281 gitpath += "/.git"
277 282