Patchwork D4123: resolve: organize 'if confirm' conditionals

login
register
mail settings
Submitter phabricator
Date Aug. 6, 2018, 1:13 p.m.
Message ID <184d25b14433ef877c716bb2d8b163c8@localhost.localdomain>
Download mbox | patch
Permalink /patch/33320/
State Not Applicable
Headers show

Comments

phabricator - Aug. 6, 2018, 1:13 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG49b51f41fb46: resolve: organize &#039;if confirm&#039; conditionals (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4123?vs=9940&id=9976

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4534,27 +4534,27 @@ 
     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:
         raise error.Abort(_("can't specify --all and patterns"))
     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 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')