# HG changeset patch # User Alexis S. L. Carvalho # Date 1170782620 7200 # Node ID 516f883e3d79f2e946a7bd97ed37aa239d2d4bf4 # Parent 40030c1b6bc68cf4c6f37c0eb7efa76af3d58834 convert-repo: handle packed git tags diff --git a/contrib/convert-repo b/contrib/convert-repo --- a/contrib/convert-repo +++ b/contrib/convert-repo @@ -359,14 +359,18 @@ class convert_git: def gettags(self): tags = {} - for f in os.listdir(self.path + "/refs/tags"): - try: - h = file(self.path + "/refs/tags/" + f).read().strip() - c = self.catfile(h, "tag") # read the commit hash - h = c.splitlines()[0].split()[1] - tags[f] = h - except: - pass + fh = os.popen('git-ls-remote --tags "%s" 2>/dev/null' % self.path) + prefix = 'refs/tags/' + for line in fh: + line = line.strip() + if not line.endswith("^{}"): + continue + node, tag = line.split(None, 1) + if not tag.startswith(prefix): + continue + tag = tag[len(prefix):-3] + tags[tag] = node + return tags class convert_mercurial: