changeset 38916:49b51f41fb46

resolve: organize 'if confirm' conditionals Differential Revision: https://phab.mercurial-scm.org/D4123
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Mon, 06 Aug 2018 10:03:57 +0530
parents fff675dfb80b
children 5111d11b8719
files mercurial/commands.py
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed May 16 15:14:37 2018 -0700
+++ b/mercurial/commands.py	Mon Aug 06 10:03:57 2018 +0530
@@ -4534,11 +4534,6 @@
     all, mark, unmark, show, nostatus = \
         [opts.get(o) for o in flaglist]
 
-    if all and confirm:
-        if ui.promptchoice(_(b're-merge all unresolved files (yn)?'
-                             b'$$ &Yes $$ &No')):
-            raise error.Abort(_('user quit'))
-
     if (show and (mark or unmark)) or (mark and unmark):
         raise error.Abort(_("too many options specified"))
     if pats and all:
@@ -4547,14 +4542,19 @@
         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 unmark and confirm and not pats:
-        if ui.promptchoice(_(b'mark all resolved files as unresolved (yn)?'
-                             b'$$ &Yes $$ &No')):
-            raise error.Abort(_('user quit'))
+    if confirm:
+        if all:
+            if ui.promptchoice(_(b're-merge all unresolved files (yn)?'
+                                 b'$$ &Yes $$ &No')):
+                raise error.Abort(_('user quit'))
+        if mark and not pats:
+            if ui.promptchoice(_(b'mark all unresolved files as resolved (yn)?'
+                                 b'$$ &Yes $$ &No')):
+                raise error.Abort(_('user quit'))
+        if unmark and not pats:
+            if ui.promptchoice(_(b'mark all resolved files as unresolved (yn)?'
+                                 b'$$ &Yes $$ &No')):
+                raise error.Abort(_('user quit'))
 
     if show:
         ui.pager('resolve')