Mercurial > hg
annotate tests/test-subrepo @ 10251:a19d2993385d stable
subrepo: fix merging of already merged subrepos (issue1986)
This fixes a bug seen when merging a main repo which contains a subrepo when
both repos have been merged before. Each repo (main and sub) has two
branches, both of which have been merged before.
In a subrepo, if the revision to merge to is an ancestor of the current rev,
then the merge should be a noop.
Test provided by Steve Losh.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Fri, 15 Jan 2010 21:08:04 +0100 |
parents | a7c4eb0cc0ed |
children | 0bc93fa2cf2b |
rev | line source |
---|---|
8816 | 1 #!/bin/sh |
2 | |
3 rm -rf sub | |
4 mkdir sub | |
5 cd sub | |
6 hg init t | |
7 cd t | |
8 | |
9 echo % first revision, no sub | |
10 echo a > a | |
11 hg ci -Am0 | |
12 | |
13 echo % add first sub | |
14 echo s = s > .hgsub | |
15 hg add .hgsub | |
16 hg init s | |
17 echo a > s/a | |
18 hg -R s ci -Ams0 | |
19 hg ci -m1 | |
20 | |
21 echo % add sub sub | |
22 echo ss = ss > s/.hgsub | |
23 hg init s/ss | |
24 echo a > s/ss/a | |
25 hg -R s add s/.hgsub | |
26 hg -R s/ss add s/ss/a | |
27 hg ci -m2 | |
28 | |
29 echo % bump sub rev | |
30 echo b > s/a | |
31 hg -R s ci -ms1 | |
32 hg ci -m3 | |
33 | |
34 echo % leave sub dirty | |
35 echo c > s/a | |
36 hg ci -m4 | |
37 hg tip -R s | |
38 | |
39 echo % check caching | |
40 hg co 0 | |
41 hg debugsub | |
42 echo % restore | |
43 hg co | |
44 hg debugsub | |
45 | |
46 echo % new branch for merge tests | |
47 hg co 1 | |
48 echo t = t >> .hgsub | |
49 hg init t | |
50 echo t > t/t | |
51 hg -R t add t | |
52 echo % 5 | |
53 hg ci -m5 # add sub | |
54 echo t2 > t/t | |
55 echo % 6 | |
56 hg st -R s | |
57 hg ci -m6 # change sub | |
58 hg debugsub | |
59 echo t3 > t/t | |
60 echo % 7 | |
61 hg ci -m7 # change sub again for conflict test | |
62 hg rm .hgsub | |
63 echo % 8 | |
64 hg ci -m8 # remove sub | |
65 | |
66 echo % merge tests | |
67 hg co -C 3 | |
68 hg merge 5 # test adding | |
69 hg debugsub | |
70 hg ci -m9 | |
71 hg merge 6 --debug # test change | |
72 hg debugsub | |
73 echo conflict > t/t | |
74 hg ci -m10 | |
75 HGMERGE=internal:merge hg merge --debug 7 # test conflict | |
76 echo % should conflict | |
77 cat t/t | |
78 | |
79 echo % clone | |
80 cd .. | |
81 hg clone t tc | |
82 cd tc | |
83 hg debugsub | |
84 | |
85 echo % push | |
86 echo bah > t/t | |
87 hg ci -m11 | |
88 hg push | sed 's/ .*sub/ ...sub/g' | |
89 | |
90 echo % push -f | |
91 echo bah > s/a | |
92 hg ci -m12 | |
93 hg push | sed 's/ .*sub/ ...sub/g' | |
94 hg push -f | sed 's/ .*sub/ ...sub/g' | |
95 | |
96 echo % update | |
97 cd ../t | |
98 hg up -C # discard our earlier merge | |
99 echo blah > t/t | |
100 hg ci -m13 | |
101 | |
102 echo % pull | |
103 cd ../tc | |
104 hg pull | sed 's/ .*sub/ ...sub/g' | |
105 hg up # should pull t | |
106 cat t/t | |
10251
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
107 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
108 echo % issue 1986 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
109 cd .. |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
110 rm -rf sub |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
111 hg init main |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
112 cd main |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
113 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
114 hg init s # subrepo layout |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
115 cd s # |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
116 echo a > a # o 5 br |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
117 hg ci -Am1 # /| |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
118 hg branch br # o | 4 default |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
119 echo a >> a # | | |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
120 hg ci -m1 # | o 3 br |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
121 hg up default # |/| |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
122 echo b > b # o | 2 default |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
123 hg ci -Am1 # | | |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
124 hg up br # | o 1 br |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
125 hg merge tip # |/ |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
126 hg ci -m1 # o 0 default |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
127 hg up 2 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
128 echo c > c |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
129 hg ci -Am1 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
130 hg up 3 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
131 hg merge 4 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
132 hg ci -m1 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
133 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
134 cd .. # main repo layout: |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
135 echo 's = s' > .hgsub # |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
136 hg -R s up 2 # * <-- try to merge default into br again |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
137 hg ci -Am1 # .`| |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
138 hg branch br # . o 5 br --> substate = 5 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
139 echo b > b # . | |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
140 hg -R s up 3 # o | 4 default --> substate = 4 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
141 hg ci -Am1 # | | |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
142 hg up default # | o 3 br --> substate = 2 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
143 echo c > c # |/| |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
144 hg ci -Am1 # o | 2 default --> substate = 2 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
145 hg up 1 # | | |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
146 hg merge 2 # | o 1 br --> substate = 3 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
147 hg ci -m1 # |/ |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
148 hg up 2 # o 0 default --> substate = 2 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
149 hg -R s up 4 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
150 echo d > d |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
151 hg ci -Am1 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
152 hg up 3 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
153 hg -R s up 5 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
154 echo e > e |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
155 hg ci -Am1 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
156 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
157 hg up 5 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
158 hg merge 4 # try to merge default into br again |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
159 |
a19d2993385d
subrepo: fix merging of already merged subrepos (issue1986)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8816
diff
changeset
|
160 exit 0 |