changeset 42395:eddff539f5be

githelp: translate --directory of git apply to --prefix According to the help pages, these flags do the same. Differential Revision: https://phab.mercurial-scm.org/D6459
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 30 May 2019 16:38:42 +0800
parents ad55a0a5894f
children 37ff80505dfd
files hgext/githelp.py tests/test-githelp.t
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/githelp.py	Thu May 23 11:14:32 2019 -0400
+++ b/hgext/githelp.py	Thu May 30 16:38:42 2019 +0800
@@ -192,12 +192,15 @@
 def apply(ui, repo, *args, **kwargs):
     cmdoptions = [
         ('p', 'p', int, ''),
+        ('', 'directory', '', ''),
     ]
     args, opts = parseoptions(ui, cmdoptions, args)
 
     cmd = Command('import --no-commit')
     if (opts.get('p')):
         cmd['-p'] = opts.get('p')
+    if opts.get('directory'):
+        cmd['--prefix'] = opts.get('directory')
     cmd.extend(args)
 
     ui.status((bytes(cmd)), "\n")
--- a/tests/test-githelp.t	Thu May 23 11:14:32 2019 -0400
+++ b/tests/test-githelp.t	Thu May 30 16:38:42 2019 +0800
@@ -256,6 +256,10 @@
   $ hg githelp -- apply -p 5
   hg import --no-commit -p 5
 
+githelp for apply with prefix directory
+  $ hg githelp -- apply --directory=modules
+  hg import --no-commit --prefix modules
+
 git merge-base
   $ hg githelp -- git merge-base --is-ancestor
   ignoring unknown option --is-ancestor