comparison tests/test-sparse-merges.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 merging things outside of the sparse checkout
2
3 $ hg init myrepo
4 $ cd myrepo
5 $ cat > .hg/hgrc <<EOF
6 > [extensions]
7 > sparse=
8 > EOF
9
10 $ echo foo > foo
11 $ echo bar > bar
12 $ hg add foo bar
13 $ hg commit -m initial
14
15 $ hg branch feature
16 marked working directory as branch feature
17 (branches are permanent and global, did you want a bookmark?)
18 $ echo bar2 >> bar
19 $ hg commit -m 'feature - bar2'
20
21 $ hg update -q default
22 $ hg sparse --exclude 'bar**'
23
24 $ hg merge feature
25 temporarily included 1 file(s) in the sparse checkout for merging
26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 (branch merge, don't forget to commit)
28
29 Verify bar was merged temporarily
30
31 $ ls
32 bar
33 foo
34 $ hg status
35 M bar
36
37 Verify bar disappears automatically when the working copy becomes clean
38
39 $ hg commit -m "merged"
40 cleaned up 1 temporarily added file(s) from the sparse checkout
41 $ hg status
42 $ ls
43 foo
44
45 $ hg cat -r . bar
46 bar
47 bar2
48
49 Test merging things outside of the sparse checkout that are not in the working
50 copy
51
52 $ hg strip -q -r . --config extensions.strip=
53 $ hg up -q feature
54 $ touch branchonly
55 $ hg ci -Aqm 'add branchonly'
56
57 $ hg up -q default
58 $ hg sparse -X branchonly
59 $ hg merge feature
60 temporarily included 2 file(s) in the sparse checkout for merging
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 (branch merge, don't forget to commit)