Mercurial > hg-stable
changeset 39926:99f0f052b6bf
obsolete: preindent code in createmarkers
This will help to make the next change clearer.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 26 Sep 2018 21:03:09 +0200 |
parents | bae6f1418a95 |
children | 6335c0de80fa |
files | mercurial/obsolete.py |
diffstat | 1 files changed, 28 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsolete.py Wed Sep 26 23:37:43 2018 +0200 +++ b/mercurial/obsolete.py Wed Sep 26 21:03:09 2018 +0200 @@ -994,36 +994,37 @@ 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