Patchwork D6459: githelp: translate --directory of git apply to --prefix

login
register
mail settings
Submitter phabricator
Date May 30, 2019, 8:46 a.m.
Message ID <differential-rev-PHID-DREV-bctemd35lmbnmgi4fugd-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/40272/
State Superseded
Headers show

Comments

phabricator - May 30, 2019, 8:46 a.m.
av6 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  According to the help pages, these flags do the same.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6459

AFFECTED FILES
  hgext/githelp.py
  tests/test-githelp.t

CHANGE DETAILS




To: av6, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-githelp.t b/tests/test-githelp.t
--- a/tests/test-githelp.t
+++ b/tests/test-githelp.t
@@ -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
diff --git a/hgext/githelp.py b/hgext/githelp.py
--- a/hgext/githelp.py
+++ b/hgext/githelp.py
@@ -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")