Patchwork D9123: changing-files: split the changing files computation from encoding

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

Comments

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

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -225,6 +225,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
     """
@@ -512,17 +528,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)