changeset 44164:45192589555c

copies: extract function for finding directory renames The directory rename code is logically quite isolated, so it makes sense to make it physically isolated as well. Differential Revision: https://phab.mercurial-scm.org/D7977
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 22 Jan 2020 13:06:56 -0800
parents 782e0d9c3b74
children ae9310709c13
files mercurial/copies.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Wed Jan 22 15:23:30 2020 -0800
+++ b/mercurial/copies.py	Wed Jan 22 13:06:56 2020 -0800
@@ -657,6 +657,12 @@
 
     repo.ui.debug(b"  checking for directory renames\n")
 
+    dirmove, movewithdir = _dir_renames(repo, c1, c2, copy, fullcopy, u1, u2)
+
+    return copy, movewithdir, diverge, renamedelete, dirmove
+
+
+def _dir_renames(repo, c1, c2, copy, fullcopy, u1, u2):
     # generate a directory move map
     d1, d2 = c1.dirs(), c2.dirs()
     invalid = set()
@@ -688,7 +694,7 @@
     del d1, d2, invalid
 
     if not dirmove:
-        return copy, {}, diverge, renamedelete, {}
+        return {}, {}
 
     dirmove = {k + b"/": v + b"/" for k, v in pycompat.iteritems(dirmove)}
 
@@ -713,7 +719,7 @@
                         )
                     break
 
-    return copy, movewithdir, diverge, renamedelete, dirmove
+    return dirmove, movewithdir
 
 
 def _heuristicscopytracing(repo, c1, c2, base):