Patchwork D9089: changing-files: add a utility to compute the merged files post-commit

login
register
mail settings
Submitter phabricator
Date Sept. 26, 2020, 12:10 p.m.
Message ID <differential-rev-PHID-DREV-ubmbc4i3xwvcjynb465k-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47291/
State Superseded
Headers show

Comments

phabricator - Sept. 26, 2020, 12:10 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We will need it in `_getsidedata` as soon as we start persisting that set.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/metadata.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/metadata.py b/mercurial/metadata.py
--- a/mercurial/metadata.py
+++ b/mercurial/metadata.py
@@ -265,6 +265,21 @@ 
     return removed
 
 
+def computechangesetfilesmerged(ctx):
+    """return the list of files merged in a changeset
+    """
+    merged = []
+    if len(ctx.parents()) < 2:
+        return merged
+    for f in ctx.files():
+        if f in ctx:
+            fctx = ctx[f]
+            parents = fctx._filelog.parents(fctx._filenode)
+            if parents[1] != node.nullid:
+                merged.append(f)
+    return merged
+
+
 def computechangesetcopies(ctx):
     """return the copies data for a changeset