view tests/test-push-warn.out @ 10925:a101a743c570 stable

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.
author Sune Foldager <cryo@cyanite.org>
date Thu, 15 Apr 2010 21:59:21 +0200
parents 29a83fb8c067
children 5b48d819d5f9
line wrap: on
line source

updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
pushing to ../a
searching for changes
abort: push creates new remote heads on branch 'default'!
(you should pull and merge or use push -f to force)
pulling from ../a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
pushing to ../a
searching for changes
abort: push creates new remote heads on branch 'default'!
(did you forget to merge? use push -f to force)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
pushing to ../a
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 1 changes to 1 files
adding foo
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
merging foo
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
pushing to ../c
searching for changes
abort: push creates new remote heads on branch 'default'!
(did you forget to merge? use push -f to force)
1
pushing to ../c
searching for changes
no changes found
0
pushing to ../c
searching for changes
abort: push creates new remote heads on branch 'default'!
(did you forget to merge? use push -f to force)
1
pushing to ../c
searching for changes
abort: push creates new remote heads on branch 'default'!
(did you forget to merge? use push -f to force)
1
pushing to ../c
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 1 files (+2 heads)
0
pushing to ../c
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (-1 heads)
0
comparing with ../c
searching for changes
no changes found
% issue 450
pushing to ../e
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
0
pushing to ../e
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
0
% issue 736
% push on existing branch and new branch
pushing to ../f
searching for changes
abort: push creates new remote branches: c!
(use 'hg push -f' to force)
1
pushing to ../f
searching for changes
abort: push creates new remote branches: c!
(use 'hg push -f' to force)
1
% multiple new branches
pushing to ../f
searching for changes
abort: push creates new remote branches: c, d!
(use 'hg push -f' to force)
1
pushing to ../f
searching for changes
abort: push creates new remote branches: c, d!
(use 'hg push -f' to force)
1
% fail on multiple head push
pushing to ../f
searching for changes
abort: push creates new remote heads on branch 'a'!
(did you forget to merge? use push -f to force)
1
% push replacement head on existing branches
pushing to ../f
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 1 files
0
% merge of branch a to other branch b followed by unrelated push on branch a
pushing to ../f
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (-1 heads)
0
pushing to ../f
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
0
% cheating the counting algorithm
pushing to ../f
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 1 files
0
% checking prepush logic does not allow silently pushing multiple new heads
adding init
adding a
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding b
created new head
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding c
created new head
pushing to h
searching for changes
abort: push creates new remote heads on branch 'default'!
(you should pull and merge or use push -f to force)

% check prepush logic with merged branches
marked working directory as branch a
adding foo
updating to branch a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
pushing to j
searching for changes
abort: push creates new remote branches: b!
(use 'hg push -f' to force)

% prepush -r should not allow you to sneak in new heads
pushing to ../l
searching for changes
abort: push creates new remote heads on branch 'a'!
(did you forget to merge? use push -f to force)
% check prepush with new branch head on former topo non-head
marked working directory as branch A
adding a
marked working directory as branch B
adding b
updating to branch B
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
adding b1
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding a2
created new head
%% glog of local
@  2: A a2
|
| o  1: B b
|/
o  0: A a

%% glog of remote
@  2: B b1
|
o  1: B b
|
o  0: A a

%% outgoing
comparing with inner
searching for changes
2: A a2
pushing to inner
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
% check prepush with new branch head on former topo head
marked working directory as branch A
adding a
marked working directory as branch B
adding b
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding a1
created new head
updating to branch A
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
adding b1
adding a2
%% glog of local
@  3: A a2
|
o  2: A a1
|
| o  1: B b
|/
o  0: A a

%% glog of remote
@  3: B b1
|
| o  2: A a1
| |
o |  1: B b
|/
o  0: A a

%% outgoing
comparing with inner
searching for changes
3: A a2
pushing to inner
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
% check prepush with new branch head and new child of former branch head
% but child is on different branch
marked working directory as branch A
adding a
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
marked working directory as branch B
adding b
created new head
updating to branch B
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
marked working directory as branch B
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
marked working directory as branch A
%% glog of local
@  5: A b3
|
| o  4: B a3
| |
o |  3: B b1
| |
o |  2: B b0
 /
o  1: A a1
|
o  0: A a0

%% glog of remote
@  3: B b1
|
o  2: B b0

o  1: A a1
|
o  0: A a0

%% outgoing
comparing with inner
searching for changes
4: B a3
5: A b3
pushing to inner
searching for changes
abort: push creates new remote heads on branch 'A'!
(did you forget to merge? use push -f to force)
pushing to inner
searching for changes
abort: push creates new remote heads on branch 'A'!
(did you forget to merge? use push -f to force)
comparing with inner
searching for changes
no changes found