Mercurial > hg
comparison tests/test-infinitepush-bundlestore.t @ 37187:03ff17a4bf53
infinitepush: move the extension to core from fb-hgext
This patch moves the infinitepush extension from fb-hgext to core. The
extension is used to store incoming bundles during a push in bundlestore rather
than applying them to the revlog.
The extension was copied from the repository revision at
f27f094e91553d3cae5167c0b1c42ae940f888d5 and following changes were made:
* added `from __future__ import absolute_import` where missing
* fixed module imports to follow the core style
* minor fixes for test-check-code.t
* registered the configs
* adding the testedwith value to match core's convention
* removed double newlines to make test-check-commit.t happy
* added one line doc about extension and marked it as experimental
Only one test file test-infinitepush-bundlestore.t is moved to core and
following changes are made to file:
* remove dependency of library.sh
* split the tests into two tests i.e. test-infinitepush.t and
test-infinitepush-bundlestore.t
* removed testing related to other facebook's extensions pushrebase, inhibit,
fbamend
library-infinitepush.sh is also copied from fb-hgext from the same revision and
following changes are made:
* change the path to infinitepush extension as it's in core with this patch
* removed sql handling from the file as we are not testing that initially
Currently at this revision, test-check-module-imports.t does not pass as there
is import of a module from fb/hgext in one the of the file which will be removed
in the next patch.
This extension right now has a lot of things which we don't require in core like
`--to`, `--create` flags to `hg bookmark`, logic related to remotenames
extension and another facebook's extensions, custom bundle2parts which can be
prevented by using bookmarks bundle part and also logic related to sql store
which is probably we don't want initially.
The next patches in this series will remove all the unwanted and unrequired
things from the extension and will make this a nice one.
The end goal is to have a very lighweight extension with no or very less
wrapping on the client side.
Differential Revision: https://phab.mercurial-scm.org/D2096
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 09 Feb 2018 13:39:15 +0530 |
parents | |
children | 320b1f95f676 |
comparison
equal
deleted
inserted
replaced
37186:6d43b39fbaa0 | 37187:03ff17a4bf53 |
---|---|
1 | |
2 Create an ondisk bundlestore in .hg/scratchbranches | |
3 $ . "$TESTDIR/library-infinitepush.sh" | |
4 $ cp $HGRCPATH $TESTTMP/defaulthgrc | |
5 $ setupcommon | |
6 $ mkcommit() { | |
7 > echo "$1" > "$1" | |
8 > hg add "$1" | |
9 > hg ci -m "$1" | |
10 > } | |
11 $ hg init repo | |
12 $ cd repo | |
13 | |
14 Check that we can send a scratch on the server and it does not show there in | |
15 the history but is stored on disk | |
16 $ setupserver | |
17 $ cd .. | |
18 $ hg clone ssh://user@dummy/repo client -q | |
19 $ cd client | |
20 $ mkcommit initialcommit | |
21 $ hg push -r . --create | |
22 pushing to ssh://user@dummy/repo | |
23 searching for changes | |
24 remote: adding changesets | |
25 remote: adding manifests | |
26 remote: adding file changes | |
27 remote: added 1 changesets with 1 changes to 1 files | |
28 $ mkcommit scratchcommit | |
29 $ hg push -r . --to scratch/mybranch --create | |
30 pushing to ssh://user@dummy/repo | |
31 searching for changes | |
32 remote: pushing 1 commit: | |
33 remote: 20759b6926ce scratchcommit | |
34 $ hg log -G | |
35 @ changeset: 1:20759b6926ce | |
36 | bookmark: scratch/mybranch | |
37 | tag: tip | |
38 | user: test | |
39 | date: Thu Jan 01 00:00:00 1970 +0000 | |
40 | summary: scratchcommit | |
41 | | |
42 o changeset: 0:67145f466344 | |
43 user: test | |
44 date: Thu Jan 01 00:00:00 1970 +0000 | |
45 summary: initialcommit | |
46 | |
47 $ hg log -G -R ../repo | |
48 o changeset: 0:67145f466344 | |
49 tag: tip | |
50 user: test | |
51 date: Thu Jan 01 00:00:00 1970 +0000 | |
52 summary: initialcommit | |
53 | |
54 $ find ../repo/.hg/scratchbranches | sort | |
55 ../repo/.hg/scratchbranches | |
56 ../repo/.hg/scratchbranches/filebundlestore | |
57 ../repo/.hg/scratchbranches/filebundlestore/b9 | |
58 ../repo/.hg/scratchbranches/filebundlestore/b9/e1 | |
59 ../repo/.hg/scratchbranches/filebundlestore/b9/e1/b9e1ee5f93fb6d7c42496fc176c09839639dd9cc | |
60 ../repo/.hg/scratchbranches/index | |
61 ../repo/.hg/scratchbranches/index/bookmarkmap | |
62 ../repo/.hg/scratchbranches/index/bookmarkmap/scratch | |
63 ../repo/.hg/scratchbranches/index/bookmarkmap/scratch/mybranch | |
64 ../repo/.hg/scratchbranches/index/nodemap | |
65 ../repo/.hg/scratchbranches/index/nodemap/20759b6926ce827d5a8c73eb1fa9726d6f7defb2 | |
66 | |
67 From another client we can get the scratchbranch if we ask for it explicitely | |
68 | |
69 $ cd .. | |
70 $ hg clone ssh://user@dummy/repo client2 -q | |
71 $ cd client2 | |
72 $ hg pull -B scratch/mybranch --traceback | |
73 pulling from ssh://user@dummy/repo | |
74 searching for changes | |
75 adding changesets | |
76 adding manifests | |
77 adding file changes | |
78 added 1 changesets with 1 changes to 1 files | |
79 new changesets 20759b6926ce | |
80 (run 'hg update' to get a working copy) | |
81 $ hg log -G | |
82 o changeset: 1:20759b6926ce | |
83 | bookmark: scratch/mybranch | |
84 | tag: tip | |
85 | user: test | |
86 | date: Thu Jan 01 00:00:00 1970 +0000 | |
87 | summary: scratchcommit | |
88 | | |
89 @ changeset: 0:67145f466344 | |
90 user: test | |
91 date: Thu Jan 01 00:00:00 1970 +0000 | |
92 summary: initialcommit | |
93 | |
94 $ cd .. | |
95 | |
96 Push to non-scratch bookmark | |
97 | |
98 $ cd client | |
99 $ hg up 0 | |
100 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
101 $ mkcommit newcommit | |
102 created new head | |
103 $ hg push -r . | |
104 pushing to ssh://user@dummy/repo | |
105 searching for changes | |
106 remote: adding changesets | |
107 remote: adding manifests | |
108 remote: adding file changes | |
109 remote: added 1 changesets with 1 changes to 1 files | |
110 $ hg log -G -T '{desc} {phase} {bookmarks}' | |
111 @ newcommit public | |
112 | | |
113 | o scratchcommit draft scratch/mybranch | |
114 |/ | |
115 o initialcommit public | |
116 | |
117 | |
118 Push to scratch branch | |
119 $ cd ../client2 | |
120 $ hg up -q scratch/mybranch | |
121 $ mkcommit 'new scratch commit' | |
122 $ hg push -r . --to scratch/mybranch | |
123 pushing to ssh://user@dummy/repo | |
124 searching for changes | |
125 remote: pushing 2 commits: | |
126 remote: 20759b6926ce scratchcommit | |
127 remote: 1de1d7d92f89 new scratch commit | |
128 $ hg log -G -T '{desc} {phase} {bookmarks}' | |
129 @ new scratch commit draft scratch/mybranch | |
130 | | |
131 o scratchcommit draft | |
132 | | |
133 o initialcommit public | |
134 | |
135 $ scratchnodes | |
136 1de1d7d92f8965260391d0513fe8a8d5973d3042 bed63daed3beba97fff2e819a148cf415c217a85 | |
137 20759b6926ce827d5a8c73eb1fa9726d6f7defb2 bed63daed3beba97fff2e819a148cf415c217a85 | |
138 | |
139 $ scratchbookmarks | |
140 scratch/mybranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 | |
141 | |
142 Push scratch bookmark with no new revs | |
143 $ hg push -r . --to scratch/anotherbranch --create | |
144 pushing to ssh://user@dummy/repo | |
145 searching for changes | |
146 remote: pushing 2 commits: | |
147 remote: 20759b6926ce scratchcommit | |
148 remote: 1de1d7d92f89 new scratch commit | |
149 $ hg log -G -T '{desc} {phase} {bookmarks}' | |
150 @ new scratch commit draft scratch/anotherbranch scratch/mybranch | |
151 | | |
152 o scratchcommit draft | |
153 | | |
154 o initialcommit public | |
155 | |
156 $ scratchbookmarks | |
157 scratch/anotherbranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 | |
158 scratch/mybranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 | |
159 | |
160 Pull scratch and non-scratch bookmark at the same time | |
161 | |
162 $ hg -R ../repo book newbook | |
163 $ cd ../client | |
164 $ hg pull -B newbook -B scratch/mybranch --traceback | |
165 pulling from ssh://user@dummy/repo | |
166 searching for changes | |
167 adding changesets | |
168 adding manifests | |
169 adding file changes | |
170 added 1 changesets with 1 changes to 2 files | |
171 adding remote bookmark newbook | |
172 new changesets 1de1d7d92f89 | |
173 (run 'hg update' to get a working copy) | |
174 $ hg log -G -T '{desc} {phase} {bookmarks}' | |
175 o new scratch commit draft scratch/mybranch | |
176 | | |
177 | @ newcommit public | |
178 | | | |
179 o | scratchcommit draft | |
180 |/ | |
181 o initialcommit public | |
182 | |
183 | |
184 Push scratch revision without bookmark with --bundle-store | |
185 | |
186 $ hg up -q tip | |
187 $ mkcommit scratchcommitnobook | |
188 $ hg log -G -T '{desc} {phase} {bookmarks}' | |
189 @ scratchcommitnobook draft | |
190 | | |
191 o new scratch commit draft scratch/mybranch | |
192 | | |
193 | o newcommit public | |
194 | | | |
195 o | scratchcommit draft | |
196 |/ | |
197 o initialcommit public | |
198 | |
199 $ hg push -r . --bundle-store | |
200 pushing to ssh://user@dummy/repo | |
201 searching for changes | |
202 remote: pushing 3 commits: | |
203 remote: 20759b6926ce scratchcommit | |
204 remote: 1de1d7d92f89 new scratch commit | |
205 remote: 2b5d271c7e0d scratchcommitnobook | |
206 $ hg -R ../repo log -G -T '{desc} {phase}' | |
207 o newcommit public | |
208 | | |
209 o initialcommit public | |
210 | |
211 | |
212 $ scratchnodes | |
213 1de1d7d92f8965260391d0513fe8a8d5973d3042 66fa08ff107451320512817bed42b7f467a1bec3 | |
214 20759b6926ce827d5a8c73eb1fa9726d6f7defb2 66fa08ff107451320512817bed42b7f467a1bec3 | |
215 2b5d271c7e0d25d811359a314d413ebcc75c9524 66fa08ff107451320512817bed42b7f467a1bec3 | |
216 | |
217 Test with pushrebase | |
218 $ mkcommit scratchcommitwithpushrebase | |
219 $ hg push -r . --to scratch/mybranch | |
220 pushing to ssh://user@dummy/repo | |
221 searching for changes | |
222 remote: pushing 4 commits: | |
223 remote: 20759b6926ce scratchcommit | |
224 remote: 1de1d7d92f89 new scratch commit | |
225 remote: 2b5d271c7e0d scratchcommitnobook | |
226 remote: d8c4f54ab678 scratchcommitwithpushrebase | |
227 $ hg -R ../repo log -G -T '{desc} {phase}' | |
228 o newcommit public | |
229 | | |
230 o initialcommit public | |
231 | |
232 $ scratchnodes | |
233 1de1d7d92f8965260391d0513fe8a8d5973d3042 e3cb2ac50f9e1e6a5ead3217fc21236c84af4397 | |
234 20759b6926ce827d5a8c73eb1fa9726d6f7defb2 e3cb2ac50f9e1e6a5ead3217fc21236c84af4397 | |
235 2b5d271c7e0d25d811359a314d413ebcc75c9524 e3cb2ac50f9e1e6a5ead3217fc21236c84af4397 | |
236 d8c4f54ab678fd67cb90bb3f272a2dc6513a59a7 e3cb2ac50f9e1e6a5ead3217fc21236c84af4397 | |
237 | |
238 Change the order of pushrebase and infinitepush | |
239 $ mkcommit scratchcommitwithpushrebase2 | |
240 $ hg push -r . --to scratch/mybranch | |
241 pushing to ssh://user@dummy/repo | |
242 searching for changes | |
243 remote: pushing 5 commits: | |
244 remote: 20759b6926ce scratchcommit | |
245 remote: 1de1d7d92f89 new scratch commit | |
246 remote: 2b5d271c7e0d scratchcommitnobook | |
247 remote: d8c4f54ab678 scratchcommitwithpushrebase | |
248 remote: 6c10d49fe927 scratchcommitwithpushrebase2 | |
249 $ hg -R ../repo log -G -T '{desc} {phase}' | |
250 o newcommit public | |
251 | | |
252 o initialcommit public | |
253 | |
254 $ scratchnodes | |
255 1de1d7d92f8965260391d0513fe8a8d5973d3042 cd0586065eaf8b483698518f5fc32531e36fd8e0 | |
256 20759b6926ce827d5a8c73eb1fa9726d6f7defb2 cd0586065eaf8b483698518f5fc32531e36fd8e0 | |
257 2b5d271c7e0d25d811359a314d413ebcc75c9524 cd0586065eaf8b483698518f5fc32531e36fd8e0 | |
258 6c10d49fe92751666c40263f96721b918170d3da cd0586065eaf8b483698518f5fc32531e36fd8e0 | |
259 d8c4f54ab678fd67cb90bb3f272a2dc6513a59a7 cd0586065eaf8b483698518f5fc32531e36fd8e0 | |
260 | |
261 Non-fastforward scratch bookmark push | |
262 | |
263 $ hg log -GT "{rev}:{node} {desc}\n" | |
264 @ 6:6c10d49fe92751666c40263f96721b918170d3da scratchcommitwithpushrebase2 | |
265 | | |
266 o 5:d8c4f54ab678fd67cb90bb3f272a2dc6513a59a7 scratchcommitwithpushrebase | |
267 | | |
268 o 4:2b5d271c7e0d25d811359a314d413ebcc75c9524 scratchcommitnobook | |
269 | | |
270 o 3:1de1d7d92f8965260391d0513fe8a8d5973d3042 new scratch commit | |
271 | | |
272 | o 2:91894e11e8255bf41aa5434b7b98e8b2aa2786eb newcommit | |
273 | | | |
274 o | 1:20759b6926ce827d5a8c73eb1fa9726d6f7defb2 scratchcommit | |
275 |/ | |
276 o 0:67145f4663446a9580364f70034fea6e21293b6f initialcommit | |
277 | |
278 $ hg up 6c10d49fe927 | |
279 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
280 $ echo 1 > amend | |
281 $ hg add amend | |
282 $ hg ci --amend -m 'scratch amended commit' | |
283 saved backup bundle to $TESTTMP/client/.hg/strip-backup/6c10d49fe927-c99ffec5-amend.hg (glob) | |
284 $ hg log -G -T '{desc} {phase} {bookmarks}' | |
285 @ scratch amended commit draft scratch/mybranch | |
286 | | |
287 o scratchcommitwithpushrebase draft | |
288 | | |
289 o scratchcommitnobook draft | |
290 | | |
291 o new scratch commit draft | |
292 | | |
293 | o newcommit public | |
294 | | | |
295 o | scratchcommit draft | |
296 |/ | |
297 o initialcommit public | |
298 | |
299 | |
300 $ scratchbookmarks | |
301 scratch/anotherbranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 | |
302 scratch/mybranch 6c10d49fe92751666c40263f96721b918170d3da | |
303 $ hg push -r . --to scratch/mybranch | |
304 pushing to ssh://user@dummy/repo | |
305 searching for changes | |
306 remote: non-forward push | |
307 remote: (use --non-forward-move to override) | |
308 abort: push failed on remote | |
309 [255] | |
310 | |
311 $ hg push -r . --to scratch/mybranch --non-forward-move | |
312 pushing to ssh://user@dummy/repo | |
313 searching for changes | |
314 remote: pushing 5 commits: | |
315 remote: 20759b6926ce scratchcommit | |
316 remote: 1de1d7d92f89 new scratch commit | |
317 remote: 2b5d271c7e0d scratchcommitnobook | |
318 remote: d8c4f54ab678 scratchcommitwithpushrebase | |
319 remote: 8872775dd97a scratch amended commit | |
320 $ scratchbookmarks | |
321 scratch/anotherbranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 | |
322 scratch/mybranch 8872775dd97a750e1533dc1fbbca665644b32547 | |
323 $ hg log -G -T '{desc} {phase} {bookmarks}' | |
324 @ scratch amended commit draft scratch/mybranch | |
325 | | |
326 o scratchcommitwithpushrebase draft | |
327 | | |
328 o scratchcommitnobook draft | |
329 | | |
330 o new scratch commit draft | |
331 | | |
332 | o newcommit public | |
333 | | | |
334 o | scratchcommit draft | |
335 |/ | |
336 o initialcommit public | |
337 | |
338 Check that push path is not ignored. Add new path to the hgrc | |
339 $ cat >> .hg/hgrc << EOF | |
340 > [paths] | |
341 > peer=ssh://user@dummy/client2 | |
342 > EOF | |
343 | |
344 Checkout last non-scrath commit | |
345 $ hg up 91894e11e8255 | |
346 1 files updated, 0 files merged, 6 files removed, 0 files unresolved | |
347 $ mkcommit peercommit | |
348 Use --force because this push creates new head | |
349 $ hg push peer -r . -f | |
350 pushing to ssh://user@dummy/client2 | |
351 searching for changes | |
352 remote: adding changesets | |
353 remote: adding manifests | |
354 remote: adding file changes | |
355 remote: added 2 changesets with 2 changes to 2 files (+1 heads) | |
356 $ hg -R ../repo log -G -T '{desc} {phase} {bookmarks}' | |
357 o newcommit public | |
358 | | |
359 o initialcommit public | |
360 | |
361 $ hg -R ../client2 log -G -T '{desc} {phase} {bookmarks}' | |
362 o peercommit public | |
363 | | |
364 o newcommit public | |
365 | | |
366 | @ new scratch commit draft scratch/anotherbranch scratch/mybranch | |
367 | | | |
368 | o scratchcommit draft | |
369 |/ | |
370 o initialcommit public | |
371 | |
372 $ hg book --list-remote scratch/* | |
373 scratch/anotherbranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 | |
374 scratch/mybranch 8872775dd97a750e1533dc1fbbca665644b32547 | |
375 $ hg book --list-remote | |
376 abort: --list-remote requires a bookmark pattern | |
377 (use "hg book" to get a list of your local bookmarks) | |
378 [255] | |
379 $ hg book --config infinitepush.defaultremotepatterns=scratch/another* --list-remote | |
380 abort: --list-remote requires a bookmark pattern | |
381 (use "hg book" to get a list of your local bookmarks) | |
382 [255] | |
383 $ hg book --list-remote scratch/my | |
384 $ hg book --list-remote scratch/my* | |
385 scratch/mybranch 8872775dd97a750e1533dc1fbbca665644b32547 | |
386 $ hg book --list-remote scratch/my* -T json | |
387 [ | |
388 { | |
389 "bookmark": "scratch/mybranch", | |
390 "node": "8872775dd97a750e1533dc1fbbca665644b32547" | |
391 } | |
392 ] | |
393 $ cd ../repo | |
394 $ hg book scratch/serversidebook | |
395 $ hg book serversidebook | |
396 $ cd ../client | |
397 $ hg book --list-remote scratch/* -T json | |
398 [ | |
399 { | |
400 "bookmark": "scratch/anotherbranch", | |
401 "node": "1de1d7d92f8965260391d0513fe8a8d5973d3042" | |
402 }, | |
403 { | |
404 "bookmark": "scratch/mybranch", | |
405 "node": "8872775dd97a750e1533dc1fbbca665644b32547" | |
406 }, | |
407 { | |
408 "bookmark": "scratch/serversidebook", | |
409 "node": "0000000000000000000000000000000000000000" | |
410 } | |
411 ] | |
412 | |
413 Push to svn server should fail | |
414 $ hg push svn+ssh://svn.vip.facebook.com/svnroot/tfb/trunk/www -r . --to scratch/serversidebook | |
415 abort: infinite push does not work with svn repo | |
416 (did you forget to `hg push default`?) | |
417 [255] |