changeset 240:237f0c0c02dc

handle the new tag cache in mercurial crew
author Abderrahim Kitouni <a.kitouni@gmail.com>
date Tue, 04 Aug 2009 18:39:02 +0100
parents c5e5e7849803
children b826908ec522
files hgrepo.py
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgrepo.py
+++ b/hgrepo.py
@@ -33,15 +33,36 @@
             else: #pragma: no cover
                 return super(hgrepo, self).findoutgoing(remote, base, heads, force)
 
+        def _findtags(self):
+            (tags, tagtypes) = super(hgrepo, self)._findtags()
+
+            git = GitHandler(self, self.ui)
+            for tag, rev in git.tags.iteritems():
+                if tag in tags:
+                    continue
+
+                tags[tag] = bin(rev)
+                tagtypes[tag] = 'git'
+
+            return (tags, tagtypes)
+
         def tags(self):
+            if not hasattr(self, 'tagscache'):
+                # mercurial 1.4
+                return super(hgrepo, self).tags()
+
             if self.tagscache:
                 return self.tagscache
 
             git = GitHandler(self, self.ui)
             tagscache = super(hgrepo, self).tags()
-            tagscache.update(dict([(tag, bin(rev)) for (tag,rev) in git.tags.iteritems()]))
-            tagstypes = dict([(tag, 'git') for tag in git.tags])
-            self._tagstypecache.update(tagstypes)
+            for tag, rev in git.tags.iteritems():
+                if tag in tagscache:
+                    continue
+
+                tagscache[tag] = bin(rev)
+                self._tagstypecache[tag] = 'git'
+
             return tagscache
 
     return hgrepo