|
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 x |
|
15 $ echo x2 > x |
|
16 $ echo y > y |
|
17 $ hg commit -qAm y |
|
18 $ hg bookmark foo |
|
19 |
|
20 $ cd .. |
|
21 |
|
22 # prefetch a revision |
|
23 |
|
24 $ hgcloneshallow ssh://user@dummy/master shallow --noupdate |
|
25 streaming all changes |
|
26 2 files to transfer, 528 bytes of data |
|
27 transferred 528 bytes in * seconds (*/sec) (glob) |
|
28 searching for changes |
|
29 no changes found |
|
30 $ cd shallow |
|
31 |
|
32 $ hg prefetch -r 0 |
|
33 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
34 |
|
35 $ hg cat -r 0 x |
|
36 x |
|
37 |
|
38 # prefetch with base |
|
39 |
|
40 $ clearcache |
|
41 $ hg prefetch -r 0::1 -b 0 |
|
42 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
43 |
|
44 $ hg cat -r 1 x |
|
45 x2 |
|
46 $ hg cat -r 1 y |
|
47 y |
|
48 |
|
49 $ hg cat -r 0 x |
|
50 x |
|
51 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
|
52 |
|
53 $ hg cat -r 0 z |
|
54 z |
|
55 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
|
56 |
|
57 $ hg prefetch -r 0::1 --base 0 |
|
58 $ hg prefetch -r 0::1 -b 1 |
|
59 $ hg prefetch -r 0::1 |
|
60 |
|
61 # prefetch a range of revisions |
|
62 |
|
63 $ clearcache |
|
64 $ hg prefetch -r 0::1 |
|
65 4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over *s (glob) |
|
66 |
|
67 $ hg cat -r 0 x |
|
68 x |
|
69 $ hg cat -r 1 x |
|
70 x2 |
|
71 |
|
72 # prefetch certain files |
|
73 |
|
74 $ clearcache |
|
75 $ hg prefetch -r 1 x |
|
76 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
|
77 |
|
78 $ hg cat -r 1 x |
|
79 x2 |
|
80 |
|
81 $ hg cat -r 1 y |
|
82 y |
|
83 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
|
84 |
|
85 # prefetch on pull when configured |
|
86 |
|
87 $ printf "[remotefilelog]\npullprefetch=bookmark()\n" >> .hg/hgrc |
|
88 $ hg strip tip |
|
89 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/109c3a557a73-3f43405e-backup.hg (glob) |
|
90 |
|
91 $ clearcache |
|
92 $ hg pull |
|
93 pulling from ssh://user@dummy/master |
|
94 searching for changes |
|
95 adding changesets |
|
96 adding manifests |
|
97 adding file changes |
|
98 added 1 changesets with 0 changes to 0 files |
|
99 updating bookmark foo |
|
100 new changesets 109c3a557a73 |
|
101 (run 'hg update' to get a working copy) |
|
102 prefetching file contents |
|
103 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) |
|
104 |
|
105 $ hg up tip |
|
106 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
107 |
|
108 # prefetch only fetches changes not in working copy |
|
109 |
|
110 $ hg strip tip |
|
111 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
112 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/109c3a557a73-3f43405e-backup.hg (glob) |
|
113 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) |
|
114 $ clearcache |
|
115 |
|
116 $ hg pull |
|
117 pulling from ssh://user@dummy/master |
|
118 searching for changes |
|
119 adding changesets |
|
120 adding manifests |
|
121 adding file changes |
|
122 added 1 changesets with 0 changes to 0 files |
|
123 updating bookmark foo |
|
124 new changesets 109c3a557a73 |
|
125 (run 'hg update' to get a working copy) |
|
126 prefetching file contents |
|
127 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
128 |
|
129 # Make some local commits that produce the same file versions as are on the |
|
130 # server. To simulate a situation where we have local commits that were somehow |
|
131 # pushed, and we will soon pull. |
|
132 |
|
133 $ hg prefetch -r 'all()' |
|
134 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
135 $ hg strip -q -r 0 |
|
136 $ echo x > x |
|
137 $ echo z > z |
|
138 $ hg commit -qAm x |
|
139 $ echo x2 > x |
|
140 $ echo y > y |
|
141 $ hg commit -qAm y |
|
142 |
|
143 # prefetch server versions, even if local versions are available |
|
144 |
|
145 $ clearcache |
|
146 $ hg strip -q tip |
|
147 $ hg pull |
|
148 pulling from ssh://user@dummy/master |
|
149 searching for changes |
|
150 adding changesets |
|
151 adding manifests |
|
152 adding file changes |
|
153 added 1 changesets with 0 changes to 0 files |
|
154 updating bookmark foo |
|
155 new changesets 109c3a557a73 |
|
156 1 local changesets published (?) |
|
157 (run 'hg update' to get a working copy) |
|
158 prefetching file contents |
|
159 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) |
|
160 |
|
161 $ cd .. |
|
162 |
|
163 # Prefetch unknown files during checkout |
|
164 |
|
165 $ hgcloneshallow ssh://user@dummy/master shallow2 |
|
166 streaming all changes |
|
167 2 files to transfer, 528 bytes of data |
|
168 transferred 528 bytes in * seconds * (glob) |
|
169 searching for changes |
|
170 no changes found |
|
171 updating to branch default |
|
172 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
173 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) |
|
174 $ cd shallow2 |
|
175 $ hg up -q null |
|
176 $ echo x > x |
|
177 $ echo y > y |
|
178 $ echo z > z |
|
179 $ clearcache |
|
180 $ hg up tip |
|
181 x: untracked file differs |
|
182 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob) |
|
183 abort: untracked files in working directory differ from files in requested revision |
|
184 [255] |
|
185 $ hg revert --all |
|
186 |
|
187 # Test batch fetching of lookup files during hg status |
|
188 $ hg up --clean tip |
|
189 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
190 $ hg debugrebuilddirstate |
|
191 $ clearcache |
|
192 $ hg status |
|
193 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob) |
|
194 |
|
195 # Prefetch during addrename detection |
|
196 $ hg up -q --clean tip |
|
197 $ hg revert --all |
|
198 $ mv x x2 |
|
199 $ mv y y2 |
|
200 $ mv z z2 |
|
201 $ clearcache |
|
202 $ hg addremove -s 50 > /dev/null |
|
203 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob) |
|
204 |
|
205 $ cd .. |
|
206 |
|
207 # Prefetch packs |
|
208 $ hgcloneshallow ssh://user@dummy/master packprefetch |
|
209 streaming all changes |
|
210 2 files to transfer, 528 bytes of data |
|
211 transferred 528 bytes in * seconds (*/sec) (glob) |
|
212 searching for changes |
|
213 no changes found |
|
214 updating to branch default |
|
215 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
216 $ cd packprefetch |
|
217 $ cat >> .hg/hgrc <<EOF |
|
218 > [remotefilelog] |
|
219 > fetchpacks=True |
|
220 > backgroundrepack=True |
|
221 > EOF |
|
222 $ clearcache |
|
223 $ hg prefetch -r . |
|
224 3 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob) |
|
225 $ find $TESTTMP/hgcache -type f | sort |
|
226 $TESTTMP/hgcache/master/packs/47d8f1b90a73af4ff8af19fcd10bdc027b6a881a.histidx |
|
227 $TESTTMP/hgcache/master/packs/47d8f1b90a73af4ff8af19fcd10bdc027b6a881a.histpack |
|
228 $TESTTMP/hgcache/master/packs/8c654541e4f20141a894bbfe428e36fc92202e39.dataidx |
|
229 $TESTTMP/hgcache/master/packs/8c654541e4f20141a894bbfe428e36fc92202e39.datapack |
|
230 $ hg cat -r . x |
|
231 x2 |
|
232 $ hg cat -r . y |
|
233 y |
|
234 $ hg cat -r . z |
|
235 z |
|
236 |
|
237 # Prefetch packs that include renames |
|
238 $ cd ../master |
|
239 $ hg mv z z2 |
|
240 $ hg commit -m 'move z -> z2' |
|
241 $ cd ../packprefetch |
|
242 $ hg pull -q |
|
243 (running background incremental repack) |
|
244 $ hg prefetch -r tip |
|
245 1 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob) |
|
246 $ hg up tip -q |
|
247 $ hg log -f z2 -T '{desc}\n' |
|
248 move z -> z2 |
|
249 x |
|
250 |
|
251 # Revert across double renames. Note: the scary "abort", error is because |
|
252 # https://bz.mercurial-scm.org/5419 . |
|
253 |
|
254 $ clearcache |
|
255 $ hg mv y y2 |
|
256 $ hg mv x x2 |
|
257 $ hg mv z2 z3 |
|
258 $ hg revert -a -r 1 || true |
|
259 forgetting x2 |
|
260 forgetting y2 |
|
261 forgetting z3 |
|
262 adding z |
|
263 undeleting x |
|
264 undeleting y |
|
265 3 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over * (glob) |
|
266 abort: z2@109c3a557a73: not found in manifest! (?) |