changeset 42711:53c07f08fea1

changectx: extract explicit computechangesetfilesremoved method from context Right now, the logic around changeset centric removed files data are buried into the "changectx" code. We extract this code in a dedicated method (in the scmutil module) for clarity. This clarity will help to explicitly compute and caches these data in the future.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 12 Jun 2019 13:42:52 +0100
parents 87c4cd89b539
children cdf0e9523de1
files mercurial/context.py mercurial/scmutil.py
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Wed Jun 12 13:42:22 2019 +0100
+++ b/mercurial/context.py	Wed Jun 12 13:42:52 2019 +0100
@@ -466,12 +466,7 @@
             (source == 'compatibility' and
              self._changeset.filesremoved is not None)):
             return self._changeset.filesremoved or []
-
-        removed = []
-        for f in self.files():
-            if f not in self:
-                removed.append(f)
-        return removed
+        return scmutil.computechangesetfilesremoved(self)
 
     @propertycache
     def _copies(self):
--- a/mercurial/scmutil.py	Wed Jun 12 13:42:22 2019 +0100
+++ b/mercurial/scmutil.py	Wed Jun 12 13:42:52 2019 +0100
@@ -1993,3 +1993,12 @@
         if not any(f in p for p in ctx.parents()):
             added.append(f)
     return added
+
+def computechangesetfilesremoved(ctx):
+    """return the list of files removed in a changeset
+    """
+    removed = []
+    for f in ctx.files():
+        if f not in ctx:
+            removed.append(f)
+    return removed