comparison mercurial/copies.py @ 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 6ca9f45b32b0
comparison
equal deleted inserted replaced
44163:782e0d9c3b74 44164:45192589555c
655 del renamedeleteset 655 del renamedeleteset
656 del divergeset 656 del divergeset
657 657
658 repo.ui.debug(b" checking for directory renames\n") 658 repo.ui.debug(b" checking for directory renames\n")
659 659
660 dirmove, movewithdir = _dir_renames(repo, c1, c2, copy, fullcopy, u1, u2)
661
662 return copy, movewithdir, diverge, renamedelete, dirmove
663
664
665 def _dir_renames(repo, c1, c2, copy, fullcopy, u1, u2):
660 # generate a directory move map 666 # generate a directory move map
661 d1, d2 = c1.dirs(), c2.dirs() 667 d1, d2 = c1.dirs(), c2.dirs()
662 invalid = set() 668 invalid = set()
663 dirmove = {} 669 dirmove = {}
664 670
686 if i in dirmove: 692 if i in dirmove:
687 del dirmove[i] 693 del dirmove[i]
688 del d1, d2, invalid 694 del d1, d2, invalid
689 695
690 if not dirmove: 696 if not dirmove:
691 return copy, {}, diverge, renamedelete, {} 697 return {}, {}
692 698
693 dirmove = {k + b"/": v + b"/" for k, v in pycompat.iteritems(dirmove)} 699 dirmove = {k + b"/": v + b"/" for k, v in pycompat.iteritems(dirmove)}
694 700
695 for d in dirmove: 701 for d in dirmove:
696 repo.ui.debug( 702 repo.ui.debug(
711 b" pending file src: '%s' -> dst: '%s'\n" 717 b" pending file src: '%s' -> dst: '%s'\n"
712 % (f, df) 718 % (f, df)
713 ) 719 )
714 break 720 break
715 721
716 return copy, movewithdir, diverge, renamedelete, dirmove 722 return dirmove, movewithdir
717 723
718 724
719 def _heuristicscopytracing(repo, c1, c2, base): 725 def _heuristicscopytracing(repo, c1, c2, base):
720 """ Fast copytracing using filename heuristics 726 """ Fast copytracing using filename heuristics
721 727