copies: add config option for writing copy metadata to file and/or changset
This introduces a config option that lets you choose to write copy
metadata to the changeset extras instead of to filelog. There's also
an option to write it to both places. I imagine that may possibly be
useful when transitioning an existing repo.
The copy metadata is stored as two fields in extras: one for copies
since p1 and one for copies since p2.
I may need to add more information later in order to make copy tracing
faster. Specifically, I'm thinking out recording which files were
added or removed so that copies._chaincopies() doesn't have to look at
the manifest for that. But that would just be an optimization and that
can be added once we know if it's necessary.
I have also considered saving space by using replacing the destination
file path by an index into the "files" list, but that can also be
changed later (but before the feature is ready to release).
Differential Revision: https://phab.mercurial-scm.org/D6183
Checking how hg behaves when one side of a pull/push doesn't support
some capability (because it's running an older hg version, usually).
$ hg init repo1
$ cd repo1
$ echo a > a; hg add -q a; hg commit -q -m a
$ hg bookmark a
$ hg clone -q . ../repo2
$ cd ../repo2
$ touch $TESTTMP/disable-lookup.py
$ disable_cap() {
> rm -f $TESTTMP/disable-lookup.pyc # pyc caching is buggy
> cat <<EOF > $TESTTMP/disable-lookup.py
> from mercurial import extensions, wireprotov1server
> def wcapabilities(orig, *args, **kwargs):
> cap = orig(*args, **kwargs)
> cap.remove(b'$1')
> return cap
> extensions.wrapfunction(wireprotov1server, '_capabilities', wcapabilities)
> EOF
> }
$ cat >> ../repo1/.hg/hgrc <<EOF
> [extensions]
> disable-lookup = $TESTTMP/disable-lookup.py
> EOF
$ cat >> .hg/hgrc <<EOF
> [ui]
> ssh = "$PYTHON" "$TESTDIR/dummyssh"
> EOF
$ hg pull ssh://user@dummy/repo1 -r tip -B a
pulling from ssh://user@dummy/repo1
no changes found
$ disable_cap lookup
$ hg pull ssh://user@dummy/repo1 -r tip -B a
pulling from ssh://user@dummy/repo1
abort: other repository doesn't support revision lookup, so a rev cannot be specified.
[255]
$ disable_cap pushkey
$ hg pull ssh://user@dummy/repo1 -r tip -B a
pulling from ssh://user@dummy/repo1
abort: remote bookmark a not found!
[255]