Mercurial > hg
view tests/test-check-code.t @ 35923:efbd04238029
cmdutil: convert _revertprefetch() to a generic stored file hook (API)
This will be used by LFS to fetch required files in a group for multiple
commands, prior to being accessed. That avoids the one-at-a-time fetch when the
filelog wrapper goes to access it, and it is missing locally (which costs two
round trips to the server.) The core command list that needs this is probably
at least:
- annotate
- archive (which is also used by extdiff)
- cat
- diff
- export
- grep
- verify (sadly)
- anything that has the '{data}' template
There are no core users of the revert prefetch hook, and never have been since
it was introduced in 45e02cfad4bd for remotefilelog. Thanks to Yuya for
figuring out a way to reliably trigger the deprecated warning. Unfortunately,
it wanted to blame the caller of revert. Passing along an adjusted stack level
seemed the least bad choice (although it still blames a core function).
One thing to note is that the store lock isn't being held when this is called.
I'm not at all familiar with remotefilelog or its locking requirements, so this
may not be a big deal. Currently, LFS doesn't hold a lock when downloading
files. Even though largefiles doesn't either, I'm starting to think it should,
and maybe the .hg/store/lock isn't good enough to cover the globally shared
cache.
.. api::
The cmdutil._revertprefetch() hook point for prefetching stored files has
been replaced by the command agnostic cmdutil._prefetchfiles(). The new
function takes a list of files, instead of a list of lists of files.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 04 Feb 2018 14:14:28 -0500 |
parents | 414114a7c18f |
children | 23d12524a202 |
line wrap: on
line source
#require test-repo $ . "$TESTDIR/helpers-testrepo.sh" $ check_code="$TESTDIR"/../contrib/check-code.py $ cd "$TESTDIR"/.. New errors are not allowed. Warnings are strongly discouraged. (The writing "no-che?k-code" is for not skipping this file when checking.) $ testrepohg locate \ > -X contrib/python-zstandard \ > -X hgext/fsmonitor/pywatchman \ > -X mercurial/thirdparty \ > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false Skipping i18n/polib.py it has no-che?k-code (glob) Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob) Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob) Skipping mercurial/statprof.py it has no-che?k-code (glob) Skipping tests/badserverext.py it has no-che?k-code (glob) @commands in debugcommands.py should be in alphabetical order. >>> import re >>> commands = [] >>> with open('mercurial/debugcommands.py', 'rb') as fh: ... for line in fh: ... m = re.match("^@command\('([a-z]+)", line) ... if m: ... commands.append(m.group(1)) >>> scommands = list(sorted(commands)) >>> for i, command in enumerate(scommands): ... if command != commands[i]: ... print('commands in debugcommands.py not sorted; first differing ' ... 'command is %s; expected %s' % (commands[i], command)) ... break Prevent adding new files in the root directory accidentally. $ testrepohg files 'glob:*' .arcconfig .clang-format .editorconfig .hgignore .hgsigs .hgtags .jshintrc CONTRIBUTING CONTRIBUTORS COPYING Makefile README.rst hg hgeditor hgweb.cgi setup.py