Patchwork D1093: scmutil: add capability to cleanupnodes to take obsmarker metadata

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2017, 2:28 p.m.
Message ID <differential-rev-PHID-DREV-ablprpdp4rby5djm242b-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24950/
State Superseded
Headers show

Comments

phabricator - Oct. 15, 2017, 2:28 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds a metadata argument to cleanupnodes() which will be dict and can
  be passed to obsmarker.createmarkers() and can be stored on the obsmarker.
  In cases when obsolescence is not enabled, the metadata argument is useless.
  
  This is a step towards storing a note in amend.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -613,7 +613,7 @@ 
     def __contains__(self, node):
         return self._revcontains(self._torev(node))
 
-def cleanupnodes(repo, replacements, operation, moves=None):
+def cleanupnodes(repo, replacements, operation, moves=None, metadata=None):
     """do common cleanups when old nodes are replaced by new nodes
 
     That includes writing obsmarkers or stripping nodes, and moving bookmarks.
@@ -625,6 +625,9 @@ 
 
     replacements is {oldnode: [newnode]} or a iterable of nodes if they do not
     have replacements. operation is a string, like "rebase".
+
+    metadata is dictionary containing metadata to be stored in obsmarker if
+    obsolescence is enabled.
     """
     if not replacements and not moves:
         return
@@ -695,7 +698,8 @@ 
                     for n, s in sorted(replacements.items(), key=sortfunc)
                     if s or not isobs(n)]
             if rels:
-                obsolete.createmarkers(repo, rels, operation=operation)
+                obsolete.createmarkers(repo, rels, operation=operation,
+                                       metadata=metadata)
         else:
             from . import repair # avoid import cycle
             tostrip = list(replacements)