contrib/convert-repo
changeset 4062 516f883e3d79
parent 4047 705d0792dbf2
child 4082 6b2909e84203
--- a/contrib/convert-repo	Sun Feb 04 16:08:56 2007 -0800
+++ b/contrib/convert-repo	Tue Feb 06 15:23:40 2007 -0200
@@ -359,14 +359,18 @@
 
     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: