# HG changeset patch # User Anton Shestakov # Date 1559205758 -28800 # Node ID 7752cd3a2f83fe42ebf9af29b1cc3fd90eb2c635 # Parent 37ff80505dfd6a21b4d89a138c08d0981825eb77 githelp: translate git stash show and clear actions and --patch flag Differential Revision: https://phab.mercurial-scm.org/D6461 diff -r 37ff80505dfd -r 7752cd3a2f83 hgext/githelp.py --- a/hgext/githelp.py Thu May 30 16:40:34 2019 +0800 +++ b/hgext/githelp.py Thu May 30 16:42:38 2019 +0800 @@ -923,6 +923,7 @@ def stash(ui, repo, *args, **kwargs): cmdoptions = [ + ('p', 'patch', None, ''), ] args, opts = parseoptions(ui, cmdoptions, args) @@ -931,6 +932,17 @@ if action == 'list': cmd['-l'] = None + if opts.get('patch'): + cmd['-p'] = None + elif action == 'show': + if opts.get('patch'): + cmd['-p'] = None + else: + cmd['--stat'] = None + if len(args) > 1: + cmd.append(args[1]) + elif action == 'clear': + cmd['--cleanup'] = None elif action == 'drop': cmd['-d'] = None if len(args) > 1: @@ -943,10 +955,9 @@ cmd.append(args[1]) if action == 'apply': cmd['--keep'] = None - elif (action == 'branch' or action == 'show' or action == 'clear' - or action == 'create'): + elif action == 'branch' or action == 'create': ui.status(_("note: Mercurial doesn't have equivalents to the " - "git stash branch, show, clear, or create actions\n\n")) + "git stash branch or create actions\n\n")) return else: if len(args) > 0: diff -r 37ff80505dfd -r 7752cd3a2f83 tests/test-githelp.t --- a/tests/test-githelp.t Thu May 30 16:40:34 2019 +0800 +++ b/tests/test-githelp.t Thu May 30 16:42:38 2019 +0800 @@ -219,6 +219,22 @@ $ hg githelp -- git stash drop xyz hg shelve -d xyz +githelp for stash list with patch + $ hg githelp -- git stash list -p + hg shelve -l -p + +githelp for stash show + $ hg githelp -- git stash show + hg shelve --stat + +githelp for stash show with patch and name + $ hg githelp -- git stash show -p mystash + hg shelve -p mystash + +githelp for stash clear + $ hg githelp -- git stash clear + hg shelve --cleanup + githelp for whatchanged should show deprecated message $ hg githelp -- whatchanged -p this command has been deprecated in the git project, thus isn't supported by this tool