Show More
@@ -24,6 +24,20 b' from . import (' | |||||
24 |
|
24 | |||
25 | parsers = policy.importmod(r'parsers') |
|
25 | parsers = policy.importmod(r'parsers') | |
26 |
|
26 | |||
|
27 | def _matchtrackedpath(path, matcher): | |||
|
28 | """parses a fncache entry and returns whether the entry is tracking a path | |||
|
29 | matched by matcher or not. | |||
|
30 | ||||
|
31 | If matcher is None, returns True""" | |||
|
32 | ||||
|
33 | if matcher is None: | |||
|
34 | return True | |||
|
35 | path = decodedir(path) | |||
|
36 | if path.startswith('data/'): | |||
|
37 | return matcher(path[len('data/'):-len('.i')]) | |||
|
38 | elif path.startswith('meta/'): | |||
|
39 | return matcher.visitdir(path[len('meta/'):-len('/00manifest.i')] or '.') | |||
|
40 | ||||
27 | # This avoids a collision between a file named foo and a dir named |
|
41 | # This avoids a collision between a file named foo and a dir named | |
28 | # foo.i or foo.d |
|
42 | # foo.i or foo.d | |
29 | def _encodedir(path): |
|
43 | def _encodedir(path): | |
@@ -413,6 +427,8 b' class encodedstore(basicstore):' | |||||
413 |
|
427 | |||
414 | def datafiles(self, matcher=None): |
|
428 | def datafiles(self, matcher=None): | |
415 | for a, b, size in super(encodedstore, self).datafiles(): |
|
429 | for a, b, size in super(encodedstore, self).datafiles(): | |
|
430 | if not _matchtrackedpath(a, matcher): | |||
|
431 | continue | |||
416 | try: |
|
432 | try: | |
417 | a = decodefilename(a) |
|
433 | a = decodefilename(a) | |
418 | except KeyError: |
|
434 | except KeyError: | |
@@ -542,6 +558,8 b' class fncachestore(basicstore):' | |||||
542 |
|
558 | |||
543 | def datafiles(self, matcher=None): |
|
559 | def datafiles(self, matcher=None): | |
544 | for f in sorted(self.fncache): |
|
560 | for f in sorted(self.fncache): | |
|
561 | if not _matchtrackedpath(f, matcher): | |||
|
562 | continue | |||
545 | ef = self.encode(f) |
|
563 | ef = self.encode(f) | |
546 | try: |
|
564 | try: | |
547 | yield f, ef, self.getsize(ef) |
|
565 | yield f, ef, self.getsize(ef) |
@@ -545,10 +545,6 b' def generatev2(repo, includes, excludes,' | |||||
545 | Returns a 3-tuple of (file count, file size, data iterator). |
|
545 | Returns a 3-tuple of (file count, file size, data iterator). | |
546 | """ |
|
546 | """ | |
547 |
|
547 | |||
548 | # temporarily raise error until we add storage level logic |
|
|||
549 | if includes or excludes: |
|
|||
550 | raise error.Abort(_("server does not support narrow stream clones")) |
|
|||
551 |
|
||||
552 | with repo.lock(): |
|
548 | with repo.lock(): | |
553 |
|
549 | |||
554 | entries = [] |
|
550 | entries = [] |
@@ -1,7 +1,16 b'' | |||||
|
1 | #testcases tree flat | |||
|
2 | ||||
1 | Tests narrow stream clones |
|
3 | Tests narrow stream clones | |
2 |
|
4 | |||
3 | $ . "$TESTDIR/narrow-library.sh" |
|
5 | $ . "$TESTDIR/narrow-library.sh" | |
4 |
|
6 | |||
|
7 | #if tree | |||
|
8 | $ cat << EOF >> $HGRCPATH | |||
|
9 | > [experimental] | |||
|
10 | > treemanifest = 1 | |||
|
11 | > EOF | |||
|
12 | #endif | |||
|
13 | ||||
5 | Server setup |
|
14 | Server setup | |
6 |
|
15 | |||
7 | $ hg init master |
|
16 | $ hg init master | |
@@ -27,13 +36,51 b' Trying to stream clone when the server d' | |||||
27 |
|
36 | |||
28 | Enable stream clone on the server |
|
37 | Enable stream clone on the server | |
29 |
|
38 | |||
30 | $ echo "[server]" >> master/.hg/hgrc |
|
39 | $ echo "[experimental.server]" >> master/.hg/hgrc | |
31 | $ echo "stream-narrow-clones=True" >> master/.hg/hgrc |
|
40 | $ echo "stream-narrow-clones=True" >> master/.hg/hgrc | |
32 |
|
41 | |||
33 | Cloning a specific file when stream clone is supported |
|
42 | Cloning a specific file when stream clone is supported | |
34 |
|
43 | |||
35 | $ hg clone --narrow ssh://user@dummy/master narrow --noupdate --include "dir/src/f10" --stream |
|
44 | $ hg clone --narrow ssh://user@dummy/master narrow --noupdate --include "dir/src/f10" --stream | |
36 | streaming all changes |
|
45 | streaming all changes | |
37 | remote: abort: server does not support narrow stream clones |
|
46 | * files to transfer, * KB of data (glob) | |
38 | abort: pull failed on remote |
|
47 | transferred * KB in * seconds (* */sec) (glob) | |
39 | [255] |
|
48 | ||
|
49 | $ cd narrow | |||
|
50 | $ ls | |||
|
51 | $ hg tracked | |||
|
52 | I path:dir/src/f10 | |||
|
53 | ||||
|
54 | Making sure we have the correct set of requirements | |||
|
55 | ||||
|
56 | $ cat .hg/requires | |||
|
57 | dotencode | |||
|
58 | fncache | |||
|
59 | generaldelta | |||
|
60 | narrowhg-experimental | |||
|
61 | revlogv1 | |||
|
62 | store | |||
|
63 | treemanifest (tree !) | |||
|
64 | ||||
|
65 | Making sure store has the required files | |||
|
66 | ||||
|
67 | $ ls .hg/store/ | |||
|
68 | 00changelog.i | |||
|
69 | 00manifest.i | |||
|
70 | data | |||
|
71 | fncache | |||
|
72 | meta (tree !) | |||
|
73 | narrowspec | |||
|
74 | undo | |||
|
75 | undo.backupfiles | |||
|
76 | undo.phaseroots | |||
|
77 | ||||
|
78 | Checking that repository has all the required data and not broken | |||
|
79 | ||||
|
80 | $ hg verify | |||
|
81 | checking changesets | |||
|
82 | checking manifests | |||
|
83 | checking directory manifests (tree !) | |||
|
84 | crosschecking files in changesets and manifests | |||
|
85 | checking files | |||
|
86 | checked 40 changesets with 1 changes to 1 files |
General Comments 0
You need to be logged in to leave comments.
Login now