Mercurial > hg
annotate tests/test-bheads @ 5096:ad6b97132b81
merge: fix a copy detection bug (issue672)
When merging rev1 and rev2, we want to search for copies that happened
in rev1 but not in rev2 and vice-versa. We were starting the search at
rev1/rev2 and then going back, stopping as soon as we reached the revno
of the ancestor, but that can miss some cases (see the new
test-issue672).
Now we calculate the revisions that are ancestors of rev1 or rev2 (but
not both) and make sure the search doesn't stop too early.
Simplified test provided by mpm, based on a test case provided by
Edward Lee.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sun, 12 Aug 2007 12:15:10 -0300 |
parents | 8e503fa54d2d |
children | 25c372e8f261 |
rev | line source |
---|---|
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
1 #!/bin/sh |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
2 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
3 hg init a |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
4 cd a |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
5 echo 'root' >root |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
6 hg add root |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
7 hg commit -d '0 0' -u test -m "Adding root node" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
8 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
9 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
10 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
11 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
12 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
13 echo 'a' >a |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
14 hg add a |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
15 hg branch a |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
16 hg commit -d '1 0' -u test -m "Adding a branch" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
17 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
18 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
19 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
20 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
21 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
22 hg update -C 0 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
23 echo 'b' >b |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
24 hg add b |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
25 hg branch b |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
26 hg commit -d '2 0' -u test -m "Adding b branch" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
27 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
28 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
29 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
30 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
31 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
32 echo 'bh1' >bh1 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
33 hg add bh1 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
34 hg commit -d '3 0' -u test -m "Adding b branch head 1" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
35 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
36 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
37 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
38 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
39 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
40 hg update -C 2 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
41 echo 'bh2' >bh2 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
42 hg add bh2 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
43 hg commit -d '4 0' -u test -m "Adding b branch head 2" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
44 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
45 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
46 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
47 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
48 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
49 hg update -C 2 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
50 echo 'bh3' >bh3 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
51 hg add bh3 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
52 hg commit -d '5 0' -u test -m "Adding b branch head 3" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
53 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
54 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
55 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
56 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
57 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
58 hg merge 4 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
59 hg commit -d '6 0' -u test -m "Merging b branch head 2 and b branch head 3" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
60 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
61 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
62 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
63 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
64 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
65 echo 'c' >c |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
66 hg add c |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
67 hg branch c |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
68 hg commit -d '7 0' -u test -m "Adding c branch" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
69 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
70 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
71 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
72 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
73 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
74 hg heads -r 3 . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
75 echo $? |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
76 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
77 hg heads -r 2 . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
78 echo $? |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
79 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
80 hg update -C 4 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
81 echo $? |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
82 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
83 hg heads -r 3 . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
84 echo $? |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
85 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
86 hg heads -r 2 . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
87 echo $? |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
88 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
89 hg heads -r 7 . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
90 echo $? |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
91 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
92 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
93 for i in 0 1 2 3 4 5 6 7; do |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
94 hg update -C "$i" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
95 hg heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
96 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
97 hg heads . |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
98 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
99 done |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
100 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
101 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
102 for i in a b c z; do |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
103 hg heads "$i" |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
104 echo '-------' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
105 done |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
106 |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
107 echo '=======' |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff
changeset
|
108 hg heads 0 1 2 3 4 5 6 7 |