Show More
@@ -1,202 +1,202 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | # adjust to non-default HGPORT, e.g. with run-tests.py -j |
|
3 | # adjust to non-default HGPORT, e.g. with run-tests.py -j | |
4 | hideport() { sed "s/localhost:$HGPORT/localhost:20059/"; } |
|
4 | hideport() { sed "s/localhost:$HGPORT/localhost:20059/"; } | |
5 | hidehash() { sed "s/changeset 3:............ merges/changeset 3:... merges/"; } |
|
5 | hidehash() { sed "s/changeset 3:............ merges/changeset 3:... merges/"; } | |
6 |
|
6 | |||
7 | echo "[extensions]" >> $HGRCPATH |
|
7 | echo "[extensions]" >> $HGRCPATH | |
8 | echo "fetch=" >> $HGRCPATH |
|
8 | echo "fetch=" >> $HGRCPATH | |
9 |
|
9 | |||
10 | echo % test fetch with default branches only |
|
10 | echo % test fetch with default branches only | |
11 | hg init a |
|
11 | hg init a | |
12 | echo a > a/a |
|
12 | echo a > a/a | |
13 | hg --cwd a commit -d '1 0' -Ama |
|
13 | hg --cwd a commit -d '1 0' -Ama | |
14 |
|
14 | |||
15 | hg clone a b |
|
15 | hg clone a b | |
16 | hg clone a c |
|
16 | hg clone a c | |
17 |
|
17 | |||
18 | echo b > a/b |
|
18 | echo b > a/b | |
19 | hg --cwd a commit -d '2 0' -Amb |
|
19 | hg --cwd a commit -d '2 0' -Amb | |
20 | hg --cwd a parents -q |
|
20 | hg --cwd a parents -q | |
21 |
|
21 | |||
22 | echo % should pull one change |
|
22 | echo % should pull one change | |
23 | hg --cwd b fetch ../a |
|
23 | hg --cwd b fetch ../a | |
24 | hg --cwd b parents -q |
|
24 | hg --cwd b parents -q | |
25 |
|
25 | |||
26 | echo c > c/c |
|
26 | echo c > c/c | |
27 | hg --cwd c commit -d '3 0' -Amc |
|
27 | hg --cwd c commit -d '3 0' -Amc | |
28 |
|
28 | |||
29 | hg clone c d |
|
29 | hg clone c d | |
30 | hg clone c e |
|
30 | hg clone c e | |
31 |
|
31 | |||
32 | # We cannot use the default commit message if fetching from a local |
|
32 | # We cannot use the default commit message if fetching from a local | |
33 | # repo, because the path of the repo will be included in the commit |
|
33 | # repo, because the path of the repo will be included in the commit | |
34 | # message, making every commit appear different. |
|
34 | # message, making every commit appear different. | |
35 |
|
35 | |||
36 | echo % should merge c into a |
|
36 | echo % should merge c into a | |
37 | hg --cwd c fetch -d '4 0' -m 'automated merge' ../a |
|
37 | hg --cwd c fetch -d '4 0' -m 'automated merge' ../a | |
38 | ls c |
|
38 | ls c | |
39 |
|
39 | |||
40 | netstat -tnap 2>/dev/null | grep $HGPORT | grep LISTEN |
|
40 | netstat -tnap 2>/dev/null | grep $HGPORT | grep LISTEN | |
41 | hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid |
|
41 | hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid | |
42 | cat a/hg.pid >> "$DAEMON_PIDS" |
|
42 | cat a/hg.pid >> "$DAEMON_PIDS" | |
43 |
|
43 | |||
44 | echo '% fetch over http, no auth' |
|
44 | echo '% fetch over http, no auth' | |
45 | hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/ | hideport | hidehash |
|
45 | hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/ | hideport | hidehash | |
46 | hg --cwd d tip --template '{desc}\n' | hideport |
|
46 | hg --cwd d tip --template '{desc}\n' | hideport | |
47 |
|
47 | |||
48 | echo '% fetch over http with auth (should be hidden in desc)' |
|
48 | echo '% fetch over http with auth (should be hidden in desc)' | |
49 | hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/ | hideport | hidehash |
|
49 | hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/ | hideport | hidehash | |
50 | hg --cwd e tip --template '{desc}\n' | hideport |
|
50 | hg --cwd e tip --template '{desc}\n' | hideport | |
51 |
|
51 | |||
52 | hg clone a f |
|
52 | hg clone a f | |
53 | hg clone a g |
|
53 | hg clone a g | |
54 |
|
54 | |||
55 | echo f > f/f |
|
55 | echo f > f/f | |
56 | hg --cwd f ci -d '6 0' -Amf |
|
56 | hg --cwd f ci -d '6 0' -Amf | |
57 |
|
57 | |||
58 | echo g > g/g |
|
58 | echo g > g/g | |
59 | hg --cwd g ci -d '6 0' -Amg |
|
59 | hg --cwd g ci -d '6 0' -Amg | |
60 |
|
60 | |||
61 | hg clone -q f h |
|
61 | hg clone -q f h | |
62 | hg clone -q g i |
|
62 | hg clone -q g i | |
63 |
|
63 | |||
64 | echo % should merge f into g |
|
64 | echo % should merge f into g | |
65 | hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f |
|
65 | hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f | |
66 |
|
66 | |||
67 | rm i/g |
|
67 | rm i/g | |
68 | echo % should abort, because i is modified |
|
68 | echo % should abort, because i is modified | |
69 | hg --cwd i fetch ../h |
|
69 | hg --cwd i fetch ../h | |
70 |
|
70 | |||
71 |
|
71 | |||
72 | echo % test fetch with named branches |
|
72 | echo % test fetch with named branches | |
73 | hg init nbase |
|
73 | hg init nbase | |
74 | echo base > nbase/a |
|
74 | echo base > nbase/a | |
75 | hg -R nbase ci -d '1 0' -Am base |
|
75 | hg -R nbase ci -d '1 0' -Am base | |
76 | hg -R nbase branch a |
|
76 | hg -R nbase branch a | |
77 | echo a > nbase/a |
|
77 | echo a > nbase/a | |
78 | hg -R nbase ci -d '2 0' -m a |
|
78 | hg -R nbase ci -d '2 0' -m a | |
79 | hg -R nbase up -C 0 |
|
79 | hg -R nbase up -C 0 | |
80 | hg -R nbase branch b |
|
80 | hg -R nbase branch b | |
81 | echo b > nbase/b |
|
81 | echo b > nbase/b | |
82 | hg -R nbase ci -Ad '3 0' -m b |
|
82 | hg -R nbase ci -Ad '3 0' -m b | |
83 |
|
83 | |||
84 | echo |
|
84 | echo | |
85 | echo % pull in change on foreign branch |
|
85 | echo % pull in change on foreign branch | |
86 | hg clone nbase n1 |
|
86 | hg clone nbase n1 | |
87 | hg clone nbase n2 |
|
87 | hg clone nbase n2 | |
88 | hg -R n1 up -C a |
|
88 | hg -R n1 up -C a | |
89 | echo aa > n1/a |
|
89 | echo aa > n1/a | |
90 | hg -R n1 ci -d '4 0' -m a1 |
|
90 | hg -R n1 ci -d '4 0' -m a1 | |
91 |
|
91 | |||
92 | hg -R n2 up -C b |
|
92 | hg -R n2 up -C b | |
93 | hg -R n2 fetch -d '9 0' -m 'merge' n1 |
|
93 | hg -R n2 fetch -d '9 0' -m 'merge' n1 | |
94 | echo '% parent should be 2 (no automatic update)' |
|
94 | echo '% parent should be 2 (no automatic update)' | |
95 | hg -R n2 parents --template '{rev}\n' |
|
95 | hg -R n2 parents --template '{rev}\n' | |
96 | rm -fr n1 n2 |
|
96 | rm -fr n1 n2 | |
97 |
|
97 | |||
98 | echo |
|
98 | echo | |
99 | echo % pull in changes on both foreign and local branches |
|
99 | echo % pull in changes on both foreign and local branches | |
100 | hg clone nbase n1 |
|
100 | hg clone nbase n1 | |
101 | hg clone nbase n2 |
|
101 | hg clone nbase n2 | |
102 | hg -R n1 up -C a |
|
102 | hg -R n1 up -C a | |
103 | echo aa > n1/a |
|
103 | echo aa > n1/a | |
104 | hg -R n1 ci -d '4 0' -m a1 |
|
104 | hg -R n1 ci -d '4 0' -m a1 | |
105 | hg -R n1 up -C b |
|
105 | hg -R n1 up -C b | |
106 | echo bb > n1/b |
|
106 | echo bb > n1/b | |
107 | hg -R n1 ci -d '5 0' -m b1 |
|
107 | hg -R n1 ci -d '5 0' -m b1 | |
108 |
|
108 | |||
109 | hg -R n2 up -C b |
|
109 | hg -R n2 up -C b | |
110 | hg -R n2 fetch -d '9 0' -m 'merge' n1 |
|
110 | hg -R n2 fetch -d '9 0' -m 'merge' n1 | |
111 | echo '% parent should be 4 (fast forward)' |
|
111 | echo '% parent should be 4 (fast forward)' | |
112 | hg -R n2 parents --template '{rev}\n' |
|
112 | hg -R n2 parents --template '{rev}\n' | |
113 | rm -fr n1 n2 |
|
113 | rm -fr n1 n2 | |
114 |
|
114 | |||
115 | echo |
|
115 | echo | |
116 | echo '% pull changes on foreign (2 new heads) and local (1 new head) branches' |
|
116 | echo '% pull changes on foreign (2 new heads) and local (1 new head) branches' | |
117 | echo % with a local change |
|
117 | echo % with a local change | |
118 | hg clone nbase n1 |
|
118 | hg clone nbase n1 | |
119 | hg clone nbase n2 |
|
119 | hg clone nbase n2 | |
120 | hg -R n1 up -C a |
|
120 | hg -R n1 up -C a | |
121 | echo a1 > n1/a |
|
121 | echo a1 > n1/a | |
122 | hg -R n1 ci -d '4 0' -m a1 |
|
122 | hg -R n1 ci -d '4 0' -m a1 | |
123 | hg -R n1 up -C b |
|
123 | hg -R n1 up -C b | |
124 | echo bb > n1/b |
|
124 | echo bb > n1/b | |
125 | hg -R n1 ci -d '5 0' -m b1 |
|
125 | hg -R n1 ci -d '5 0' -m b1 | |
126 | hg -R n1 up -C 1 |
|
126 | hg -R n1 up -C 1 | |
127 | echo a2 > n1/a |
|
127 | echo a2 > n1/a | |
128 | hg -R n1 ci -d '6 0' -m a2 |
|
128 | hg -R n1 ci -d '6 0' -m a2 | |
129 |
|
129 | |||
130 | hg -R n2 up -C b |
|
130 | hg -R n2 up -C b | |
131 | echo change >> n2/c |
|
131 | echo change >> n2/c | |
132 | hg -R n2 ci -Ad '7 0' -m local |
|
132 | hg -R n2 ci -Ad '7 0' -m local | |
133 | hg -R n2 fetch -d '9 0' -m 'merge' n1 |
|
133 | hg -R n2 fetch -d '9 0' -m 'merge' n1 | |
134 | echo '% parent should be 7 (new merge changeset)' |
|
134 | echo '% parent should be 7 (new merge changeset)' | |
135 | hg -R n2 parents --template '{rev}\n' |
|
135 | hg -R n2 parents --template '{rev}\n' | |
136 | rm -fr n1 n2 |
|
136 | rm -fr n1 n2 | |
137 |
|
137 | |||
138 | echo '% pull in changes on foreign (merge of local branch) and local (2 new' |
|
138 | echo '% pull in changes on foreign (merge of local branch) and local (2 new' | |
139 | echo '% heads) with a local change' |
|
139 | echo '% heads) with a local change' | |
140 | hg clone nbase n1 |
|
140 | hg clone nbase n1 | |
141 | hg clone nbase n2 |
|
141 | hg clone nbase n2 | |
142 | hg -R n1 up -C a |
|
142 | hg -R n1 up -C a | |
143 | hg -R n1 merge b |
|
143 | hg -R n1 merge b | |
144 | hg -R n1 ci -d '4 0' -m merge |
|
144 | hg -R n1 ci -d '4 0' -m merge | |
145 | hg -R n1 up -C 2 |
|
145 | hg -R n1 up -C 2 | |
146 | echo c > n1/a |
|
146 | echo c > n1/a | |
147 | hg -R n1 ci -d '5 0' -m c |
|
147 | hg -R n1 ci -d '5 0' -m c | |
148 | hg -R n1 up -C 2 |
|
148 | hg -R n1 up -C 2 | |
149 | echo cc > n1/a |
|
149 | echo cc > n1/a | |
150 | hg -R n1 ci -d '6 0' -m cc |
|
150 | hg -R n1 ci -d '6 0' -m cc | |
151 |
|
151 | |||
152 | hg -R n2 up -C b |
|
152 | hg -R n2 up -C b | |
153 | echo change >> n2/b |
|
153 | echo change >> n2/b | |
154 | hg -R n2 ci -Ad '7 0' -m local |
|
154 | hg -R n2 ci -Ad '7 0' -m local | |
155 | hg -R n2 fetch -d '9 0' -m 'merge' n1 |
|
155 | hg -R n2 fetch -d '9 0' -m 'merge' n1 | |
156 | echo '% parent should be 3 (fetch did not merge anything)' |
|
156 | echo '% parent should be 3 (fetch did not merge anything)' | |
157 | hg -R n2 parents --template '{rev}\n' |
|
157 | hg -R n2 parents --template '{rev}\n' | |
158 | rm -fr n1 n2 |
|
158 | rm -fr n1 n2 | |
159 |
|
159 | |||
160 | echo % pull in change on different branch than dirstate |
|
160 | echo % pull in change on different branch than dirstate | |
161 | hg init n1 |
|
161 | hg init n1 | |
162 | echo a > n1/a |
|
162 | echo a > n1/a | |
163 | hg -R n1 ci -Am initial |
|
163 | hg -R n1 ci -Am initial | |
164 | hg clone n1 n2 |
|
164 | hg clone n1 n2 | |
165 | echo b > n1/a |
|
165 | echo b > n1/a | |
166 | hg -R n1 ci -m next |
|
166 | hg -R n1 ci -m next | |
167 | hg -R n2 branch topic |
|
167 | hg -R n2 branch topic | |
168 | hg -R n2 fetch -d '0 0' -m merge n1 |
|
168 | hg -R n2 fetch -d '0 0' -m merge n1 | |
169 | echo '% parent should be 0 (fetch did not update or merge anything)' |
|
169 | echo '% parent should be 0 (fetch did not update or merge anything)' | |
170 | hg -R n2 parents --template '{rev}\n' |
|
170 | hg -R n2 parents --template '{rev}\n' | |
171 | rm -fr n1 n2 |
|
171 | rm -fr n1 n2 | |
172 |
|
172 | |||
173 | echo % test fetch with inactive branches |
|
173 | echo % test fetch with inactive branches | |
174 | hg init ib1 |
|
174 | hg init ib1 | |
175 | echo a > ib1/a |
|
175 | echo a > ib1/a | |
176 | hg --cwd ib1 ci -Am base |
|
176 | hg --cwd ib1 ci -Am base | |
177 | hg --cwd ib1 branch second |
|
177 | hg --cwd ib1 branch second | |
178 | echo b > ib1/b |
|
178 | echo b > ib1/b | |
179 | hg --cwd ib1 ci -Am onsecond |
|
179 | hg --cwd ib1 ci -Am onsecond | |
180 | hg --cwd ib1 branch -f default |
|
180 | hg --cwd ib1 branch -f default | |
181 | echo c > ib1/c |
|
181 | echo c > ib1/c | |
182 | hg --cwd ib1 ci -Am newdefault |
|
182 | hg --cwd ib1 ci -Am newdefault | |
183 | hg clone ib1 ib2 |
|
183 | hg clone ib1 ib2 | |
184 | echo % fetch should succeed |
|
184 | echo % fetch should succeed | |
185 | hg --cwd ib2 fetch ../ib1 |
|
185 | hg --cwd ib2 fetch ../ib1 | |
186 | rm -fr ib1 ib2 |
|
186 | rm -fr ib1 ib2 | |
187 |
|
187 | |||
188 | echo % test issue1726 |
|
188 | echo % test issue1726 | |
189 | hg init i1726r1 |
|
189 | hg init i1726r1 | |
190 | echo a > i1726r1/a |
|
190 | echo a > i1726r1/a | |
191 | hg --cwd i1726r1 ci -Am base |
|
191 | hg --cwd i1726r1 ci -Am base | |
192 | hg clone i1726r1 i1726r2 |
|
192 | hg clone i1726r1 i1726r2 | |
193 | echo b > i1726r1/a |
|
193 | echo b > i1726r1/a | |
194 | hg --cwd i1726r1 ci -m second |
|
194 | hg --cwd i1726r1 ci -m second | |
195 | echo c > i1726r2/a |
|
195 | echo c > i1726r2/a | |
196 | hg --cwd i1726r2 ci -m third |
|
196 | hg --cwd i1726r2 ci -m third | |
197 |
HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 | sed 's/new changeset 3:[0-9a-zA-Z] |
|
197 | HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 | sed 's/new changeset 3:[0-9a-zA-Z]* /new changeset 3 /' | |
198 | hg --cwd i1726r2 heads default --template '{rev}\n' |
|
198 | hg --cwd i1726r2 heads default --template '{rev}\n' | |
199 |
|
199 | |||
200 | "$TESTDIR/killdaemons.py" |
|
200 | "$TESTDIR/killdaemons.py" | |
201 |
|
201 | |||
202 | true |
|
202 | true |
General Comments 0
You need to be logged in to leave comments.
Login now