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