comparison tests/test-remotefilelog-sparse.t @ 40495:3a333a582d7b

remotefilelog: import pruned-down remotefilelog extension from hg-experimental This is remotefilelog as of my recent patches for compatibility with current tip of hg, minus support for old versions of Mercurial and some FB-specific features like their treemanifest extension and fetching linkrev data from a patched phabricator. The file extutil.py moved from hgext3rd to remotefilelog. This is not yet ready to be landed, consider it a preview for now. Planned changes include: * replace lz4 with zstd * rename some capabilities, requirements and wireproto commands to mark them as experimental * consolidate bits of shallowutil with related functions (eg readfile) I'm certainly open to other (small) changes, but my rough mission is to land this largely as-is so we can use it as a model of the functionality we need going forward for lazy-fetching of file contents from a server. # no-check-commit because of a few foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D4782
author Augie Fackler <augie@google.com>
date Thu, 27 Sep 2018 13:03:19 -0400
parents
children 95a079ea1e19
comparison
equal deleted inserted replaced
40494:9aeb9e2d28a7 40495:3a333a582d7b
1 $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
2 $ export PYTHONPATH
3
4 $ . "$TESTDIR/remotefilelog-library.sh"
5
6 $ hginit master
7 $ cd master
8 $ cat >> .hg/hgrc <<EOF
9 > [remotefilelog]
10 > server=True
11 > EOF
12 $ echo x > x
13 $ echo z > z
14 $ hg commit -qAm x1
15 $ echo x2 > x
16 $ echo z2 > z
17 $ hg commit -qAm x2
18 $ hg bookmark foo
19
20 $ cd ..
21
22 # prefetch a revision w/ a sparse checkout
23
24 $ hgcloneshallow ssh://user@dummy/master shallow --noupdate
25 streaming all changes
26 2 files to transfer, 527 bytes of data
27 transferred 527 bytes in 0.* seconds (*/sec) (glob)
28 searching for changes
29 no changes found
30 $ cd shallow
31 $ printf "[extensions]\nsparse=\n" >> .hg/hgrc
32
33 $ hg debugsparse -I x
34 $ hg prefetch -r 0
35 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
36
37 $ hg cat -r 0 x
38 x
39
40 $ hg debugsparse -I z
41 $ hg prefetch -r 0
42 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
43
44 $ hg cat -r 0 z
45 z
46
47 # prefetch sparse only on pull when configured
48
49 $ printf "[remotefilelog]\npullprefetch=bookmark()\n" >> .hg/hgrc
50 $ hg strip tip
51 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/876b1317060d-b2e91d8d-backup.hg (glob)
52
53 $ hg debugsparse --delete z
54
55 $ clearcache
56 $ hg pull
57 pulling from ssh://user@dummy/master
58 searching for changes
59 adding changesets
60 adding manifests
61 adding file changes
62 added 1 changesets with 0 changes to 0 files
63 updating bookmark foo
64 new changesets 876b1317060d
65 (run 'hg update' to get a working copy)
66 prefetching file contents
67 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
68
69 # Dont consider filtered files when doing copy tracing
70
71 ## Push an unrelated commit
72 $ cd ../
73
74 $ hgcloneshallow ssh://user@dummy/master shallow2
75 streaming all changes
76 2 files to transfer, 527 bytes of data
77 transferred 527 bytes in 0.* seconds (*) (glob)
78 searching for changes
79 no changes found
80 updating to branch default
81 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
83 $ cd shallow2
84 $ printf "[extensions]\nsparse=\n" >> .hg/hgrc
85
86 $ hg up -q 0
87 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
88 $ touch a
89 $ hg ci -Aqm a
90 $ hg push -q -f
91
92 ## Pull the unrelated commit and rebase onto it - verify unrelated file was not
93 pulled
94
95 $ cd ../shallow
96 $ hg up -q 1
97 $ hg pull -q
98 $ hg debugsparse -I z
99 $ clearcache
100 $ hg prefetch -r '. + .^' -I x -I z
101 4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over * (glob)
102 Originally this was testing that the rebase doesn't fetch pointless
103 blobs. Right now it fails because core's sparse can't load a spec from
104 the working directory. Presumably there's a fix, but I'm not sure what it is.
105 $ hg rebase -d 2 --keep
106 rebasing 1:876b1317060d "x2" (foo)
107 transaction abort!
108 rollback completed
109 abort: cannot parse sparse patterns from working directory
110 [255]