comparison contrib/convert-repo @ 4062:516f883e3d79

convert-repo: handle packed git tags
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 06 Feb 2007 15:23:40 -0200
parents 705d0792dbf2
children 6b2909e84203
comparison
equal deleted inserted replaced
4061:40030c1b6bc6 4062:516f883e3d79
357 c = commit(parents=parents, date=date, author=author, desc=message) 357 c = commit(parents=parents, date=date, author=author, desc=message)
358 return c 358 return c
359 359
360 def gettags(self): 360 def gettags(self):
361 tags = {} 361 tags = {}
362 for f in os.listdir(self.path + "/refs/tags"): 362 fh = os.popen('git-ls-remote --tags "%s" 2>/dev/null' % self.path)
363 try: 363 prefix = 'refs/tags/'
364 h = file(self.path + "/refs/tags/" + f).read().strip() 364 for line in fh:
365 c = self.catfile(h, "tag") # read the commit hash 365 line = line.strip()
366 h = c.splitlines()[0].split()[1] 366 if not line.endswith("^{}"):
367 tags[f] = h 367 continue
368 except: 368 node, tag = line.split(None, 1)
369 pass 369 if not tag.startswith(prefix):
370 continue
371 tag = tag[len(prefix):-3]
372 tags[tag] = node
373
370 return tags 374 return tags
371 375
372 class convert_mercurial: 376 class convert_mercurial:
373 def __init__(self, path): 377 def __init__(self, path):
374 self.path = path 378 self.path = path