diff mercurial/localrepo.py @ 16720:e825a89de5d7

context: add changectx.closesbranch() method This removes the duplicated code for inspecting the 'close' extra field in a changeset.
author Brodie Rao <brodie@sf.io>
date Sun, 13 May 2012 14:04:06 +0200
parents e7bf09acd410
children 27b2e1823e83
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun May 13 14:04:04 2012 +0200
+++ b/mercurial/localrepo.py	Sun May 13 14:04:06 2012 +0200
@@ -511,7 +511,7 @@
         '''return the tipmost branch head in heads'''
         tip = heads[-1]
         for h in reversed(heads):
-            if 'close' not in self.changelog.read(h)[5]:
+            if not self[h].closesbranch():
                 tip = h
                 break
         return tip
@@ -1555,8 +1555,7 @@
             fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
             bheads = [h for h in bheads if h in fbheads]
         if not closed:
-            bheads = [h for h in bheads if
-                      ('close' not in self.changelog.read(h)[5])]
+            bheads = [h for h in bheads if not self[h].closesbranch()]
         return bheads
 
     def branches(self, nodes):
@@ -2206,7 +2205,7 @@
                 heads = cl.heads()
                 dh = len(heads) - len(oldheads)
                 for h in heads:
-                    if h not in oldheads and 'close' in self[h].extra():
+                    if h not in oldheads and self[h].closesbranch():
                         dh -= 1
             htext = ""
             if dh: