diff mercurial/commands.py @ 24258:093e8a5e995f

commands.import: accept a prefix option The --prefix option is meant to be relative to the root rather than the current working directory. This is for consistency with the rest of 'hg import' -- paths in patches are otherwise considered to be relative to the root. In upcoming patches we'll hook this option up to the patch functions. --exact with --prefix is currently disallowed because I can't really come up with sensible semantics for it, especially when only part of the patch is preserved.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 06 Mar 2015 22:56:19 -0800
parents a330660b3d71
children 9640820bc957
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Mar 10 11:01:10 2015 -0700
+++ b/mercurial/commands.py	Fri Mar 06 22:56:19 2015 -0800
@@ -4057,6 +4057,8 @@
      _('commit even if some hunks fail')),
     ('', 'exact', None,
      _('apply patch to the nodes from which it was generated')),
+    ('', 'prefix', '',
+     _('apply patch to directory relative to the root'), _('DIR')),
     ('', 'import-branch', None,
      _('use any branch information in patch (implied by --exact)'))] +
     commitopts + commitopts2 + similarityopts,
@@ -4156,6 +4158,8 @@
         raise util.Abort(_('cannot use --similarity with --bypass'))
     if opts.get('exact') and opts.get('edit'):
         raise util.Abort(_('cannot use --exact with --edit'))
+    if opts.get('exact') and opts.get('prefix'):
+        raise util.Abort(_('cannot use --exact with --prefix'))
 
     if update:
         cmdutil.checkunfinished(repo)