comparison mercurial/copies.py @ 44091:3df0bd706c40

graftcopies: use _filter() for filtering out invalid copies `graftcopies()` (formerly called `duplicatecopies()`) checked that the copy destination existed in the working copy, but it didn't check that copy source existed in the parent of the working copy. In `test-graft.t` we can see that as warnings about not finding ancestors of the copied files, and also empty commits getting created. This patch uses the existing `_filter()` function for filtering out invalid copies. In addition to the aforementioned types, that also includes copies where source and destination is the same. Differential Revision: https://phab.mercurial-scm.org/D7859
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 27 Dec 2019 15:14:19 -0800
parents 2f0a44c69e07
children 833210fbd900
comparison
equal deleted inserted replaced
44090:2f0a44c69e07 44091:3df0bd706c40
873 # copytrace='off' skips this line, but not the entire function because 873 # copytrace='off' skips this line, but not the entire function because
874 # the line below is O(size of the repo) during a rebase, while the rest 874 # the line below is O(size of the repo) during a rebase, while the rest
875 # of the function is much faster (and is required for carrying copy 875 # of the function is much faster (and is required for carrying copy
876 # metadata across the rebase anyway). 876 # metadata across the rebase anyway).
877 exclude = pathcopies(base, skip) 877 exclude = pathcopies(base, skip)
878 for dst, src in pycompat.iteritems(pathcopies(base, ctx)): 878 new_copies = pathcopies(base, ctx)
879 _filter(wctx.p1(), wctx, new_copies)
880 for dst, src in pycompat.iteritems(new_copies):
879 if dst in exclude: 881 if dst in exclude:
880 continue 882 continue
881 if dst in wctx: 883 wctx[dst].markcopied(src)
882 wctx[dst].markcopied(src)
883 884
884 885
885 def computechangesetfilesadded(ctx): 886 def computechangesetfilesadded(ctx):
886 """return the list of files added in a changeset 887 """return the list of files added in a changeset
887 """ 888 """