changeset 45616:ddcee0b0fd67

changing-files: add a utility to compute the merged files post-commit We will need it in `_getsidedata` as soon as we start persisting that set. Differential Revision: https://phab.mercurial-scm.org/D9089
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 25 Sep 2020 11:29:19 +0200
parents 094a91a183f1
children 7bd13bf99d1c
files mercurial/metadata.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/metadata.py	Fri Sep 25 02:01:32 2020 +0200
+++ b/mercurial/metadata.py	Fri Sep 25 11:29:19 2020 +0200
@@ -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