Added git checkout -f without args to githelp

Summary:
`githelp` supported `git checkout -f xyz` but not the same command with out a
path or a rev. Added support for it and wrote a test.

Test Plan:
Added tests and ran them.

Task: #7499727

Reviewers: ericsumner, durham

Reviewed By: durham

Subscribers: joesavona

Differential Revision: https://phabricator.fb.com/D2372309

Signature: t1:2372309:1440530832:cb32553b2ef7f7ff0e09cb80ff6449a8c26c2caf
This commit is contained in:
Christian Delahousse 2015-08-21 16:32:43 -07:00
parent f90fce8d84
commit bcaf93b996
2 changed files with 17 additions and 1 deletions

View File

@ -262,7 +262,8 @@ def checkout(ui, repo, *args, **kwargs):
cmd = Command('update')
if opts.get('force'):
cmd['-C'] = None
if paths or rev:
cmd['-C'] = None
if opts.get('patch'):
cmd = Command('revert')
@ -291,6 +292,9 @@ def checkout(ui, repo, *args, **kwargs):
cmd['-r'] = rev
else:
cmd.append(rev)
elif opts.get('force'):
cmd = Command('revert')
cmd['--all'] = None
else:
raise GitUnknownError("a commit must be specified")

View File

@ -145,6 +145,18 @@ githelp for checkout with the -p option
hg revert -i -r xyz abc
githelp for checkout with the -f option and a rev
$ hg githelp -- git checkout -f xyz
hg update -C xyz
$ hg githelp -- git checkout --force xyz
hg update -C xyz
githelp for checkout with the -f option without an arg
$ hg githelp -- git checkout -f
hg revert --all
$ hg githelp -- git checkout --force
hg revert --all
githelp for grep with pattern and path
$ hg githelp -- grep shrubbery flib/intern/
hg grep shrubbery flib/intern/