mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
fastmanifest: introduce revset of what revision to cache
Summary: For the moment the revset is just the draft revisions, it will evolve to include likely rebase destination, branching points etc ... Test Plan: We add the result of querying the revset to the test to evaluate how well the prediction match what is actually being accessed Reviewers: durham, rmcelroy, ttung Reviewed By: ttung Subscribers: mjpieters Differential Revision: https://phabricator.fb.com/D3115578 Tasks: 10604335 Signature: t1:3115578:1459374926:f9df976aae07db05a44f1fb69a4c83c2a11969dc
This commit is contained in:
parent
8533edcb44
commit
82f0ca5a93
@ -17,6 +17,7 @@ logfile = "" # Filename, is not empty will log access to any manifest
|
||||
"""
|
||||
from mercurial import extensions
|
||||
from mercurial import manifest
|
||||
from mercurial import revset
|
||||
|
||||
|
||||
class manifestaccesslogger(object):
|
||||
@ -32,8 +33,18 @@ class manifestaccesslogger(object):
|
||||
pass
|
||||
return r
|
||||
|
||||
def fastmanifesttocache(repo, subset, x):
|
||||
"""``fastmanifesttocache(])``
|
||||
Revisions whose fastmanifest should be cached
|
||||
|
||||
For the moment just drafts
|
||||
"""
|
||||
return repo.revs("not public()")
|
||||
|
||||
def extsetup(ui):
|
||||
logfile = ui.config("fastmanifest", "logfile", "")
|
||||
if logfile:
|
||||
logger = manifestaccesslogger(logfile)
|
||||
extensions.wrapfunction(manifest.manifest, 'rev', logger.revwrap)
|
||||
revset.symbols['fastmanifesttocache'] = fastmanifesttocache
|
||||
revset.safesymbols.add('fastmanifesttocache')
|
||||
|
@ -14,12 +14,16 @@ Check diagnosis, debugging information
|
||||
> }
|
||||
|
||||
|
||||
$ printandclearlog() {
|
||||
$ printaccessedrevs() {
|
||||
> [ ! -f "$TESTTMP/logfile" ] && echo "no access" && return
|
||||
> cat "$TESTTMP/logfile" | sort | uniq
|
||||
> rm "$TESTTMP/logfile"
|
||||
> }
|
||||
|
||||
$ printcachedrevs() {
|
||||
> hg log -r "fastmanifesttocache()" -T "{rev}\n"
|
||||
> }
|
||||
|
||||
$ mkdir diagnosis
|
||||
$ cd diagnosis
|
||||
$ hg init
|
||||
@ -33,53 +37,83 @@ Check diagnosis, debugging information
|
||||
|
||||
1) Commit
|
||||
|
||||
$ printcachedrevs
|
||||
$ mkcommit a
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
-1
|
||||
|
||||
$ printcachedrevs
|
||||
0
|
||||
$ mkcommit b
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
-1
|
||||
0
|
||||
|
||||
$ echo "c" > a
|
||||
$ printcachedrevs
|
||||
0
|
||||
1
|
||||
$ hg commit -m "new a"
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
-1
|
||||
1
|
||||
|
||||
2) Diff
|
||||
|
||||
$ printcachedrevs
|
||||
0
|
||||
1
|
||||
2
|
||||
$ hg diff -c . > /dev/null
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
1
|
||||
2
|
||||
|
||||
$ printcachedrevs
|
||||
0
|
||||
1
|
||||
2
|
||||
$ hg diff -c ".^" > /dev/null
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
0
|
||||
1
|
||||
|
||||
$ printcachedrevs
|
||||
0
|
||||
1
|
||||
2
|
||||
$ hg diff -r ".^" > /dev/null
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
1
|
||||
2
|
||||
|
||||
3) Log
|
||||
|
||||
$ printcachedrevs
|
||||
0
|
||||
1
|
||||
2
|
||||
$ hg log a > /dev/null
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
no access
|
||||
|
||||
4) Update
|
||||
|
||||
$ printcachedrevs
|
||||
0
|
||||
1
|
||||
2
|
||||
$ hg update ".^^" -q
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
0
|
||||
2
|
||||
|
||||
$ printcachedrevs
|
||||
0
|
||||
1
|
||||
2
|
||||
$ hg update tip -q
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
0
|
||||
2
|
||||
|
||||
@ -106,7 +140,7 @@ Check diagnosis, debugging information
|
||||
o 0 1f0dee641bb7258c56bd60e93edfa2405381c41e add a
|
||||
|
||||
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
-1
|
||||
2
|
||||
3
|
||||
@ -116,7 +150,7 @@ Check diagnosis, debugging information
|
||||
rebasing 5:5234b99c4f1d "add e"
|
||||
rebasing 6:dd82c74514cb "add f" (tip)
|
||||
saved backup bundle to $TESTTMP/diagnosis/.hg/strip-backup/5234b99c4f1d-c2e049ad-backup.hg (glob)
|
||||
$ printandclearlog
|
||||
$ printaccessedrevs
|
||||
-1
|
||||
2
|
||||
4
|
||||
|
Loading…
Reference in New Issue
Block a user