comparison 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
comparison
equal deleted inserted replaced
42003:7546bf46bfcd 42004:0bd730fbcc2b
1554 1554
1555 def lookup(self, key): 1555 def lookup(self, key):
1556 return scmutil.revsymbol(self, key).node() 1556 return scmutil.revsymbol(self, key).node()
1557 1557
1558 def lookupbranch(self, key): 1558 def lookupbranch(self, key):
1559 if key in self.branchmap().entries: 1559 if self.branchmap().hasbranch(key):
1560 return key 1560 return key
1561 1561
1562 return scmutil.revsymbol(self, key).branch() 1562 return scmutil.revsymbol(self, key).branch()
1563 1563
1564 def known(self, nodes): 1564 def known(self, nodes):
2728 If closed is True, return heads that are marked as closed as well. 2728 If closed is True, return heads that are marked as closed as well.
2729 ''' 2729 '''
2730 if branch is None: 2730 if branch is None:
2731 branch = self[None].branch() 2731 branch = self[None].branch()
2732 branches = self.branchmap() 2732 branches = self.branchmap()
2733 if branch not in branches.entries: 2733 if not branches.hasbranch(branch):
2734 return [] 2734 return []
2735 # the cache returns heads ordered lowest to highest 2735 # the cache returns heads ordered lowest to highest
2736 bheads = list(reversed(branches.branchheads(branch, closed=closed))) 2736 bheads = list(reversed(branches.branchheads(branch, closed=closed)))
2737 if start is not None: 2737 if start is not None:
2738 # filter out the heads that cannot be reached from startrev 2738 # filter out the heads that cannot be reached from startrev