resolve: when resolve.mark-check=abort, downgrade to warning if pats specified stable
authorKyle Lippincott <spectral@google.com>
Fri, 02 Nov 2018 11:57:45 -0700
branchstable
changeset 40472 da2e874fe582
parent 40459 5eaa5eb0db4e
child 40473 8239d4e5d05f
resolve: when resolve.mark-check=abort, downgrade to warning if pats specified Previously, with --config resolve.mark-check=abort, running `hg resolve -m foo` would abort and emit a message saying to use --all. This command does not work, though: `hg resolve -m foo --all`, and it's really weird for --all to be the "--force" flag. My original goal with the option was to make it so that `hg resolve -m` (no filename arguments) was safer, which is why --all is used; in my mind, `hg resolve -m foo` should always mark it as resolved, and `--all` is how you specify "all the files", so that's why I chose `hg resolve -m --all` as the way out of `hg resolve -m` aborting. This commit makes all of this work the way it was meant to in my head :) Differential Revision: https://phab.mercurial-scm.org/D5218
mercurial/commands.py
tests/test-resolve.t
--- a/mercurial/commands.py	Fri Nov 02 14:18:29 2018 -0400
+++ b/mercurial/commands.py	Fri Nov 02 11:57:45 2018 -0700
@@ -4912,7 +4912,7 @@
         if hasconflictmarkers:
             ui.warn(_('warning: the following files still have conflict '
                       'markers:\n  ') + '\n  '.join(hasconflictmarkers) + '\n')
-            if markcheck == 'abort' and not all:
+            if markcheck == 'abort' and not all and not pats:
                 raise error.Abort(_('conflict markers detected'),
                                   hint=_('use --all to mark anyway'))
 
--- a/tests/test-resolve.t	Fri Nov 02 14:18:29 2018 -0400
+++ b/tests/test-resolve.t	Fri Nov 02 11:57:45 2018 -0700
@@ -445,6 +445,19 @@
   $ hg resolve -l
   R file1
   R file2
+Test with marking an explicit file as resolved, this should not abort (since
+there's no --force flag, we have no way of combining --all with a filename)
+  $ hg resolve --unmark
+  $ hg resolve -l
+  U file1
+  U file2
+(This downgrades to a warning since an explicit file was specified).
+  $ hg --config commands.resolve.mark-check=abort resolve -m file2
+  warning: the following files still have conflict markers:
+    file2
+  $ hg resolve -l
+  U file1
+  R file2
 Testing the --re-merge flag
   $ hg resolve --unmark file1
   $ hg resolve -l