comparison tests/test-sparse-verbose-json.t @ 33289:abd7dedbaa36

sparse: vendor Facebook-developed extension Facebook has developed an extension to enable "sparse" checkouts - a working directory with a subset of files. This feature is a critical component in enabling repositories to scale to infinite number of files while retaining reasonable performance. It's worth noting that sparse checkout is only one possible solution to this problem: another is virtual filesystems that realize files on first access. But given that virtual filesystems may not be accessible to all users, sparse checkout is necessary as a fallback. Per mailing list discussion at https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095868.html we want to add sparse checkout to the Mercurial distribution via roughly the following mechanism: 1. Vendor extension as-is with minimal modifications (this patch) 2. Refactor extension so it is more clearly experimental and inline with Mercurial practices 3. Move code from extension into core where possible 4. Drop experimental labeling and/or move feature into core after sign-off from narrow clone feature owners This commit essentially copies the sparse extension and tests from revision 71e0a2aeca92a4078fe1b8c76e32c88ff1929737 of the https://bitbucket.org/facebook/hg-experimental repository. A list of modifications made as part of vendoring is as follows: * "EXPERIMENTAL" added to module docstring * Imports were changed to match Mercurial style conventions * "testedwith" value was updated to core Mercurial special value and comment boilerplate was inserted * A "clone_sparse" function was renamed to "clonesparse" to appease the style checker * Paths to the sparse extension in tests reflect built-in location * test-sparse-extensions.t was renamed to test-sparse-fsmonitor.t and references to "simplecache" were removed. The test always skips because it isn't trivial to run it given the way we currently run fsmonitor tests * A double empty line was removed from test-sparse-profiles.t There are aspects of the added code that are obviously not ideal. The goal is to make a minimal number of modifications as part of the vendoring to make it easier to track changes from the original implementation. Refactoring will occur in subsequent patches.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 01 Jul 2017 10:43:29 -0700
parents
children c9cbf4de27ba
comparison
equal deleted inserted replaced
33288:f08a178adadf 33289:abd7dedbaa36
1 test sparse with --verbose and -T json
2
3 $ hg init myrepo
4 $ cd myrepo
5 $ cat > .hg/hgrc <<EOF
6 > [extensions]
7 > sparse=
8 > strip=
9 > EOF
10
11 $ echo a > show
12 $ echo x > hide
13 $ hg ci -Aqm 'initial'
14
15 $ echo b > show
16 $ echo y > hide
17 $ echo aa > show2
18 $ echo xx > hide2
19 $ hg ci -Aqm 'two'
20
21 Verify basic --include and --reset
22
23 $ hg up -q 0
24 $ hg sparse --include 'hide' -Tjson
25 [
26 {
27 "exclude_rules_added": 0,
28 "files_added": 0,
29 "files_conflicting": 0,
30 "files_dropped": 1,
31 "include_rules_added": 1,
32 "profiles_added": 0
33 }
34 ]
35 $ hg sparse --clear-rules
36 $ hg sparse --include 'hide' --verbose
37 removing show
38 Profile # change: 0
39 Include rule # change: 1
40 Exclude rule # change: 0
41
42 $ hg sparse --reset -Tjson
43 [
44 {
45 "exclude_rules_added": 0,
46 "files_added": 1,
47 "files_conflicting": 0,
48 "files_dropped": 0,
49 "include_rules_added": -1,
50 "profiles_added": 0
51 }
52 ]
53 $ hg sparse --include 'hide'
54 $ hg sparse --reset --verbose
55 getting show
56 Profile # change: 0
57 Include rule # change: -1
58 Exclude rule # change: 0
59
60 Verifying that problematic files still allow us to see the deltas when forcing:
61
62 $ hg sparse --include 'show*'
63 $ touch hide
64 $ hg sparse --delete 'show*' --force -Tjson
65 pending changes to 'hide'
66 [
67 {
68 "exclude_rules_added": 0,
69 "files_added": 0,
70 "files_conflicting": 1,
71 "files_dropped": 0,
72 "include_rules_added": -1,
73 "profiles_added": 0
74 }
75 ]
76 $ hg sparse --include 'show*' --force
77 pending changes to 'hide'
78 $ hg sparse --delete 'show*' --force --verbose
79 pending changes to 'hide'
80 Profile # change: 0
81 Include rule # change: -1
82 Exclude rule # change: 0