Show More
@@ -1,474 +1,484 | |||
|
1 | 1 | Test exchange of common information using bundle2 |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | $ getmainid() { |
|
5 | 5 | > hg -R main log --template '{node}\n' --rev "$1" |
|
6 | 6 | > } |
|
7 | 7 | |
|
8 | 8 | enable obsolescence |
|
9 | 9 | |
|
10 | 10 | $ cat > obs.py << EOF |
|
11 | 11 | > import mercurial.obsolete |
|
12 | 12 | > mercurial.obsolete._enabled = True |
|
13 | 13 | > EOF |
|
14 | 14 | |
|
15 | 15 | $ cat >> $HGRCPATH << EOF |
|
16 | 16 | > [extensions] |
|
17 | 17 | > obsolete=$TESTTMP/obs.py |
|
18 | 18 | > [experimental] |
|
19 | 19 | > bundle2-exp=True |
|
20 | 20 | > [ui] |
|
21 | 21 | > ssh=python "$TESTDIR/dummyssh" |
|
22 | 22 | > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline} |
|
23 | 23 | > [web] |
|
24 | 24 | > push_ssl = false |
|
25 | 25 | > allow_push = * |
|
26 | 26 | > [phases] |
|
27 | 27 | > publish=False |
|
28 | 28 | > [hooks] |
|
29 | > changegroup = sh -c "HG_LOCAL= HG_NODE= HG_TAG= python \"$TESTDIR/printenv.py\" changegroup" | |
|
29 | 30 | > b2x-transactionclose = sh -c "HG_LOCAL= HG_NODE= HG_TAG= python \"$TESTDIR/printenv.py\" b2x-transactionclose" |
|
30 | 31 | > EOF |
|
31 | 32 | |
|
32 | 33 | The extension requires a repo (currently unused) |
|
33 | 34 | |
|
34 | 35 | $ hg init main |
|
35 | 36 | $ cd main |
|
36 | 37 | $ touch a |
|
37 | 38 | $ hg add a |
|
38 | 39 | $ hg commit -m 'a' |
|
39 | 40 | |
|
40 | 41 | $ hg unbundle $TESTDIR/bundles/rebase.hg |
|
41 | 42 | adding changesets |
|
42 | 43 | adding manifests |
|
43 | 44 | adding file changes |
|
44 | 45 | added 8 changesets with 7 changes to 7 files (+3 heads) |
|
46 | changegroup hook: HG_SOURCE=unbundle HG_URL=bundle:*/tests/bundles/rebase.hg (glob) | |
|
45 | 47 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
46 | 48 | |
|
47 | 49 | $ cd .. |
|
48 | 50 | |
|
49 | 51 | Real world exchange |
|
50 | 52 | ===================== |
|
51 | 53 | |
|
52 | 54 | Add more obsolescence information |
|
53 | 55 | |
|
54 | 56 | $ hg -R main debugobsolete -d '0 0' 1111111111111111111111111111111111111111 `getmainid 9520eea781bc` |
|
55 | 57 | $ hg -R main debugobsolete -d '0 0' 2222222222222222222222222222222222222222 `getmainid 24b6387c8c8c` |
|
56 | 58 | |
|
57 | 59 | clone --pull |
|
58 | 60 | |
|
59 | 61 | $ hg -R main phase --public cd010b8cd998 |
|
60 | 62 | $ hg clone main other --pull --rev 9520eea781bc |
|
61 | 63 | adding changesets |
|
62 | 64 | adding manifests |
|
63 | 65 | adding file changes |
|
64 | 66 | added 2 changesets with 2 changes to 2 files |
|
65 | 67 | 1 new obsolescence markers |
|
68 | changegroup hook: HG_NEW_OBSMARKERS=1 HG_SOURCE=bundle2 HG_URL=bundle2 | |
|
66 | 69 | updating to branch default |
|
67 | 70 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
68 | 71 | $ hg -R other log -G |
|
69 | 72 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
70 | 73 | | |
|
71 | 74 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
72 | 75 | |
|
73 | 76 | $ hg -R other debugobsolete |
|
74 | 77 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
75 | 78 | |
|
76 | 79 | pull |
|
77 | 80 | |
|
78 | 81 | $ hg -R main phase --public 9520eea781bc |
|
79 | 82 | $ hg -R other pull -r 24b6387c8c8c |
|
80 | 83 | pulling from $TESTTMP/main (glob) |
|
81 | 84 | searching for changes |
|
82 | 85 | adding changesets |
|
83 | 86 | adding manifests |
|
84 | 87 | adding file changes |
|
85 | 88 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
86 | 89 | 1 new obsolescence markers |
|
90 | changegroup hook: HG_NEW_OBSMARKERS=1 HG_SOURCE=bundle2 HG_URL=bundle2 | |
|
87 | 91 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
88 | 92 | $ hg -R other log -G |
|
89 | 93 | o 2:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
90 | 94 | | |
|
91 | 95 | | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
92 | 96 | |/ |
|
93 | 97 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
94 | 98 | |
|
95 | 99 | $ hg -R other debugobsolete |
|
96 | 100 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
97 | 101 | 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
98 | 102 | |
|
99 | 103 | pull empty (with phase movement) |
|
100 | 104 | |
|
101 | 105 | $ hg -R main phase --public 24b6387c8c8c |
|
102 | 106 | $ hg -R other pull -r 24b6387c8c8c |
|
103 | 107 | pulling from $TESTTMP/main (glob) |
|
104 | 108 | no changes found |
|
105 | 109 | $ hg -R other log -G |
|
106 | 110 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
107 | 111 | | |
|
108 | 112 | | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
109 | 113 | |/ |
|
110 | 114 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
111 | 115 | |
|
112 | 116 | $ hg -R other debugobsolete |
|
113 | 117 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
114 | 118 | 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
115 | 119 | |
|
116 | 120 | pull empty |
|
117 | 121 | |
|
118 | 122 | $ hg -R other pull -r 24b6387c8c8c |
|
119 | 123 | pulling from $TESTTMP/main (glob) |
|
120 | 124 | no changes found |
|
121 | 125 | $ hg -R other log -G |
|
122 | 126 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
123 | 127 | | |
|
124 | 128 | | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
125 | 129 | |/ |
|
126 | 130 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
127 | 131 | |
|
128 | 132 | $ hg -R other debugobsolete |
|
129 | 133 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
130 | 134 | 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
131 | 135 | |
|
132 | 136 | add extra data to test their exchange during push |
|
133 | 137 | |
|
134 | 138 | $ hg -R main bookmark --rev eea13746799a book_eea1 |
|
135 | 139 | $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a` |
|
136 | 140 | $ hg -R main bookmark --rev 02de42196ebe book_02de |
|
137 | 141 | $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe` |
|
138 | 142 | $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc |
|
139 | 143 | $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16` |
|
140 | 144 | $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd |
|
141 | 145 | $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8` |
|
142 | 146 | $ hg -R main bookmark --rev 32af7686d403 book_32af |
|
143 | 147 | $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403` |
|
144 | 148 | |
|
145 | 149 | $ hg -R other bookmark --rev cd010b8cd998 book_eea1 |
|
146 | 150 | $ hg -R other bookmark --rev cd010b8cd998 book_02de |
|
147 | 151 | $ hg -R other bookmark --rev cd010b8cd998 book_42cc |
|
148 | 152 | $ hg -R other bookmark --rev cd010b8cd998 book_5fdd |
|
149 | 153 | $ hg -R other bookmark --rev cd010b8cd998 book_32af |
|
150 | 154 | |
|
151 | 155 | $ hg -R main phase --public eea13746799a |
|
152 | 156 | |
|
153 | 157 | push |
|
154 | 158 | $ hg -R main push other --rev eea13746799a --bookmark book_eea1 |
|
155 | 159 | pushing to other |
|
156 | 160 | searching for changes |
|
157 | 161 | b2x-transactionclose hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_SOURCE=push HG_URL=push |
|
162 | changegroup hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_SOURCE=bundle2 HG_URL=bundle2 | |
|
158 | 163 | remote: adding changesets |
|
159 | 164 | remote: adding manifests |
|
160 | 165 | remote: adding file changes |
|
161 | 166 | remote: added 1 changesets with 0 changes to 0 files (-1 heads) |
|
162 | 167 | remote: 1 new obsolescence markers |
|
163 | 168 | updating bookmark book_eea1 |
|
164 | 169 | $ hg -R other log -G |
|
165 | 170 | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G |
|
166 | 171 | |\ |
|
167 | 172 | | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
168 | 173 | | | |
|
169 | 174 | @ | 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
170 | 175 | |/ |
|
171 | 176 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de book_32af book_42cc book_5fdd A |
|
172 | 177 | |
|
173 | 178 | $ hg -R other debugobsolete |
|
174 | 179 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
175 | 180 | 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
176 | 181 | 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
177 | 182 | |
|
178 | 183 | pull over ssh |
|
179 | 184 | |
|
180 | 185 | $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --bookmark book_02de |
|
181 | 186 | pulling from ssh://user@dummy/main |
|
182 | 187 | searching for changes |
|
183 | 188 | adding changesets |
|
184 | 189 | adding manifests |
|
185 | 190 | adding file changes |
|
186 | 191 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
187 | 192 | 1 new obsolescence markers |
|
188 | 193 | updating bookmark book_02de |
|
194 | changegroup hook: HG_NEW_OBSMARKERS=1 HG_SOURCE=bundle2 HG_URL=bundle2 | |
|
189 | 195 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
190 | 196 | $ hg -R other debugobsolete |
|
191 | 197 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
192 | 198 | 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
193 | 199 | 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
194 | 200 | 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
195 | 201 | |
|
196 | 202 | pull over http |
|
197 | 203 | |
|
198 | 204 | $ hg -R main serve -p $HGPORT -d --pid-file=main.pid -E main-error.log |
|
199 | 205 | $ cat main.pid >> $DAEMON_PIDS |
|
200 | 206 | |
|
201 | 207 | $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc |
|
202 | 208 | pulling from http://localhost:$HGPORT/ |
|
203 | 209 | searching for changes |
|
204 | 210 | adding changesets |
|
205 | 211 | adding manifests |
|
206 | 212 | adding file changes |
|
207 | 213 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
208 | 214 | 1 new obsolescence markers |
|
209 | 215 | updating bookmark book_42cc |
|
216 | changegroup hook: HG_NEW_OBSMARKERS=1 HG_SOURCE=bundle2 HG_URL=bundle2 | |
|
210 | 217 | (run 'hg heads .' to see heads, 'hg merge' to merge) |
|
211 | 218 | $ cat main-error.log |
|
212 | 219 | $ hg -R other debugobsolete |
|
213 | 220 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
214 | 221 | 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
215 | 222 | 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
216 | 223 | 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
217 | 224 | 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
218 | 225 | |
|
219 | 226 | push over ssh |
|
220 | 227 | |
|
221 | 228 | $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8 --bookmark book_5fdd |
|
222 | 229 | pushing to ssh://user@dummy/other |
|
223 | 230 | searching for changes |
|
224 | 231 | remote: adding changesets |
|
225 | 232 | remote: adding manifests |
|
226 | 233 | remote: adding file changes |
|
227 | 234 | remote: added 1 changesets with 1 changes to 1 files |
|
228 | 235 | remote: 1 new obsolescence markers |
|
229 | 236 | updating bookmark book_5fdd |
|
230 | 237 | remote: b2x-transactionclose hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1 |
|
238 | remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_SOURCE=bundle2 HG_URL=bundle2 | |
|
231 | 239 | $ hg -R other log -G |
|
232 | 240 | o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C |
|
233 | 241 | | |
|
234 | 242 | o 5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B |
|
235 | 243 | | |
|
236 | 244 | | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H |
|
237 | 245 | | | |
|
238 | 246 | | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G |
|
239 | 247 | | |/| |
|
240 | 248 | | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
241 | 249 | |/ / |
|
242 | 250 | | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
243 | 251 | |/ |
|
244 | 252 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af A |
|
245 | 253 | |
|
246 | 254 | $ hg -R other debugobsolete |
|
247 | 255 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
248 | 256 | 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
249 | 257 | 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
250 | 258 | 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
251 | 259 | 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
252 | 260 | 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
253 | 261 | |
|
254 | 262 | push over http |
|
255 | 263 | |
|
256 | 264 | $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log |
|
257 | 265 | $ cat other.pid >> $DAEMON_PIDS |
|
258 | 266 | |
|
259 | 267 | $ hg -R main phase --public 32af7686d403 |
|
260 | 268 | $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 --bookmark book_32af |
|
261 | 269 | pushing to http://localhost:$HGPORT2/ |
|
262 | 270 | searching for changes |
|
263 | 271 | remote: adding changesets |
|
264 | 272 | remote: adding manifests |
|
265 | 273 | remote: adding file changes |
|
266 | 274 | remote: added 1 changesets with 1 changes to 1 files |
|
267 | 275 | remote: 1 new obsolescence markers |
|
268 | 276 | updating bookmark book_32af |
|
269 | 277 | $ cat other-error.log |
|
270 | 278 | |
|
271 | 279 | Check final content. |
|
272 | 280 | |
|
273 | 281 | $ hg -R other log -G |
|
274 | 282 | o 7:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af D |
|
275 | 283 | | |
|
276 | 284 | o 6:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C |
|
277 | 285 | | |
|
278 | 286 | o 5:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B |
|
279 | 287 | | |
|
280 | 288 | | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H |
|
281 | 289 | | | |
|
282 | 290 | | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G |
|
283 | 291 | | |/| |
|
284 | 292 | | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
285 | 293 | |/ / |
|
286 | 294 | | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
287 | 295 | |/ |
|
288 | 296 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
289 | 297 | |
|
290 | 298 | $ hg -R other debugobsolete |
|
291 | 299 | 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
292 | 300 | 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
293 | 301 | 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
294 | 302 | 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
295 | 303 | 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
296 | 304 | 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
297 | 305 | 7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
298 | 306 | |
|
299 | 307 | Error Handling |
|
300 | 308 | ============== |
|
301 | 309 | |
|
302 | 310 | Check that errors are properly returned to the client during push. |
|
303 | 311 | |
|
304 | 312 | Setting up |
|
305 | 313 | |
|
306 | 314 | $ cat > failpush.py << EOF |
|
307 | 315 | > """A small extension that makes push fails when using bundle2 |
|
308 | 316 | > |
|
309 | 317 | > used to test error handling in bundle2 |
|
310 | 318 | > """ |
|
311 | 319 | > |
|
312 | 320 | > from mercurial import util |
|
313 | 321 | > from mercurial import bundle2 |
|
314 | 322 | > from mercurial import exchange |
|
315 | 323 | > from mercurial import extensions |
|
316 | 324 | > |
|
317 | 325 | > def _pushbundle2failpart(pushop, bundler): |
|
318 | 326 | > reason = pushop.ui.config('failpush', 'reason', None) |
|
319 | 327 | > part = None |
|
320 | 328 | > if reason == 'abort': |
|
321 | 329 | > bundler.newpart('test:abort') |
|
322 | 330 | > if reason == 'unknown': |
|
323 | 331 | > bundler.newpart('TEST:UNKNOWN') |
|
324 | 332 | > if reason == 'race': |
|
325 | 333 | > # 20 Bytes of crap |
|
326 | 334 | > bundler.newpart('b2x:check:heads', data='01234567890123456789') |
|
327 | 335 | > |
|
328 | 336 | > @bundle2.parthandler("test:abort") |
|
329 | 337 | > def handleabort(op, part): |
|
330 | 338 | > raise util.Abort('Abandon ship!', hint="don't panic") |
|
331 | 339 | > |
|
332 | 340 | > def uisetup(ui): |
|
333 | 341 | > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart |
|
334 | 342 | > exchange.b2partsgenorder.insert(0, 'failpart') |
|
335 | 343 | > |
|
336 | 344 | > EOF |
|
337 | 345 | |
|
338 | 346 | $ cd main |
|
339 | 347 | $ hg up tip |
|
340 | 348 | 3 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
341 | 349 | $ echo 'I' > I |
|
342 | 350 | $ hg add I |
|
343 | 351 | $ hg ci -m 'I' |
|
344 | 352 | $ hg id |
|
345 | 353 | e7ec4e813ba6 tip |
|
346 | 354 | $ cd .. |
|
347 | 355 | |
|
348 | 356 | $ cat << EOF >> $HGRCPATH |
|
349 | 357 | > [extensions] |
|
350 | 358 | > failpush=$TESTTMP/failpush.py |
|
351 | 359 | > EOF |
|
352 | 360 | |
|
353 | 361 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
354 | 362 | $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log |
|
355 | 363 | $ cat other.pid >> $DAEMON_PIDS |
|
356 | 364 | |
|
357 | 365 | Doing the actual push: Abort error |
|
358 | 366 | |
|
359 | 367 | $ cat << EOF >> $HGRCPATH |
|
360 | 368 | > [failpush] |
|
361 | 369 | > reason = abort |
|
362 | 370 | > EOF |
|
363 | 371 | |
|
364 | 372 | $ hg -R main push other -r e7ec4e813ba6 |
|
365 | 373 | pushing to other |
|
366 | 374 | searching for changes |
|
367 | 375 | abort: Abandon ship! |
|
368 | 376 | (don't panic) |
|
369 | 377 | [255] |
|
370 | 378 | |
|
371 | 379 | $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
372 | 380 | pushing to ssh://user@dummy/other |
|
373 | 381 | searching for changes |
|
374 | 382 | abort: Abandon ship! |
|
375 | 383 | (don't panic) |
|
376 | 384 | [255] |
|
377 | 385 | |
|
378 | 386 | $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 |
|
379 | 387 | pushing to http://localhost:$HGPORT2/ |
|
380 | 388 | searching for changes |
|
381 | 389 | abort: Abandon ship! |
|
382 | 390 | (don't panic) |
|
383 | 391 | [255] |
|
384 | 392 | |
|
385 | 393 | |
|
386 | 394 | Doing the actual push: unknown mandatory parts |
|
387 | 395 | |
|
388 | 396 | $ cat << EOF >> $HGRCPATH |
|
389 | 397 | > [failpush] |
|
390 | 398 | > reason = unknown |
|
391 | 399 | > EOF |
|
392 | 400 | |
|
393 | 401 | $ hg -R main push other -r e7ec4e813ba6 |
|
394 | 402 | pushing to other |
|
395 | 403 | searching for changes |
|
396 | 404 | abort: missing support for test:unknown |
|
397 | 405 | [255] |
|
398 | 406 | |
|
399 | 407 | $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
400 | 408 | pushing to ssh://user@dummy/other |
|
401 | 409 | searching for changes |
|
402 | 410 | abort: missing support for test:unknown |
|
403 | 411 | [255] |
|
404 | 412 | |
|
405 | 413 | $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 |
|
406 | 414 | pushing to http://localhost:$HGPORT2/ |
|
407 | 415 | searching for changes |
|
408 | 416 | abort: missing support for test:unknown |
|
409 | 417 | [255] |
|
410 | 418 | |
|
411 | 419 | Doing the actual push: race |
|
412 | 420 | |
|
413 | 421 | $ cat << EOF >> $HGRCPATH |
|
414 | 422 | > [failpush] |
|
415 | 423 | > reason = race |
|
416 | 424 | > EOF |
|
417 | 425 | |
|
418 | 426 | $ hg -R main push other -r e7ec4e813ba6 |
|
419 | 427 | pushing to other |
|
420 | 428 | searching for changes |
|
421 | 429 | abort: push failed: |
|
422 | 430 | 'repository changed while pushing - please try again' |
|
423 | 431 | [255] |
|
424 | 432 | |
|
425 | 433 | $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
426 | 434 | pushing to ssh://user@dummy/other |
|
427 | 435 | searching for changes |
|
428 | 436 | abort: push failed: |
|
429 | 437 | 'repository changed while pushing - please try again' |
|
430 | 438 | [255] |
|
431 | 439 | |
|
432 | 440 | $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 |
|
433 | 441 | pushing to http://localhost:$HGPORT2/ |
|
434 | 442 | searching for changes |
|
435 | 443 | abort: push failed: |
|
436 | 444 | 'repository changed while pushing - please try again' |
|
437 | 445 | [255] |
|
438 | 446 | |
|
439 | 447 | Doing the actual push: hook abort |
|
440 | 448 | |
|
441 | 449 | $ cat << EOF >> $HGRCPATH |
|
442 | 450 | > [failpush] |
|
443 | 451 | > reason = |
|
444 | 452 | > [hooks] |
|
445 | 453 | > b2x-pretransactionclose.failpush = false |
|
446 | 454 | > EOF |
|
447 | 455 | |
|
448 | 456 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
449 | 457 | $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log |
|
450 | 458 | $ cat other.pid >> $DAEMON_PIDS |
|
451 | 459 | |
|
452 | 460 | $ hg -R main push other -r e7ec4e813ba6 |
|
453 | 461 | pushing to other |
|
454 | 462 | searching for changes |
|
455 | 463 | transaction abort! |
|
456 | 464 | rollback completed |
|
465 | changegroup hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=0 HG_SOURCE=bundle2 HG_URL=bundle2 | |
|
457 | 466 | abort: b2x-pretransactionclose.failpush hook exited with status 1 |
|
458 | 467 | [255] |
|
459 | 468 | |
|
460 | 469 | $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 |
|
461 | 470 | pushing to ssh://user@dummy/other |
|
462 | 471 | searching for changes |
|
463 | 472 | abort: b2x-pretransactionclose.failpush hook exited with status 1 |
|
464 | 473 | remote: transaction abort! |
|
465 | 474 | remote: rollback completed |
|
475 | remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=0 HG_SOURCE=bundle2 HG_URL=bundle2 | |
|
466 | 476 | [255] |
|
467 | 477 | |
|
468 | 478 | $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 |
|
469 | 479 | pushing to http://localhost:$HGPORT2/ |
|
470 | 480 | searching for changes |
|
471 | 481 | abort: b2x-pretransactionclose.failpush hook exited with status 1 |
|
472 | 482 | [255] |
|
473 | 483 | |
|
474 | 484 |
General Comments 0
You need to be logged in to leave comments.
Login now