Patchwork [10,of,13] obsolete: preindent code in createmarkers

login
register
mail settings
Submitter Boris Feld
Date Sept. 27, 2018, 5:08 p.m.
Message ID <b3bd71652d1258de723a.1538068122@localhost.localdomain>
Download mbox | patch
Permalink /patch/35149/
State Accepted
Headers show

Comments

Boris Feld - Sept. 27, 2018, 5:08 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1537988589 -7200
#      Wed Sep 26 21:03:09 2018 +0200
# Node ID b3bd71652d1258de723a667a6f1210a27b86b019
# Parent  febc3b2c06888c019bb3aaeab33cb9e0ec8d58f4
# EXP-Topic trackfold
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b3bd71652d12
obsolete: preindent code in createmarkers

This will help to make the next change clearer.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -994,36 +994,37 @@  def createmarkers(repo, relations, flag=
         markerargs = []
         for rel in relations:
             prec = rel[0]
-            sucs = rel[1]
-            localmetadata = metadata.copy()
-            if 2 < len(rel):
-                localmetadata.update(rel[2])
+            if True:
+                sucs = rel[1]
+                localmetadata = metadata.copy()
+                if 2 < len(rel):
+                    localmetadata.update(rel[2])
 
-            if not prec.mutable():
-                raise error.Abort(_("cannot obsolete public changeset: %s")
-                                 % prec,
-                                 hint="see 'hg help phases' for details")
-            nprec = prec.node()
-            nsucs = tuple(s.node() for s in sucs)
-            npare = None
-            if not nsucs:
-                npare = tuple(p.node() for p in prec.parents())
-            if nprec in nsucs:
-                raise error.Abort(_("changeset %s cannot obsolete itself")
-                                  % prec)
+                if not prec.mutable():
+                    raise error.Abort(_("cannot obsolete public changeset: %s")
+                                     % prec,
+                                     hint="see 'hg help phases' for details")
+                nprec = prec.node()
+                nsucs = tuple(s.node() for s in sucs)
+                npare = None
+                if not nsucs:
+                    npare = tuple(p.node() for p in prec.parents())
+                if nprec in nsucs:
+                    raise error.Abort(_("changeset %s cannot obsolete itself")
+                                      % prec)
 
-            # Effect flag can be different by relation
-            if saveeffectflag:
-                # The effect flag is saved in a versioned field name for future
-                # evolution
-                effectflag = obsutil.geteffectflag(prec, sucs)
-                localmetadata[obsutil.EFFECTFLAGFIELD] = "%d" % effectflag
+                # Effect flag can be different by relation
+                if saveeffectflag:
+                    # The effect flag is saved in a versioned field name for
+                    # future evolution
+                    effectflag = obsutil.geteffectflag(prec, sucs)
+                    localmetadata[obsutil.EFFECTFLAGFIELD] = "%d" % effectflag
 
-            # Creating the marker causes the hidden cache to become invalid,
-            # which causes recomputation when we ask for prec.parents() above.
-            # Resulting in n^2 behavior.  So let's prepare all of the args
-            # first, then create the markers.
-            markerargs.append((nprec, nsucs, npare, localmetadata))
+                # Creating the marker causes the hidden cache to become
+                # invalid, which causes recomputation when we ask for
+                # prec.parents() above.  Resulting in n^2 behavior.  So let's
+                # prepare all of the args first, then create the markers.
+                markerargs.append((nprec, nsucs, npare, localmetadata))
 
         for args in markerargs:
             nprec, nsucs, npare, localmetadata = args