copies: check if the file is in source commit

Summary: Check if the file is in source commit. Currently, dagcopytrace assume the source file is in the source commit

Reviewed By: sggutier

Differential Revision: D47056956

fbshipit-source-id: db4de51be66d26b01d239c0d6023b154578cddf8
This commit is contained in:
Zhaolong Zhu 2023-06-27 11:43:45 -07:00 committed by Facebook GitHub Bot
parent 3b78ae1e7e
commit 21ac2090f7
2 changed files with 7 additions and 2 deletions

View File

@ -929,8 +929,12 @@ def duplicatecopies(repo, wctx, rev, fromrev, skiprev=None):
"""
dagcopytrace = _get_dagcopytrace(repo, wctx, skiprev)
for dst, src in pycompat.iteritems(pathcopies(repo[fromrev], repo[rev])):
if dagcopytrace and dagcopytrace.trace_rename(
repo[skiprev].node(), repo[fromrev].node(), dst
if (
dagcopytrace
and dst in repo[skiprev]
and dagcopytrace.trace_rename(
repo[skiprev].node(), repo[fromrev].node(), dst
)
):
continue
wctx[dst].markcopied(src)

View File

@ -5,6 +5,7 @@ Test for the full copytracing algorithm
=======================================
$ eagerepo
$ setconfig copytrace.skipduplicatecopies=True
$ newclientrepo t