diff --git a/hgext/githelp.py b/hgext/githelp.py --- a/hgext/githelp.py +++ b/hgext/githelp.py @@ -192,12 +192,15 @@ def am(ui, repo, *args, **kwargs): 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") 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 @@ githelp for apply with directory strip c $ 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