##// END OF EJS Templates
branchcache: introduce hasbranch()...
Pulkit Goyal -
r42171:0bd730fb default
parent child Browse files
Show More
@@ -175,6 +175,10 b' class branchcache(object):'
175 175 def iteritems(self):
176 176 return self.entries.iteritems()
177 177
178 def hasbranch(self, label):
179 """ checks whether a branch of this name exists or not """
180 return label in self.entries
181
178 182 @classmethod
179 183 def fromfile(cls, repo):
180 184 f = None
@@ -1556,7 +1556,7 b' class localrepository(object):'
1556 1556 return scmutil.revsymbol(self, key).node()
1557 1557
1558 1558 def lookupbranch(self, key):
1559 if key in self.branchmap().entries:
1559 if self.branchmap().hasbranch(key):
1560 1560 return key
1561 1561
1562 1562 return scmutil.revsymbol(self, key).branch()
@@ -2730,7 +2730,7 b' class localrepository(object):'
2730 2730 if branch is None:
2731 2731 branch = self[None].branch()
2732 2732 branches = self.branchmap()
2733 if branch not in branches.entries:
2733 if not branches.hasbranch(branch):
2734 2734 return []
2735 2735 # the cache returns heads ordered lowest to highest
2736 2736 bheads = list(reversed(branches.branchheads(branch, closed=closed)))
@@ -555,7 +555,7 b' def branch(repo, subset, x):'
555 555 if kind == 'literal':
556 556 # note: falls through to the revspec case if no branch with
557 557 # this name exists and pattern kind is not specified explicitly
558 if pattern in repo.branchmap():
558 if repo.branchmap().hasbranch(pattern):
559 559 return subset.filter(lambda r: matcher(getbranch(r)),
560 560 condrepr=('<branch %r>', b))
561 561 if b.startswith('literal:'):
General Comments 0
You need to be logged in to leave comments. Login now