2020-01-20 13:42:49 +03:00
|
|
|
$ disable treemanifest
|
2019-02-07 16:12:02 +03:00
|
|
|
#testcases vfscachestore simplecachestore
|
2017-02-10 05:02:52 +03:00
|
|
|
|
2014-01-16 01:41:29 +04:00
|
|
|
$ . "$TESTDIR/library.sh"
|
|
|
|
|
|
|
|
$ hginit master
|
|
|
|
$ cd master
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [remotefilelog]
|
|
|
|
> server=True
|
|
|
|
> EOF
|
2019-02-07 16:12:02 +03:00
|
|
|
|
|
|
|
#if simplecachestore
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [remotefilelog]
|
|
|
|
> simplecacheserverstore=True
|
|
|
|
> [extensions]
|
|
|
|
> simplecache=
|
|
|
|
> [simplecache]
|
|
|
|
> cachedir=$TESTTMP/master/.hg/remotefilelogcache
|
|
|
|
> caches=local
|
|
|
|
> EOF
|
|
|
|
#endif
|
|
|
|
|
2014-01-16 01:41:29 +04:00
|
|
|
$ echo x > x
|
2014-08-19 20:33:31 +04:00
|
|
|
$ echo z > z
|
2014-01-16 01:41:29 +04:00
|
|
|
$ hg commit -qAm x
|
|
|
|
$ echo x2 > x
|
|
|
|
$ echo y > y
|
|
|
|
$ hg commit -qAm y
|
2014-08-07 05:50:57 +04:00
|
|
|
$ hg bookmark foo
|
2014-01-16 01:41:29 +04:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
# prefetch a revision
|
|
|
|
|
|
|
|
$ hgcloneshallow ssh://user@dummy/master shallow --noupdate
|
|
|
|
streaming all changes
|
2019-08-31 00:56:12 +03:00
|
|
|
3 files to transfer, * of data (glob)
|
2018-02-10 00:08:38 +03:00
|
|
|
transferred * bytes in * seconds (*/sec) (glob)
|
2014-11-08 05:17:39 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
2014-01-16 01:41:29 +04:00
|
|
|
$ cd shallow
|
|
|
|
|
|
|
|
$ hg prefetch -r 0
|
2020-01-09 18:44:55 +03:00
|
|
|
2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) (?)
|
2014-01-16 01:41:29 +04:00
|
|
|
|
|
|
|
$ hg cat -r 0 x
|
|
|
|
x
|
|
|
|
|
2017-11-17 02:28:07 +03:00
|
|
|
# prefetch with base
|
|
|
|
|
|
|
|
$ clearcache
|
|
|
|
$ hg prefetch -r 0::1 -b 0
|
2020-01-09 18:44:55 +03:00
|
|
|
2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) (?)
|
2017-11-17 02:28:07 +03:00
|
|
|
|
|
|
|
$ hg cat -r 1 x
|
|
|
|
x2
|
|
|
|
$ hg cat -r 1 y
|
|
|
|
y
|
|
|
|
|
|
|
|
$ hg cat -r 0 x
|
|
|
|
x
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) (?)
|
2017-11-17 02:28:07 +03:00
|
|
|
|
|
|
|
$ hg cat -r 0 z
|
|
|
|
z
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) (?)
|
2017-11-17 02:28:07 +03:00
|
|
|
|
|
|
|
$ hg prefetch -r 0::1 --base 0
|
|
|
|
$ hg prefetch -r 0::1 -b 1
|
|
|
|
$ hg prefetch -r 0::1
|
|
|
|
|
2014-01-16 01:41:29 +04:00
|
|
|
# prefetch a range of revisions
|
|
|
|
|
|
|
|
$ clearcache
|
|
|
|
$ hg prefetch -r 0::1
|
2020-01-09 18:44:55 +03:00
|
|
|
4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over *s (glob) (?)
|
2014-01-16 01:41:29 +04:00
|
|
|
|
|
|
|
$ hg cat -r 0 x
|
|
|
|
x
|
|
|
|
$ hg cat -r 1 x
|
|
|
|
x2
|
|
|
|
|
|
|
|
# prefetch certain files
|
|
|
|
|
|
|
|
$ clearcache
|
|
|
|
$ hg prefetch -r 1 x
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) (?)
|
2014-01-16 01:41:29 +04:00
|
|
|
|
|
|
|
$ hg cat -r 1 x
|
|
|
|
x2
|
|
|
|
|
|
|
|
$ hg cat -r 1 y
|
|
|
|
y
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) (?)
|
2014-07-04 00:05:11 +04:00
|
|
|
|
|
|
|
# prefetch on pull when configured
|
|
|
|
|
2014-08-07 05:50:57 +04:00
|
|
|
$ printf "[remotefilelog]\npullprefetch=bookmark()\n" >> .hg/hgrc
|
2019-02-25 14:50:46 +03:00
|
|
|
$ hg debugstrip tip
|
2014-07-04 00:05:11 +04:00
|
|
|
|
|
|
|
$ clearcache
|
|
|
|
$ hg pull
|
|
|
|
pulling from ssh://user@dummy/master
|
2015-10-14 00:17:02 +03:00
|
|
|
searching for changes
|
2014-07-04 00:05:11 +04:00
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
2015-10-14 00:17:02 +03:00
|
|
|
added 1 changesets with 0 changes to 0 files
|
2014-11-08 05:17:39 +03:00
|
|
|
updating bookmark foo
|
2014-08-07 05:50:57 +04:00
|
|
|
prefetching file contents
|
2020-06-24 04:45:45 +03:00
|
|
|
3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) (?)
|
2014-07-04 00:05:11 +04:00
|
|
|
|
|
|
|
$ hg up tip
|
2014-08-19 20:33:31 +04:00
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
# prefetch only fetches changes not in working copy
|
|
|
|
|
2019-02-25 14:50:46 +03:00
|
|
|
$ hg debugstrip tip
|
2014-08-19 20:33:31 +04:00
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) (?)
|
2014-08-19 20:33:31 +04:00
|
|
|
$ clearcache
|
|
|
|
|
|
|
|
$ hg pull
|
|
|
|
pulling from ssh://user@dummy/master
|
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 0 changes to 0 files
|
|
|
|
updating bookmark foo
|
|
|
|
prefetching file contents
|
2020-01-09 18:44:55 +03:00
|
|
|
2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) (?)
|
2014-10-10 02:20:54 +04:00
|
|
|
|
|
|
|
# Make some local commits that produce the same file versions as are on the
|
|
|
|
# server. To simulate a situation where we have local commits that were somehow
|
|
|
|
# pushed, and we will soon pull.
|
|
|
|
|
|
|
|
$ hg prefetch -r 'all()'
|
2020-01-09 18:44:55 +03:00
|
|
|
2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) (?)
|
2019-02-25 14:50:46 +03:00
|
|
|
$ hg debugstrip -q -r 0
|
2014-10-10 02:20:54 +04:00
|
|
|
$ echo x > x
|
|
|
|
$ echo z > z
|
|
|
|
$ hg commit -qAm x
|
|
|
|
$ echo x2 > x
|
|
|
|
$ echo y > y
|
|
|
|
$ hg commit -qAm y
|
|
|
|
|
|
|
|
# prefetch server versions, even if local versions are available
|
|
|
|
|
|
|
|
$ clearcache
|
2019-02-25 14:50:46 +03:00
|
|
|
$ hg debugstrip -q tip
|
2014-10-10 02:20:54 +04:00
|
|
|
$ hg pull
|
|
|
|
pulling from ssh://user@dummy/master
|
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 0 changes to 0 files
|
|
|
|
updating bookmark foo
|
|
|
|
prefetching file contents
|
2020-01-09 18:44:55 +03:00
|
|
|
2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) (?)
|
2015-12-15 01:49:34 +03:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
# Prefetch unknown files during checkout
|
2015-12-15 01:44:08 +03:00
|
|
|
|
2015-12-15 01:49:34 +03:00
|
|
|
$ hgcloneshallow ssh://user@dummy/master shallow2
|
|
|
|
streaming all changes
|
2019-08-31 00:56:12 +03:00
|
|
|
3 files to transfer, * of data (glob)
|
2018-02-10 00:08:38 +03:00
|
|
|
transferred * bytes in * seconds * (glob)
|
2015-12-15 01:49:34 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
updating to branch default
|
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
|
2015-12-15 01:49:34 +03:00
|
|
|
$ cd shallow2
|
|
|
|
$ hg up -q null
|
|
|
|
$ echo x > x
|
|
|
|
$ echo y > y
|
|
|
|
$ echo z > z
|
|
|
|
$ clearcache
|
|
|
|
$ hg up tip
|
|
|
|
x: untracked file differs
|
|
|
|
abort: untracked files in working directory differ from files in requested revision
|
2020-01-09 18:44:55 +03:00
|
|
|
3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob) (?)
|
2015-12-15 01:49:34 +03:00
|
|
|
[255]
|
2015-12-15 01:44:08 +03:00
|
|
|
$ hg revert --all
|
|
|
|
|
|
|
|
# Test batch fetching of lookup files during hg status
|
|
|
|
$ hg up --clean tip
|
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg debugrebuilddirstate
|
|
|
|
$ clearcache
|
|
|
|
$ hg status
|
2020-01-09 18:44:55 +03:00
|
|
|
3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob) (?)
|
2015-12-15 01:44:11 +03:00
|
|
|
|
|
|
|
# Prefetch during addrename detection
|
|
|
|
$ hg up -q --clean tip
|
|
|
|
$ hg revert --all
|
|
|
|
$ mv x x2
|
|
|
|
$ mv y y2
|
|
|
|
$ mv z z2
|
|
|
|
$ clearcache
|
|
|
|
$ hg addremove -s 50 > /dev/null
|
2020-01-09 18:44:55 +03:00
|
|
|
* files fetched over 1 fetches - (* misses, 0.00% hit ratio) over * (glob) (?)
|
2016-05-16 20:59:09 +03:00
|
|
|
|
2016-05-20 19:31:34 +03:00
|
|
|
$ cd ..
|
|
|
|
|
2016-05-16 20:59:09 +03:00
|
|
|
# Prefetch packs
|
|
|
|
$ hgcloneshallow ssh://user@dummy/master packprefetch
|
|
|
|
streaming all changes
|
2019-08-31 00:56:12 +03:00
|
|
|
3 files to transfer, * of data (glob)
|
2018-02-10 00:08:38 +03:00
|
|
|
transferred * bytes in * seconds (*/sec) (glob)
|
2016-05-16 20:59:09 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
updating to branch default
|
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd packprefetch
|
2016-05-20 19:31:34 +03:00
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [remotefilelog]
|
|
|
|
> fetchpacks=True
|
2016-06-01 20:06:35 +03:00
|
|
|
> backgroundrepack=True
|
2016-05-20 19:31:34 +03:00
|
|
|
> EOF
|
2016-05-16 20:59:09 +03:00
|
|
|
$ clearcache
|
2016-05-20 19:31:34 +03:00
|
|
|
$ hg prefetch -r .
|
2020-01-09 18:44:55 +03:00
|
|
|
3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob) (?)
|
2020-03-27 04:59:47 +03:00
|
|
|
$ find $TESTTMP/hgcache/master/packs -type f | sort
|
2018-12-16 03:23:20 +03:00
|
|
|
$TESTTMP/hgcache/master/packs/0a61bfbc8e0c4a08583b3f1abc7ad7f9cc9acc21.dataidx
|
|
|
|
$TESTTMP/hgcache/master/packs/0a61bfbc8e0c4a08583b3f1abc7ad7f9cc9acc21.datapack
|
2017-05-03 20:19:45 +03:00
|
|
|
$TESTTMP/hgcache/master/packs/47d8f1b90a73af4ff8af19fcd10bdc027b6a881a.histidx
|
|
|
|
$TESTTMP/hgcache/master/packs/47d8f1b90a73af4ff8af19fcd10bdc027b6a881a.histpack
|
2016-05-16 20:59:09 +03:00
|
|
|
$ hg cat -r . x
|
|
|
|
x2
|
|
|
|
$ hg cat -r . y
|
|
|
|
y
|
|
|
|
$ hg cat -r . z
|
|
|
|
z
|
2016-05-20 19:31:34 +03:00
|
|
|
|
|
|
|
# Prefetch packs that include renames
|
|
|
|
$ cd ../master
|
|
|
|
$ hg mv z z2
|
|
|
|
$ hg commit -m 'move z -> z2'
|
|
|
|
$ cd ../packprefetch
|
|
|
|
$ hg pull -q
|
|
|
|
$ hg prefetch -r tip
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
|
2016-05-20 19:31:34 +03:00
|
|
|
$ hg up tip -q
|
|
|
|
$ hg log -f z2 -T '{desc}\n'
|
|
|
|
move z -> z2
|
|
|
|
x
|
2016-11-07 21:30:10 +03:00
|
|
|
|
2019-04-09 20:31:26 +03:00
|
|
|
# check pulling renamed and changed file
|
|
|
|
$ echo new_change >> z2
|
|
|
|
$ hg commit -m "changed z2"
|
|
|
|
$ hg push
|
|
|
|
pushing to ssh://user@dummy/master
|
|
|
|
searching for changes
|
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ hgcloneshallow ssh://user@dummy/master packprefetch__2 --noupdate -q
|
|
|
|
$ cd packprefetch__2
|
|
|
|
$ hg prefetch -r tip -q
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
|
2019-04-09 20:31:26 +03:00
|
|
|
$ hg up tip -q
|
|
|
|
$ cat z2
|
|
|
|
z
|
|
|
|
new_change
|
2019-04-09 20:31:26 +03:00
|
|
|
|
|
|
|
$ cd ../packprefetch
|
|
|
|
|
2016-11-07 21:30:10 +03:00
|
|
|
# Revert across double renames. Note: the scary "abort", error is because
|
|
|
|
# https://bz.mercurial-scm.org/5419 .
|
|
|
|
|
|
|
|
$ clearcache
|
|
|
|
$ hg mv y y2
|
|
|
|
$ hg mv x x2
|
|
|
|
$ hg mv z2 z3
|
|
|
|
$ hg revert -a -r 1 || true
|
|
|
|
undeleting x
|
|
|
|
forgetting x2
|
|
|
|
undeleting y
|
|
|
|
forgetting y2
|
|
|
|
adding z
|
|
|
|
forgetting z3
|
|
|
|
abort: z2@109c3a557a73: not found in manifest! (?)
|
2020-01-09 18:44:55 +03:00
|
|
|
3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over * (glob) (?)
|
2016-11-07 21:30:10 +03:00
|
|
|
|
2018-06-05 14:23:55 +03:00
|
|
|
# Test connection pool lifetime
|
|
|
|
$ clearcache
|
|
|
|
$ hg prefetch -r 0::1 --debug --config connectionpool.lifetime=0 | grep 'closing expired connection'
|
2020-01-09 18:44:55 +03:00
|
|
|
4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over * (glob) (?)
|
2018-06-05 14:23:55 +03:00
|
|
|
closing expired connection to ssh://user@dummy/master
|
|
|
|
$ clearcache
|
|
|
|
$ hg prefetch -r 0::1 --debug --config connectionpool.lifetime=300 | grep 'closing expired connection'
|
2020-01-09 18:44:55 +03:00
|
|
|
4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over * (glob) (?)
|
2018-06-05 14:23:55 +03:00
|
|
|
[1]
|
2018-06-14 12:34:23 +03:00
|
|
|
|
|
|
|
$ cat >$TESTTMP/testpool <<EOF
|
|
|
|
> import time
|
|
|
|
> with repo.connectionpool.get('ssh://user@dummy/master') as conn:
|
|
|
|
> connid = id(conn)
|
2020-06-19 01:14:42 +03:00
|
|
|
> repo.ui.debug("got first connection\n")
|
2018-06-14 12:34:23 +03:00
|
|
|
> with repo.connectionpool.get('ssh://user@dummy/master') as conn:
|
|
|
|
> assert connid == id(conn)
|
2020-06-19 01:14:42 +03:00
|
|
|
> repo.ui.debug("got second connection\n")
|
2018-06-14 12:34:23 +03:00
|
|
|
> time.sleep(2)
|
|
|
|
> with repo.connectionpool.get('ssh://user@dummy/master') as conn:
|
|
|
|
> assert connid != id(conn)
|
2020-06-19 01:14:42 +03:00
|
|
|
> repo.ui.debug("got third connection\n")
|
2018-06-14 12:34:23 +03:00
|
|
|
> time.sleep(2)
|
|
|
|
> EOF
|
|
|
|
$ hg debugshell --command "`cat $TESTTMP/testpool`" --config connectionpool.lifetime=1 --debug | grep 'connection'
|
|
|
|
got first connection
|
2020-02-13 23:12:56 +03:00
|
|
|
reusing connection from pool
|
2018-06-14 12:34:23 +03:00
|
|
|
got second connection
|
|
|
|
not reusing expired connection to ssh://user@dummy/master
|
|
|
|
got third connection
|
|
|
|
closing expired connection to ssh://user@dummy/master
|