diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -17,6 +17,7 @@ match as matchmod, node, pathutil, + policy, pycompat, util, ) @@ -26,6 +27,8 @@ from .revlogutils import flagutil +rustmod = policy.importrust("copy_tracing") + def _filter(src, dst, t): """filters out invalid copies after chaining""" @@ -310,8 +313,15 @@ It returns the aggregated copies information for `targetrev`. """ + + alwaysmatch = match.always() + + if rustmod is not None and alwaysmatch: + return rustmod.combine_changeset_copies( + list(revs), children, targetrev, revinfo, isancestor + ) + all_copies = {} - alwaysmatch = match.always() for r in revs: copies = all_copies.pop(r, None) if copies is None: @@ -702,7 +712,7 @@ def _isfullcopytraceable(repo, c1, base): - """ Checks that if base, source and destination are all no-public branches, + """Checks that if base, source and destination are all no-public branches, if yes let's use the full copytrace algorithm for increased capabilities since it will be fast enough. @@ -777,7 +787,7 @@ def _fullcopytracing(repo, c1, c2, base): - """ The full copytracing algorithm which finds all the new files that were + """The full copytracing algorithm which finds all the new files that were added from merge base up to the top commit and for each file it checks if this file was copied from another file. @@ -967,7 +977,7 @@ def _heuristicscopytracing(repo, c1, c2, base): - """ Fast copytracing using filename heuristics + """Fast copytracing using filename heuristics Assumes that moves or renames are of following two types: