Patchwork [3,of,5] copies: expand `_chain` variable name to make the function easier to read

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 2, 2019, 11:28 a.m.
Message ID <aecdfe3c798f29670f34.1575286098@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/43557/
State Accepted
Headers show

Comments

Pierre-Yves David - Dec. 2, 2019, 11:28 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1573674128 -3600
#      Wed Nov 13 20:42:08 2019 +0100
# Node ID aecdfe3c798f29670f341d88c7a4b7e2289500e9
# Parent  2671000fb23f978fbacb56cd168d4a5f529c0b59
# EXP-Topic patch-copies-rust-prep
# Available At https://dev.heptapod.net/octobus/mercurial-devel/
#              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r aecdfe3c798f
copies: expand `_chain` variable name to make the function easier to read

This came up while explaining what the function is about. I find the function
easier to follow that way.

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -63,12 +63,12 @@  def _filter(src, dst, t):
             del t[k]
 
 
-def _chain(a, b):
-    """chain two sets of copies 'a' and 'b'"""
-    t = a.copy()
-    for k, v in pycompat.iteritems(b):
-        t[k] = a.get(v, v)
-    return t
+def _chain(prefix, suffix):
+    """chain two sets of copies 'prefix' and 'suffix'"""
+    result = prefix.copy()
+    for key, value in pycompat.iteritems(suffix):
+        result[key] = prefix.get(value, value)
+    return result
 
 
 def _tracefile(fctx, am, basemf):