copies: clarify the return of _merge_copies_dict
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 20 Nov 2020 11:22:28 +0100
changeset 45986 f9f8d8aa9a92
parent 45985 b6b7626d3e06
child 45987 d42809b6b10f
copies: clarify the return of _merge_copies_dict I misused that function twice in the past few days, so lets clarify the API. Differential Revision: https://phab.mercurial-scm.org/D9418
mercurial/copies.py
--- a/mercurial/copies.py	Fri Nov 20 10:38:46 2020 +0100
+++ b/mercurial/copies.py	Fri Nov 20 11:22:28 2020 +0100
@@ -383,8 +383,8 @@
                     minor, major = othercopies, newcopies
                 else:
                     minor, major = newcopies, othercopies
-                _merge_copies_dict(minor, major, isancestor, changes)
-                all_copies[c] = minor
+                copies = _merge_copies_dict(minor, major, isancestor, changes)
+                all_copies[c] = copies
 
     final_copies = {}
     for dest, (tt, source) in all_copies[targetrev].items():
@@ -403,6 +403,8 @@
 
     - `ismerged(path)`: callable return True if `path` have been merged in the
                         current revision,
+
+    return the resulting dict (in practice, the "minor" object, updated)
     """
     for dest, value in major.items():
         other = minor.get(dest)
@@ -436,6 +438,7 @@
                     minor[dest] = value
                 elif isancestor(other_tt, new_tt):
                     minor[dest] = value
+    return minor
 
 
 def _revinfo_getter_extra(repo):