Show More
@@ -0,0 +1,39 b'' | |||
|
1 | Tests narrow stream clones | |
|
2 | ||
|
3 | $ . "$TESTDIR/narrow-library.sh" | |
|
4 | ||
|
5 | Server setup | |
|
6 | ||
|
7 | $ hg init master | |
|
8 | $ cd master | |
|
9 | $ mkdir dir | |
|
10 | $ mkdir dir/src | |
|
11 | $ cd dir/src | |
|
12 | $ for x in `$TESTDIR/seq.py 20`; do echo $x > "f$x"; hg add "f$x"; hg commit -m "Commit src $x"; done | |
|
13 | ||
|
14 | $ cd .. | |
|
15 | $ mkdir tests | |
|
16 | $ cd tests | |
|
17 | $ for x in `$TESTDIR/seq.py 20`; do echo $x > "f$x"; hg add "f$x"; hg commit -m "Commit src $x"; done | |
|
18 | $ cd ../../.. | |
|
19 | ||
|
20 | Trying to stream clone when the server does not support it | |
|
21 | ||
|
22 | $ hg clone --narrow ssh://user@dummy/master narrow --noupdate --include "dir/src/f10" --stream | |
|
23 | streaming all changes | |
|
24 | remote: abort: server does not support narrow stream clones | |
|
25 | abort: pull failed on remote | |
|
26 | [255] | |
|
27 | ||
|
28 | Enable stream clone on the server | |
|
29 | ||
|
30 | $ echo "[server]" >> master/.hg/hgrc | |
|
31 | $ echo "stream-narrow-clones=True" >> master/.hg/hgrc | |
|
32 | ||
|
33 | Cloning a specific file when stream clone is supported | |
|
34 | ||
|
35 | $ hg clone --narrow ssh://user@dummy/master narrow --noupdate --include "dir/src/f10" --stream | |
|
36 | streaming all changes | |
|
37 | remote: abort: server does not support narrow stream clones | |
|
38 | abort: pull failed on remote | |
|
39 | [255] |
@@ -1687,7 +1687,18 b' def addpartbundlestream2(bundler, repo, ' | |||
|
1687 | 1687 | # to avoid compression to consumers of the bundle. |
|
1688 | 1688 | bundler.prefercompressed = False |
|
1689 | 1689 | |
|
1690 | filecount, bytecount, it = streamclone.generatev2(repo) | |
|
1690 | # get the includes and excludes | |
|
1691 | includepats = kwargs.get(r'includepats') | |
|
1692 | excludepats = kwargs.get(r'excludepats') | |
|
1693 | ||
|
1694 | narrowstream = repo.ui.configbool('experimental.server', | |
|
1695 | 'stream-narrow-clones') | |
|
1696 | ||
|
1697 | if (includepats or excludepats) and not narrowstream: | |
|
1698 | raise error.Abort(_('server does not support narrow stream clones')) | |
|
1699 | ||
|
1700 | filecount, bytecount, it = streamclone.generatev2(repo, includepats, | |
|
1701 | excludepats) | |
|
1691 | 1702 | requirements = _formatrequirementsspec(repo.requirements) |
|
1692 | 1703 | part = bundler.newpart('stream2', data=it) |
|
1693 | 1704 | part.addparam('bytecount', '%d' % bytecount, mandatory=True) |
@@ -610,6 +610,9 b" coreconfigitem('experimental', 'server.f" | |||
|
610 | 610 | coreconfigitem('experimental', 'server.manifestdata.recommended-batch-size', |
|
611 | 611 | default=100000, |
|
612 | 612 | ) |
|
613 | coreconfigitem('experimental.server', 'stream-narrow-clones', | |
|
614 | default=False, | |
|
615 | ) | |
|
613 | 616 | coreconfigitem('experimental', 'single-head-per-branch', |
|
614 | 617 | default=False, |
|
615 | 618 | ) |
@@ -531,7 +531,7 b' def _emit2(repo, entries, totalfilesize)' | |||
|
531 | 531 | finally: |
|
532 | 532 | fp.close() |
|
533 | 533 | |
|
534 | def generatev2(repo): | |
|
534 | def generatev2(repo, includes, excludes): | |
|
535 | 535 | """Emit content for version 2 of a streaming clone. |
|
536 | 536 | |
|
537 | 537 | the data stream consists the following entries: |
@@ -544,6 +544,10 b' def generatev2(repo):' | |||
|
544 | 544 | Returns a 3-tuple of (file count, file size, data iterator). |
|
545 | 545 | """ |
|
546 | 546 | |
|
547 | # temporarily raise error until we add storage level logic | |
|
548 | if includes or excludes: | |
|
549 | raise error.Abort(_("server does not support narrow stream clones")) | |
|
550 | ||
|
547 | 551 | with repo.lock(): |
|
548 | 552 | |
|
549 | 553 | entries = [] |
General Comments 0
You need to be logged in to leave comments.
Login now