From 7af591a53ba2836f22a8c99d44c15c80f735163f Mon Sep 17 00:00:00 2001 From: "Alexis S. L. Carvalho" Date: Tue, 6 Feb 2007 15:23:40 -0200 Subject: [PATCH] convert-repo: handle packed git tags --- contrib/convert-repo | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/contrib/convert-repo b/contrib/convert-repo index 17a609e270..1a3605955b 100755 --- 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: