branchtags: use changectx
authorMatt Mackall <mpm@selenic.com>
Tue, 17 Oct 2006 22:09:56 -0500
changeset 3439 a7ef6b6cc311
parent 3438 b17f9d3eda74
child 3440 0f1fd9854cdc
branchtags: use changectx setting self.branchcache on entry avoids recursions in lookup
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Tue Oct 17 22:07:54 2006 -0500
+++ b/mercurial/localrepo.py	Tue Oct 17 22:09:56 2006 -0500
@@ -293,7 +293,7 @@
         if self.branchcache != None:
             return self.branchcache
 
-        self.branchcache = {}
+        self.branchcache = {} # avoid recursion in changectx
 
         try:
             f = self.opener("branches.cache")
@@ -310,12 +310,11 @@
 
         tip = self.changelog.count() - 1
         if lrev != tip:
-            for r in range(lrev + 1, tip + 1):
-                n = self.changelog.node(r)
-                c = self.changelog.read(n)
-                b = c[5].get("branch")
+            for r in xrange(lrev + 1, tip + 1):
+                c = self.changectx(r)
+                b = c.branch()
                 if b:
-                    self.branchcache[b] = n
+                    self.branchcache[b] = c.node()
             self._writebranchcache()
 
         return self.branchcache