diff mercurial/localrepo.py @ 42004:0bd730fbcc2b

branchcache: introduce hasbranch() This will be used to check whether a branch exists or not. This will optimized in future. Differential Revision: https://phab.mercurial-scm.org/D6154
author Pulkit Goyal <pulkit@yandex-team.ru>
date Mon, 18 Mar 2019 19:31:45 +0300
parents 624d6683c705
children 1fac9b931d46
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Mar 18 19:11:55 2019 +0300
+++ b/mercurial/localrepo.py	Mon Mar 18 19:31:45 2019 +0300
@@ -1556,7 +1556,7 @@
         return scmutil.revsymbol(self, key).node()
 
     def lookupbranch(self, key):
-        if key in self.branchmap().entries:
+        if self.branchmap().hasbranch(key):
             return key
 
         return scmutil.revsymbol(self, key).branch()
@@ -2730,7 +2730,7 @@
         if branch is None:
             branch = self[None].branch()
         branches = self.branchmap()
-        if branch not in branches.entries:
+        if not branches.hasbranch(branch):
             return []
         # the cache returns heads ordered lowest to highest
         bheads = list(reversed(branches.branchheads(branch, closed=closed)))