Patchwork D7977: copies: extract function for finding directory renames

login
register
mail settings
Submitter phabricator
Date Jan. 23, 2020, 6:44 a.m.
Message ID <differential-rev-PHID-DREV-l3tm5nj5s4epwmc5d3a3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44585/
State Superseded
Headers show

Comments

phabricator - Jan. 23, 2020, 6:44 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The directory rename code is logically quite isolated, so it makes
  sense to make it physically isolated as well.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -654,6 +654,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()
@@ -685,7 +691,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)}
 
@@ -710,7 +716,7 @@ 
                         )
                     break
 
-    return copy, movewithdir, diverge, renamedelete, dirmove
+    return dirmove, movewithdir
 
 
 def _heuristicscopytracing(repo, c1, c2, base):