# HG changeset patch # User FUJIWARA Katsunori # Date 2014-08-23 14:03:50 # Node ID e116abad3afaaedd1f7d82e9e001aa3f8fa1a9e0 # Parent b13b99d39a465df4843048484e9bd0bab0433a0c import: disallow meaningless combination of "--exact" and "--edit" Before this patch, "hg import" allows combination of "--exact" and "--edit", even though editing commit message breaks exact-ness. This patch disallows meaningless combination of "--exact" and "--edit". diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3880,6 +3880,8 @@ def import_(ui, repo, patch1=None, *patc raise util.Abort(_('similarity must be between 0 and 100')) if sim and not update: 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 update: cmdutil.checkunfinished(repo) diff --git a/tests/test-import-bypass.t b/tests/test-import-bypass.t --- a/tests/test-import-bypass.t +++ b/tests/test-import-bypass.t @@ -22,10 +22,13 @@ Test --bypass with other options 0 files updated, 0 files merged, 1 files removed, 0 files unresolved Test importing an existing revision -(this also tests that editor is not invoked for '--bypass', if the -patch contains the commit message, regardless of '--edit') +(this also tests that "hg import" disallows combination of '--exact' +and '--edit') - $ HGEDITOR=cat hg import --bypass --exact --edit ../test.diff + $ hg import --bypass --exact --edit ../test.diff + abort: cannot use --exact with --edit + [255] + $ hg import --bypass --exact ../test.diff applying ../test.diff $ shortlog o 1:4e322f7ce8e3 test 0 0 - foo - changea @@ -66,8 +69,10 @@ Test --user, --date and --message repository tip rolled back to revision 1 (undo import) Test --import-branch +(this also tests that editor is not invoked for '--bypass', if the +patch contains the commit message, regardless of '--edit') - $ hg import --bypass --import-branch ../test.diff + $ HGEDITOR=cat hg import --bypass --import-branch --edit ../test.diff applying ../test.diff $ shortlog o 1:4e322f7ce8e3 test 0 0 - foo - changea