changeset 45663:cf474af69766

changing-files: split the changing files computation from encoding The side data encoding is already in its own function, now we move the changing files computation in it own function, it will receive more updates in the coming changesets. Differential Revision: https://phab.mercurial-scm.org/D9123
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 29 Sep 2020 22:19:46 +0200
parents 64a4b85c4a00
children 8cebc4c13978
files mercurial/metadata.py
diffstat 1 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/metadata.py	Mon Sep 14 23:47:42 2020 +0200
+++ b/mercurial/metadata.py	Tue Sep 29 22:19:46 2020 +0200
@@ -224,6 +224,22 @@
             self.mark_copied_from_p2(source, dest)
 
 
+def compute_all_files_changes(ctx):
+    """compute the files changed by a revision"""
+    filescopies = computechangesetcopies(ctx)
+    filesadded = computechangesetfilesadded(ctx)
+    filesremoved = computechangesetfilesremoved(ctx)
+    filesmerged = computechangesetfilesmerged(ctx)
+    files = ChangingFiles()
+    files.update_touched(ctx.files())
+    files.update_added(filesadded)
+    files.update_removed(filesremoved)
+    files.update_merged(filesmerged)
+    files.update_copies_from_p1(filescopies[0])
+    files.update_copies_from_p2(filescopies[1])
+    return files
+
+
 def computechangesetfilesadded(ctx):
     """return the list of files added in a changeset
     """
@@ -508,17 +524,7 @@
 
 def _getsidedata(srcrepo, rev):
     ctx = srcrepo[rev]
-    filescopies = computechangesetcopies(ctx)
-    filesadded = computechangesetfilesadded(ctx)
-    filesremoved = computechangesetfilesremoved(ctx)
-    filesmerged = computechangesetfilesmerged(ctx)
-    files = ChangingFiles()
-    files.update_touched(ctx.files())
-    files.update_added(filesadded)
-    files.update_removed(filesremoved)
-    files.update_merged(filesmerged)
-    files.update_copies_from_p1(filescopies[0])
-    files.update_copies_from_p2(filescopies[1])
+    files = compute_all_files_changes(ctx)
     return encode_files_sidedata(files)