D4101: resolve: support commands.resolve.confirm option with --mark flag

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Sat Aug 4 07:32:19 UTC 2018


khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now, commands.resolve.confirm config option also respect --mark; and
  confirm to mark all 'unresolved' files as 'resolved'.
  
  It will confirm only when you don't pass any pats i.e 'hg resolve -m',
  because when no file pats are passed then --mark's default functionality
  is to mark all unresolved files.
  And if user has given file pats then I think there is no need to confirm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4101

AFFECTED FILES
  mercurial/commands.py
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -509,6 +509,34 @@
   warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
   [1]
 
+Test that commands.resolve.confirm respect --mark option (only when no patterns args are given):
+===============================================================================================
+
+  $ hg resolve -m emp1
+  $ hg resolve -l
+  R emp1
+  U emp2
+  U emp3
+
+  $ hg resolve -m << EOF
+  > n
+  > EOF
+  mark all unresolved files as resolved (yn)? n
+  abort: user quit
+  [255]
+
+  $ hg resolve -m << EOF
+  > y
+  > EOF
+  mark all unresolved files as resolved (yn)? y
+  (no more unresolved files)
+  continue: hg rebase --continue
+  $ hg resolve -l
+  R emp1
+  R emp2
+  R emp3
+
   $ hg rebase --abort
   rebase aborted
   $ cd ..
+
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4546,6 +4546,10 @@
     if not (all or pats or show or mark or unmark):
         raise error.Abort(_('no files or directories specified'),
                          hint=('use --all to re-merge all unresolved files'))
+    if mark and confirm and not pats:
+        if ui.promptchoice(_(b'mark all unresolved files as resolved (yn)?'
+                             b'$$ &Yes $$ &No')):
+            raise error.Abort(_('user quit'))
 
     if show:
         ui.pager('resolve')



To: khanchi97, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list