Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
24257:31e9f66863f3 | 24258:093e8a5e995f |
---|---|
4055 _("apply patch without touching the working directory")), | 4055 _("apply patch without touching the working directory")), |
4056 ('', 'partial', None, | 4056 ('', 'partial', None, |
4057 _('commit even if some hunks fail')), | 4057 _('commit even if some hunks fail')), |
4058 ('', 'exact', None, | 4058 ('', 'exact', None, |
4059 _('apply patch to the nodes from which it was generated')), | 4059 _('apply patch to the nodes from which it was generated')), |
4060 ('', 'prefix', '', | |
4061 _('apply patch to directory relative to the root'), _('DIR')), | |
4060 ('', 'import-branch', None, | 4062 ('', 'import-branch', None, |
4061 _('use any branch information in patch (implied by --exact)'))] + | 4063 _('use any branch information in patch (implied by --exact)'))] + |
4062 commitopts + commitopts2 + similarityopts, | 4064 commitopts + commitopts2 + similarityopts, |
4063 _('[OPTION]... PATCH...')) | 4065 _('[OPTION]... PATCH...')) |
4064 def import_(ui, repo, patch1=None, *patches, **opts): | 4066 def import_(ui, repo, patch1=None, *patches, **opts): |
4154 raise util.Abort(_('similarity must be between 0 and 100')) | 4156 raise util.Abort(_('similarity must be between 0 and 100')) |
4155 if sim and not update: | 4157 if sim and not update: |
4156 raise util.Abort(_('cannot use --similarity with --bypass')) | 4158 raise util.Abort(_('cannot use --similarity with --bypass')) |
4157 if opts.get('exact') and opts.get('edit'): | 4159 if opts.get('exact') and opts.get('edit'): |
4158 raise util.Abort(_('cannot use --exact with --edit')) | 4160 raise util.Abort(_('cannot use --exact with --edit')) |
4161 if opts.get('exact') and opts.get('prefix'): | |
4162 raise util.Abort(_('cannot use --exact with --prefix')) | |
4159 | 4163 |
4160 if update: | 4164 if update: |
4161 cmdutil.checkunfinished(repo) | 4165 cmdutil.checkunfinished(repo) |
4162 if (opts.get('exact') or not opts.get('force')) and update: | 4166 if (opts.get('exact') or not opts.get('force')) and update: |
4163 cmdutil.bailifchanged(repo) | 4167 cmdutil.bailifchanged(repo) |