# HG changeset patch # User Matt Mackall # Date 2014-09-19 19:51:58 # Node ID efedda4aed49ce3d5f0d6997b7d78a9a7806b26b # Parent 2b5940f64750f027b9a12e55d33a74854365539c import: let --exact 'work' with --no-commit (issue4376) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -727,7 +727,11 @@ def tryimportone(ui, repo, hunk, parents n = memctx.commit() finally: store.close() - if opts.get('exact') and hex(n) != nodeid: + if opts.get('exact') and opts.get('no_commit'): + # --exact with --no-commit is still useful in that it does merge + # and branch bits + ui.warn(_("warning: can't check exact import with --no-commit\n")) + elif opts.get('exact') and hex(n) != nodeid: raise util.Abort(_('patch is damaged or loses information')) if n: # i18n: refers to a short changeset id diff --git a/tests/test-impexp-branch.t b/tests/test-impexp-branch.t --- a/tests/test-impexp-branch.t +++ b/tests/test-impexp-branch.t @@ -54,6 +54,14 @@ Make sure import still works with branch $ hg init c $ cd c + $ hg import --exact --no-commit ../r0.patch + applying ../r0.patch + warning: can't check exact import with --no-commit + $ hg st + A rev + $ hg revert -a + forgetting rev + $ rm rev $ hg import --exact ../r0.patch applying ../r0.patch $ hg import --exact ../r1.patch