Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/copies.py Mon Jan 06 15:24:36 2020 -0800 +++ b/mercurial/copies.py Fri Dec 27 15:14:19 2019 -0800 @@ -875,11 +875,12 @@ # of the function is much faster (and is required for carrying copy # metadata across the rebase anyway). exclude = pathcopies(base, skip) - for dst, src in pycompat.iteritems(pathcopies(base, ctx)): + new_copies = pathcopies(base, ctx) + _filter(wctx.p1(), wctx, new_copies) + for dst, src in pycompat.iteritems(new_copies): if dst in exclude: continue - if dst in wctx: - wctx[dst].markcopied(src) + wctx[dst].markcopied(src) def computechangesetfilesadded(ctx):