comparison hgext/githelp.py @ 37388:764ada920db5

githelp: use revsymbol() for looking up symbol I don't know if we should be using revsingle() here, so I was conservative and switched to revsymbol(). Differential Revision: https://phab.mercurial-scm.org/D3156
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 05 Apr 2018 23:23:48 -0700
parents a8a902d7176e
children d8bd6a9c64a5
comparison
equal deleted inserted replaced
37387:83d537162894 37388:764ada920db5
24 from mercurial import ( 24 from mercurial import (
25 encoding, 25 encoding,
26 error, 26 error,
27 fancyopts, 27 fancyopts,
28 registrar, 28 registrar,
29 scmutil,
29 ) 30 )
30 from mercurial.utils import ( 31 from mercurial.utils import (
31 procutil, 32 procutil,
32 ) 33 )
33 34
251 The first argument to git checkout can either be a revision or a path. Let's 252 The first argument to git checkout can either be a revision or a path. Let's
252 generally assume it's a revision, unless it's obviously a path. There are 253 generally assume it's a revision, unless it's obviously a path. There are
253 too many ways to spell revisions in git for us to reasonably catch all of 254 too many ways to spell revisions in git for us to reasonably catch all of
254 them, so let's be conservative. 255 them, so let's be conservative.
255 """ 256 """
256 if string in repo: 257 if scmutil.isrevsymbol(repo, string):
257 # if it's definitely a revision let's not even check if a file of the 258 # if it's definitely a revision let's not even check if a file of the
258 # same name exists. 259 # same name exists.
259 return False 260 return False
260 261
261 cwd = repo.getcwd() 262 cwd = repo.getcwd()