Patchwork [09,of,13] obsolete: explicitly pass relation items to effectflag computation

login
register
mail settings
Submitter Boris Feld
Date Sept. 27, 2018, 5:08 p.m.
Message ID <febc3b2c06888c019bb3.1538068121@localhost.localdomain>
Download mbox | patch
Permalink /patch/35148/
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 1537997863 -7200
#      Wed Sep 26 23:37:43 2018 +0200
# Node ID febc3b2c06888c019bb3aaeab33cb9e0ec8d58f4
# Parent  95659bcaa0dc2eea9fd50da4f249b9869e36392f
# EXP-Topic trackfold
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r febc3b2c0688
obsolete: explicitly pass relation items to effectflag computation

To track folds, we are about to change the content of `rel`. To simplify this
change, we update the `geteffectflag` function beforehand.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -1016,7 +1016,7 @@  def createmarkers(repo, relations, flag=
             if saveeffectflag:
                 # The effect flag is saved in a versioned field name for future
                 # evolution
-                effectflag = obsutil.geteffectflag(rel)
+                effectflag = obsutil.geteffectflag(prec, sucs)
                 localmetadata[obsutil.EFFECTFLAGFIELD] = "%d" % effectflag
 
             # Creating the marker causes the hidden cache to become invalid,
diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -413,15 +413,13 @@  def _cmpdiff(leftctx, rightctx):
             return False
     return True
 
-def geteffectflag(relation):
+def geteffectflag(source, successors):
     """ From an obs-marker relation, compute what changed between the
     predecessor and the successor.
     """
     effects = 0
 
-    source = relation[0]
-
-    for changectx in relation[1]:
+    for changectx in successors:
         # Check if description has changed
         if changectx.description() != source.description():
             effects |= DESCCHANGED