prepush: rewrite most of the code from scratch
For servers with branchmap support, the algorithm now works as follows:
1. A list of branches in outgoing changesets is created.
2. Using the remote branchmap, a check for new branches is performed.
3. A map (from branch to head list) of locally known remote heads before
the push is created, and one which, after step 4, will contain the locally
known remote heads after the push.
4. The post-push head map is updated with the outgoing changesets, using the
branch cache update mechanism.
5. A check for new heads is performed, by comparing the length of the head list
before and after push, for each branch. If there are new heads, an error
depending on whether or not there are incoming changes on the branch,
is returned.
6. If the push is allowed, a warning is written if there are incoming changes
on any branches involved in the push.
For old servers, an algorithm similar to step 4-6 above is used to check for
new topological heads only.
Two bugs are also fixed:
1. Sometimes you would be allowed to push new branch heads without --force.
A test for this case was added.
2. You would get the "note: unsynced remote changes!" warning if there were any
incoming changesets, even if they were on unrelated branches.
# now tests that it works with trunk/tags layout, but no branches yet
% initial svn import
Adding projB/trunk
Adding projB/tags
Committed revision 1.
% update svn repository
Checked out revision 1.
A letter .txt
Adding letter .txt
Transmitting file data .
Committed revision 2.
Sending letter .txt
Transmitting file data .
Committed revision 3.
Committed revision 4.
Sending letter .txt
Transmitting file data .
Committed revision 5.
% convert to hg once
initializing destination B-hg repository
scanning source...
sorting...
converting...
3 init projB
2 hello
1 world
0 nice day
updating tags
% update svn repository again
A letter2.txt
Sending letter .txt
Adding letter2.txt
Transmitting file data ..
Committed revision 6.
Committed revision 7.
Sending letter2.txt
Transmitting file data .
Committed revision 8.
% test incremental conversion
scanning source...
sorting...
converting...
1 second letter
0 work in progress
updating tags
o 7 update tags files: .hgtags
|
o 6 work in progress files: letter2.txt
|
o 5 second letter files: letter .txt letter2.txt
|
o 4 update tags files: .hgtags
|
o 3 nice day files: letter .txt
|
o 2 world files: letter .txt
|
o 1 hello files: letter .txt
|
o 0 init projB files:
tip
v0.2
v0.1
% test filemap
initializing destination fmap repository
scanning source...
sorting...
converting...
5 init projB
4 hello
3 world
2 nice day
1 second letter
0 work in progress
o 1 work in progress files: letter2.txt
|
o 0 second letter files: letter2.txt
% test stop revision
initializing destination stoprev repository
scanning source...
sorting...
converting...
0 init projB
extra: branch=
extra: convert_revision=