# HG changeset patch # User Brendan Cully # Date 1258399868 28800 # Node ID 81f1462ef2c7016b5e7f3d6d679ef4ded91d2edd # Parent 0262bb59016f5e09843931593ba9272460855a4c Allow import --no-commit over an applied MQ patch. Since it only changes the working directory, it does not matter whether a patch is applied. This change makes it easier to use hg import --no-commit instead of patch. diff -r 0262bb59016f -r 81f1462ef2c7 hgext/mq.py --- a/hgext/mq.py Mon Nov 16 13:35:36 2009 +0100 +++ b/hgext/mq.py Mon Nov 16 11:31:08 2009 -0800 @@ -2550,7 +2550,7 @@ repo.__class__ = mqrepo def mqimport(orig, ui, repo, *args, **kwargs): - if hasattr(repo, 'abort_if_wdir_patched'): + if hasattr(repo, 'abort_if_wdir_patched') and not kwargs.get('no_commit', False): repo.abort_if_wdir_patched(_('cannot import over an applied patch'), kwargs.get('force')) return orig(ui, repo, *args, **kwargs) diff -r 0262bb59016f -r 81f1462ef2c7 tests/test-mq --- a/tests/test-mq Mon Nov 16 13:35:36 2009 +0100 +++ b/tests/test-mq Mon Nov 16 11:31:08 2009 -0800 @@ -175,6 +175,10 @@ hg revert --no-backup ../a hg import ../../import.diff hg st +echo % import --no-commit should succeed +hg import --no-commit ../../import.diff +hg st +hg revert --no-backup ../a echo % qunapplied hg qunapplied diff -r 0262bb59016f -r 81f1462ef2c7 tests/test-mq.out --- a/tests/test-mq.out Mon Nov 16 13:35:36 2009 +0100 +++ b/tests/test-mq.out Mon Nov 16 11:31:08 2009 -0800 @@ -154,6 +154,9 @@ abort: source has mq patches applied % import should fail abort: cannot import over an applied patch +% import --no-commit should succeed +applying ../../import.diff +M a % qunapplied test2.patch % qpush/qpop with index