comparison mercurial/revset.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 662ffdde5adf
children cab19d49f8bd
comparison
equal deleted inserted replaced
42003:7546bf46bfcd 42004:0bd730fbcc2b
553 else: 553 else:
554 kind, pattern, matcher = stringutil.stringmatcher(b) 554 kind, pattern, matcher = stringutil.stringmatcher(b)
555 if kind == 'literal': 555 if kind == 'literal':
556 # note: falls through to the revspec case if no branch with 556 # note: falls through to the revspec case if no branch with
557 # this name exists and pattern kind is not specified explicitly 557 # this name exists and pattern kind is not specified explicitly
558 if pattern in repo.branchmap(): 558 if repo.branchmap().hasbranch(pattern):
559 return subset.filter(lambda r: matcher(getbranch(r)), 559 return subset.filter(lambda r: matcher(getbranch(r)),
560 condrepr=('<branch %r>', b)) 560 condrepr=('<branch %r>', b))
561 if b.startswith('literal:'): 561 if b.startswith('literal:'):
562 raise error.RepoLookupError(_("branch '%s' does not exist") 562 raise error.RepoLookupError(_("branch '%s' does not exist")
563 % pattern) 563 % pattern)