context: introduce p[12]copies() methods and debugp[12]copies commands
As mentioned earlier, I'm working on support for storing copy metadata
in the changeset instead of in the filelog.
In order to transition a repo from storing metadata in filelogs to
storing it in the changeset, I'm going to provide a config option for
reading the metadata from the changeset, but falling back to getting
it from the filelog if it's not in the changeset. In this compatiblity
mode, the changeset-optmized algorithms will be used. We will then
need to convert the filelog copy metadata to look like that provided
by changeset copy metadata. This patch introduces methods that do just
that.
By having these methods here, we can start writing changeset-optimized
algorithms that should work already before we add any support for
storing the metadata in the changesets.
This commit also includes new debugp[12]copies commands and exercises
them in test-copies.t.
Differential Revision: https://phab.mercurial-scm.org/D5990
#!/bin/sh
#
# Use this script to generate branches.svndump
#
mkdir temp
cd temp
mkdir project-orig
cd project-orig
mkdir trunk
mkdir branches
cd ..
svnadmin create svn-repo
svnurl=file://`pwd`/svn-repo
svn import project-orig $svnurl -m "init projA"
svn co $svnurl project
cd project
echo a > trunk/a
echo b > trunk/b
echo c > trunk/c
mkdir trunk/dir
echo e > trunk/dir/e
# Add a file within branches, used to confuse branch detection
echo d > branches/notinbranch
svn add trunk/a trunk/b trunk/c trunk/dir branches/notinbranch
svn ci -m hello
svn up
# Branch to old
svn copy trunk branches/old
svn rm branches/old/c
svn rm branches/old/dir
svn ci -m "branch trunk, remove c and dir"
svn up
# Update trunk
echo a >> trunk/a
svn ci -m "change a"
# Update old branch
echo b >> branches/old/b
svn ci -m "change b"
# Create a cross-branch revision
svn move trunk/b branches/old/c
echo c >> branches/old/c
svn ci -m "move and update c"
# Update old branch again
echo b >> branches/old/b
svn ci -m "change b again"
# Move back and forth between branch of similar names
# This used to generate fake copy records
svn up
svn move branches/old branches/old2
svn ci -m "move to old2"
svn move branches/old2 branches/old
svn ci -m "move back to old"
# Update trunk again
echo a > trunk/a
svn ci -m "last change to a"
# Branch again from a converted revision
svn copy -r 1 $svnurl/trunk branches/old3
svn ci -m "branch trunk@1 into old3"
cd ..
svnadmin dump svn-repo > ../branches.svndump