Patchwork [12,of,15] commitctx: move ChangingFiles creation directly inside `_process_files`

login
register
mail settings
Submitter Pierre-Yves David
Date July 29, 2020, 4:57 p.m.
Message ID <3a8c3c3dcf9dbe0c8c15.1596041862@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/46925/
State Accepted
Headers show

Comments

Pierre-Yves David - July 29, 2020, 4:57 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1595687642 -7200
#      Sat Jul 25 16:34:02 2020 +0200
# Node ID 3a8c3c3dcf9dbe0c8c154048ff57ca68193eb9c9
# Parent  3bcb3b9adf1f0b5eb0ab6b4964b756162cc269b5
# EXP-Topic files-change
# Available At https://foss.heptapod.net/octobus/mercurial-devel/
#              hg pull https://foss.heptapod.net/octobus/mercurial-devel/ -r 3a8c3c3dcf9d
commitctx: move ChangingFiles creation directly inside `_process_files`

As announced, we move it there. We focus on the signature change first, we will
update the code afterward.

Patch

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -129,13 +129,7 @@  def _prepare_files(tr, ctx, error=False,
         mn = p1.manifestnode()
         files = metadata.ChangingFiles()
     else:
-        mn, touched, added, removed = _process_files(tr, ctx, error=error)
-        files = metadata.ChangingFiles()
-        files.update_touched(touched)
-        if added:
-            files.update_added(added)
-        if removed:
-            files.update_removed(removed)
+        mn, files = _process_files(tr, ctx, error=error)
 
     if origctx and origctx.manifestnode() == mn:
         origfiles = origctx.files()
@@ -211,7 +205,11 @@  def _process_files(tr, ctx, error=False)
     files = touched
     mn = _commit_manifest(tr, linkrev, ctx, mctx, m, files, added, drop)
 
-    return mn, files, filesadded, removed
+    files = metadata.ChangingFiles(
+        touched=files, added=filesadded, removed=removed
+    )
+
+    return mn, files
 
 
 def _filecommit(