Patchwork D533: effectflag: store an empty effect flag for the moment

login
register
mail settings
Submitter phabricator
Date Sept. 27, 2017, 8:07 a.m.
Message ID <91ce70c5484cf145c73fd616cc6d0fa0@localhost.localdomain>
Download mbox | patch
Permalink /patch/24169/
State Not Applicable
Headers show

Comments

phabricator - Sept. 27, 2017, 8:07 a.m.
lothiraldan updated this revision to Diff 2104.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D533?vs=1337&id=2104

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

AFFECTED FILES
  mercurial/obsolete.py
  mercurial/obsutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -305,6 +305,19 @@ 
             foreground = set(repo.set('%ln::', known))
     return set(c.node() for c in foreground)
 
+# logic around storing and using effect flags
+EFFECTFLAGFIELD = "ef1"
+
+def geteffectflag(relation):
+    """ From an obs-marker relation, compute what changed between the
+    predecessor and the successor.
+    """
+    effects = 0
+
+    source = relation[0]
+
+    return effects
+
 def getobsoleted(repo, tr):
     """return the set of pre-existing revisions obsoleted by a transaction"""
     torev = repo.unfiltered().changelog.nodemap.get
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -1036,6 +1036,11 @@ 
     if useoperation and operation:
         metadata['operation'] = operation
 
+    # Effect flag metadata handling
+    saveeffectflag = repo.ui.configbool('experimental',
+                                        'effect-flags',
+                                        False)
+
     tr = repo.transaction('add-obsolescence-marker')
     try:
         markerargs = []
@@ -1059,6 +1064,13 @@ 
                 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(rel)
+                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