changeset 21262:edac098e6a55

resolve: use early continue and deindent
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 18 Apr 2014 18:19:46 -0700
parents 6ca05c46aa95
children f3e37409ecd3
files mercurial/commands.py
diffstat 1 files changed, 32 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu May 08 16:48:28 2014 -0700
+++ b/mercurial/commands.py	Fri Apr 18 18:19:46 2014 -0700
@@ -4931,37 +4931,39 @@
     ret = 0
 
     for f in ms:
-        if m(f):
-            if show:
-                if nostatus:
-                    ui.write("%s\n" % f)
-                else:
-                    ui.write("%s %s\n" % (ms[f].upper(), f),
-                             label='resolve.' +
-                             {'u': 'unresolved', 'r': 'resolved'}[ms[f]])
-            elif mark:
-                ms.mark(f, "r")
-            elif unmark:
-                ms.mark(f, "u")
+        if not m(f):
+            continue
+
+        if show:
+            if nostatus:
+                ui.write("%s\n" % f)
             else:
-                wctx = repo[None]
-
-                # backup pre-resolve (merge uses .orig for its own purposes)
-                a = repo.wjoin(f)
-                util.copyfile(a, a + ".resolve")
-
-                try:
-                    # resolve file
-                    ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
-                                 'resolve')
-                    if ms.resolve(f, wctx):
-                        ret = 1
-                finally:
-                    ui.setconfig('ui', 'forcemerge', '', 'resolve')
-                    ms.commit()
-
-                # replace filemerge's .orig file with our resolve file
-                util.rename(a + ".resolve", a + ".orig")
+                ui.write("%s %s\n" % (ms[f].upper(), f),
+                         label='resolve.' +
+                         {'u': 'unresolved', 'r': 'resolved'}[ms[f]])
+        elif mark:
+            ms.mark(f, "r")
+        elif unmark:
+            ms.mark(f, "u")
+        else:
+            wctx = repo[None]
+
+            # backup pre-resolve (merge uses .orig for its own purposes)
+            a = repo.wjoin(f)
+            util.copyfile(a, a + ".resolve")
+
+            try:
+                # resolve file
+                ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
+                             'resolve')
+                if ms.resolve(f, wctx):
+                    ret = 1
+            finally:
+                ui.setconfig('ui', 'forcemerge', '', 'resolve')
+                ms.commit()
+
+            # replace filemerge's .orig file with our resolve file
+            util.rename(a + ".resolve", a + ".orig")
 
     ms.commit()
     return ret