rebase: extract a variable for a repeated `repo[p1]`
I'll add another use site in the next patch.
Differential Revision: https://phab.mercurial-scm.org/D7896
graftcopies: document why the function is useful at all
Despite having spent a significant amount on time on the copy-tracing
code, I thought `graftcopies()` (formerly known as
`duplicatecopies()`) was needed to duplicate copies after calling
`merge.update()` to do a merge (as `merge.graft()` does), but it's
actually usually not needed; `merge.update()` takes care of most
copies. This patch documents what the function is for.
Differential Revision: https://phab.mercurial-scm.org/D7861
graftcopies: remove `skip` and `repo` arguments
The `skip` argument was added in
2ba6c9b4e0eb (rebase: fix bug that
caused transitive copy records to disappear (
issue4192), 2014-06-07)
in order to fix https://bz.mercurial-scm.org/show_bug.cgi?id=4192. I
ran tests at that commit without the `skiprev` argument and the only
difference I noticed was that `test-rebase-collapse.t` failed
differently, in the call that is now on line 501. Without the
`skiprev` argument, that call would end up creating another commit
because it tried to record an invalid copy. With the previous patch in
this series, such invalid copies are no longer recorded, so it seems
we don't need the `skip` argument anymore.
I also removed the `repo` argument since that also becomes unused with
the removal of the `skip` argument.
Differential Revision: https://phab.mercurial-scm.org/D7860
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