Show More
@@ -1660,6 +1660,12 Controls generic server settings. | |||||
1660 | When set, clients will try to use the uncompressed streaming |
|
1660 | When set, clients will try to use the uncompressed streaming | |
1661 | protocol. (default: False) |
|
1661 | protocol. (default: False) | |
1662 |
|
1662 | |||
|
1663 | ``disablefullbundle`` | |||
|
1664 | When set, servers will refuse attempts to do pull-based clones. | |||
|
1665 | If this option is set, ``preferuncompressed`` and/or clone bundles | |||
|
1666 | are highly recommended. Partial clones will still be allowed. | |||
|
1667 | (default: False) | |||
|
1668 | ||||
1663 | ``validate`` |
|
1669 | ``validate`` | |
1664 | Whether to validate the completeness of pushed changesets by |
|
1670 | Whether to validate the completeness of pushed changesets by | |
1665 | checking that all new file revisions specified in manifests are |
|
1671 | checking that all new file revisions specified in manifests are |
@@ -16,6 +16,7 from .i18n import _ | |||||
16 | from .node import ( |
|
16 | from .node import ( | |
17 | bin, |
|
17 | bin, | |
18 | hex, |
|
18 | hex, | |
|
19 | nullid, | |||
19 | ) |
|
20 | ) | |
20 |
|
21 | |||
21 | from . import ( |
|
22 | from . import ( | |
@@ -841,6 +842,17 def getbundle(repo, proto, others): | |||||
841 | hint=bundle2requiredhint) |
|
842 | hint=bundle2requiredhint) | |
842 |
|
843 | |||
843 | try: |
|
844 | try: | |
|
845 | if repo.ui.configbool('server', 'disablefullbundle', False): | |||
|
846 | # Check to see if this is a full clone. | |||
|
847 | clheads = set(repo.changelog.heads()) | |||
|
848 | heads = set(opts.get('heads', set())) | |||
|
849 | common = set(opts.get('common', set())) | |||
|
850 | common.discard(nullid) | |||
|
851 | if not common and clheads == heads: | |||
|
852 | raise error.Abort( | |||
|
853 | _('server has pull-based clones disabled'), | |||
|
854 | hint=_('remove --pull if specified or upgrade Mercurial')) | |||
|
855 | ||||
844 | chunks = exchange.getbundlechunks(repo, 'serve', **opts) |
|
856 | chunks = exchange.getbundlechunks(repo, 'serve', **opts) | |
845 | except error.Abort as exc: |
|
857 | except error.Abort as exc: | |
846 | # cleanly forward Abort error to the client |
|
858 | # cleanly forward Abort error to the client |
@@ -365,3 +365,41 Check error reporting while pulling/clon | |||||
365 | this is an exercise |
|
365 | this is an exercise | |
366 | [255] |
|
366 | [255] | |
367 | $ cat error.log |
|
367 | $ cat error.log | |
|
368 | ||||
|
369 | disable pull-based clones | |||
|
370 | ||||
|
371 | $ hg -R test serve -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True | |||
|
372 | $ cat hg4.pid >> $DAEMON_PIDS | |||
|
373 | $ hg clone http://localhost:$HGPORT1/ disable-pull-clone | |||
|
374 | requesting all changes | |||
|
375 | abort: remote error: | |||
|
376 | server has pull-based clones disabled | |||
|
377 | [255] | |||
|
378 | ||||
|
379 | ... but keep stream clones working | |||
|
380 | ||||
|
381 | $ hg clone --uncompressed --noupdate http://localhost:$HGPORT1/ test-stream-clone | |||
|
382 | streaming all changes | |||
|
383 | * files to transfer, * of data (glob) | |||
|
384 | transferred * in * seconds (* KB/sec) (glob) | |||
|
385 | searching for changes | |||
|
386 | no changes found | |||
|
387 | ||||
|
388 | ... and also keep partial clones and pulls working | |||
|
389 | $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone | |||
|
390 | adding changesets | |||
|
391 | adding manifests | |||
|
392 | adding file changes | |||
|
393 | added 1 changesets with 4 changes to 4 files | |||
|
394 | updating to branch default | |||
|
395 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
396 | $ hg pull -R test-partial-clone | |||
|
397 | pulling from http://localhost:$HGPORT1/ | |||
|
398 | searching for changes | |||
|
399 | adding changesets | |||
|
400 | adding manifests | |||
|
401 | adding file changes | |||
|
402 | added 2 changesets with 3 changes to 3 files | |||
|
403 | (run 'hg update' to get a working copy) | |||
|
404 | ||||
|
405 | $ cat error.log |
@@ -354,6 +354,44 check abort error reporting while pullin | |||||
354 | [255] |
|
354 | [255] | |
355 | $ cat error.log |
|
355 | $ cat error.log | |
356 |
|
356 | |||
|
357 | disable pull-based clones | |||
|
358 | ||||
|
359 | $ hg -R test serve -p $HGPORT1 -d --pid-file=hg4.pid -E error.log --config server.disablefullbundle=True | |||
|
360 | $ cat hg4.pid >> $DAEMON_PIDS | |||
|
361 | $ hg clone http://localhost:$HGPORT1/ disable-pull-clone | |||
|
362 | requesting all changes | |||
|
363 | remote: abort: server has pull-based clones disabled | |||
|
364 | abort: pull failed on remote | |||
|
365 | (remove --pull if specified or upgrade Mercurial) | |||
|
366 | [255] | |||
|
367 | ||||
|
368 | ... but keep stream clones working | |||
|
369 | ||||
|
370 | $ hg clone --uncompressed --noupdate http://localhost:$HGPORT1/ test-stream-clone | |||
|
371 | streaming all changes | |||
|
372 | * files to transfer, * of data (glob) | |||
|
373 | transferred * in * seconds (*/sec) (glob) | |||
|
374 | searching for changes | |||
|
375 | no changes found | |||
|
376 | $ cat error.log | |||
|
377 | ||||
|
378 | ... and also keep partial clones and pulls working | |||
|
379 | $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone | |||
|
380 | adding changesets | |||
|
381 | adding manifests | |||
|
382 | adding file changes | |||
|
383 | added 1 changesets with 4 changes to 4 files | |||
|
384 | updating to branch default | |||
|
385 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
386 | $ hg pull -R test-partial-clone | |||
|
387 | pulling from http://localhost:$HGPORT1/ | |||
|
388 | searching for changes | |||
|
389 | adding changesets | |||
|
390 | adding manifests | |||
|
391 | adding file changes | |||
|
392 | added 2 changesets with 3 changes to 3 files | |||
|
393 | (run 'hg update' to get a working copy) | |||
|
394 | ||||
357 | corrupt cookies file should yield a warning |
|
395 | corrupt cookies file should yield a warning | |
358 |
|
396 | |||
359 | $ cat > $TESTTMP/cookies.txt << EOF |
|
397 | $ cat > $TESTTMP/cookies.txt << EOF |
General Comments 0
You need to be logged in to leave comments.
Login now