comparison mercurial/scmutil.py @ 37504:901e749ca0e1

context: extract partial nodeid lookup method to scmutil We will add another caller soon, and there's a non-obvious reason to use the unfiltered repo that we don't want to copy across the code base. Differential Revision: https://phab.mercurial-scm.org/D3189
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 08 Apr 2018 08:06:34 -0700
parents bbd240f81ac5
children 1c09481acdcc
comparison
equal deleted inserted replaced
37503:49a8c2cc7978 37504:901e749ca0e1
431 hexfunc = hex 431 hexfunc = hex
432 else: 432 else:
433 hexfunc = short 433 hexfunc = short
434 return '%d:%s' % (rev, hexfunc(node)) 434 return '%d:%s' % (rev, hexfunc(node))
435 435
436 def resolvepartialhexnodeid(repo, prefix):
437 # Uses unfiltered repo because it's faster when then prefix is ambiguous/
438 # This matches the "shortest" template function.
439 node = repo.unfiltered().changelog._partialmatch(prefix)
440 if node is None:
441 return
442 repo.changelog.rev(node) # make sure node isn't filtered
443 return node
444
436 def isrevsymbol(repo, symbol): 445 def isrevsymbol(repo, symbol):
437 try: 446 try:
438 revsymbol(repo, symbol) 447 revsymbol(repo, symbol)
439 return True 448 return True
440 except error.RepoLookupError: 449 except error.RepoLookupError: