annotate tests/test-rhg-sparse-narrow.t @ 51460:cebd96dee99a

branchcache: move the filename to a class attribute This prepare the introduction of more variant of cache.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 25 Feb 2024 20:40:37 +0100
parents e57f76c28f7b
children 652149ed64f0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48409
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
1 #require rhg
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
2
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
3 $ NO_FALLBACK="env RHG_ON_UNSUPPORTED=abort"
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
4
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
5 Rhg works well when sparse working copy is enabled.
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
6
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
7 $ cd "$TESTTMP"
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
8 $ hg init repo-sparse
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
9 $ cd repo-sparse
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
10 $ cat > .hg/hgrc <<EOF
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
11 > [extensions]
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
12 > sparse=
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
13 > EOF
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
14
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
15 $ echo a > show
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
16 $ echo x > hide
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
17 $ mkdir dir1 dir2
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
18 $ echo x > dir1/x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
19 $ echo y > dir1/y
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
20 $ echo z > dir2/z
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
21
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
22 $ hg ci -Aqm 'initial'
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
23 $ hg debugsparse --include 'show'
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
24 $ ls -A
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
25 .hg
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
26 show
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
27
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
28 $ tip=$(hg log -r . --template '{node}')
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
29 $ $NO_FALLBACK rhg files -r "$tip"
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
30 dir1/x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
31 dir1/y
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
32 dir2/z
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
33 hide
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
34 show
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
35 $ $NO_FALLBACK rhg files
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
36 show
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
37
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
38 $ $NO_FALLBACK rhg cat -r "$tip" hide
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
39 x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
40
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
41 $ cd ..
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
42
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
43 We support most things when narrow is enabled, too, with a couple of caveats.
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
44
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
45 $ . "$TESTDIR/narrow-library.sh"
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
46 $ real_hg=$RHG_FALLBACK_EXECUTABLE
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
47
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
48 $ cat >> $HGRCPATH <<EOF
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
49 > [extensions]
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
50 > narrow=
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
51 > EOF
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
52
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
53 $ hg clone --narrow ./repo-sparse repo-narrow --include dir1
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
54 requesting all changes
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
55 adding changesets
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
56 adding manifests
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
57 adding file changes
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
58 added 1 changesets with 2 changes to 2 files
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
59 new changesets 6d714a4a2998
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
60 updating to branch default
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
62
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
63 $ cd repo-narrow
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
64
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
65 $ $NO_FALLBACK rhg cat -r "$tip" dir1/x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
66 x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
67 $ "$real_hg" cat -r "$tip" dir1/x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
68 x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
69
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
70 TODO: bad error message
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
71
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
72 $ $NO_FALLBACK rhg cat -r "$tip" hide
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
73 abort: invalid revision identifier: 6d714a4a2998cbfd0620db44da58b749f6565d63
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
74 [255]
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
75 $ "$real_hg" cat -r "$tip" hide
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
76 [1]
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
77
49985
e57f76c28f7b rhg-files: add support for narrow when specifying a revision
Raphaël Gomès <rgomes@octobus.net>
parents: 49984
diff changeset
78 A naive implementation of `rhg files` would leak the paths that are supposed
e57f76c28f7b rhg-files: add support for narrow when specifying a revision
Raphaël Gomès <rgomes@octobus.net>
parents: 49984
diff changeset
79 to be hidden by narrow.
48409
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
80
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
81 $ $NO_FALLBACK rhg files -r "$tip"
49985
e57f76c28f7b rhg-files: add support for narrow when specifying a revision
Raphaël Gomès <rgomes@octobus.net>
parents: 49984
diff changeset
82 dir1/x
e57f76c28f7b rhg-files: add support for narrow when specifying a revision
Raphaël Gomès <rgomes@octobus.net>
parents: 49984
diff changeset
83 dir1/y
48409
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
84 $ "$real_hg" files -r "$tip"
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
85 dir1/x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
86 dir1/y
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
87
49984
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
88 The working copy version works with narrow correctly
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
89
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
90 $ $NO_FALLBACK rhg files
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
91 dir1/x
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
92 dir1/y
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
93 $ "$real_hg" files
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
94 dir1/x
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
95 dir1/y
df9eabc9837b rust-narrow: enable narrow support for plain `rhg files`
Raphaël Gomès <rgomes@octobus.net>
parents: 49825
diff changeset
96
49489
7c93e38a0bbd rhg-status: add support for narrow clones
Raphaël Gomès <rgomes@octobus.net>
parents: 49485
diff changeset
97 Hg status needs to do some filtering based on narrow spec
48409
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
98
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
99 $ mkdir dir2
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
100 $ touch dir2/q
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
101 $ "$real_hg" status
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
102 $ $NO_FALLBACK rhg --config rhg.status=true status
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
103
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
104 Adding "orphaned" index files:
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
105
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
106 $ (cd ..; cp repo-sparse/.hg/store/data/hide.i repo-narrow/.hg/store/data/hide.i)
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
107 $ (cd ..; mkdir repo-narrow/.hg/store/data/dir2; cp repo-sparse/.hg/store/data/dir2/z.i repo-narrow/.hg/store/data/dir2/z.i)
49825
2f2682f40ea0 tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents: 49489
diff changeset
108 $ "$real_hg" verify -q
48409
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
109
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
110 $ "$real_hg" files -r "$tip"
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
111 dir1/x
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
112 dir1/y
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
113
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
114 # TODO: even though [hg files] hides the orphaned dir2/z, [hg cat] still shows it.
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
115 # rhg has the same issue, but at least it's not specific to rhg.
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
116 # This is despite [hg verify] succeeding above.
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
117
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
118 $ $NO_FALLBACK rhg cat -r "$tip" dir2/z
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
119 z
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
120 $ "$real_hg" cat -r "$tip" dir2/z
005ae1a343f8 rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
121 z