##// END OF EJS Templates
cat: don't prefetch files unless the output requires it...
cat: don't prefetch files unless the output requires it It's a waste to cache lfs blobs when cat'ing the raw data at best, but a hassle debugging when the blob is missing. I'm not sure if there are other commands that have '{data}' for output, and if there's a general way to prefetch on that keyword. It's interesting that the verbose output seems to leak into the JSON output, but that seems like an existing bug.

File last commit:

r40645:ee9981bc default
r42678:561cd02c default
Show More
test-custom-filters.t
67 lines | 1.6 KiB | text/troff | Tads3Lexer
/ tests / test-custom-filters.t
Nicolas Dumazet
tests: unify test-custom-filters
r12124 $ hg init
$ cat > .hg/hgrc <<EOF
> [extensions]
> prefixfilter = prefix.py
> [encode]
> *.txt = stripprefix: Copyright 2046, The Masters
> [decode]
> *.txt = insertprefix: Copyright 2046, The Masters
> EOF
$ cat > prefix.py <<EOF
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 > from mercurial import error
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > def stripprefix(s, cmd, filename, **kwargs):
Pulkit Goyal
py3: add b'' prefixes in tests/test-custom-filters.t...
r38082 > header = b'%s\n' % cmd
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > if s[:len(header)] != header:
Pulkit Goyal
py3: add b'' prefixes in tests/test-custom-filters.t...
r38082 > raise error.Abort(b'missing header "%s" in %s' % (cmd, filename))
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > return s[len(header):]
> def insertprefix(s, cmd):
Pulkit Goyal
py3: add b'' prefixes in tests/test-custom-filters.t...
r38082 > return b'%s\n%s' % (cmd, s)
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > def reposetup(ui, repo):
Pulkit Goyal
py3: add b'' prefixes in tests/test-custom-filters.t...
r38082 > repo.adddatafilter(b'stripprefix:', stripprefix)
> repo.adddatafilter(b'insertprefix:', insertprefix)
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > EOF
$ cat > .hgignore <<EOF
> .hgignore
> prefix.py
> prefix.pyc
Pulkit Goyal
py3: add __pycache__ to .hgignore...
r40645 > __pycache__/
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > EOF
$ cat > stuff.txt <<EOF
> Copyright 2046, The Masters
> Some stuff to ponder very carefully.
> EOF
$ hg add stuff.txt
$ hg ci -m stuff
Repository data:
$ hg cat stuff.txt
Some stuff to ponder very carefully.
Fresh checkout:
$ rm stuff.txt
$ hg up -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cat stuff.txt
Copyright 2046, The Masters
Some stuff to ponder very carefully.
Nicolas Dumazet
test-custom-filter: heredoc is not required for single line operations
r12125 $ echo "Very very carefully." >> stuff.txt
Nicolas Dumazet
tests: unify test-custom-filters
r12124 $ hg stat
M stuff.txt
Nicolas Dumazet
test-custom-filter: heredoc is not required for single line operations
r12125 $ echo "Unauthorized material subject to destruction." > morestuff.txt
Nicolas Dumazet
tests: unify test-custom-filters
r12124
Problem encoding:
$ hg add morestuff.txt
$ hg ci -m morestuff
abort: missing header "Copyright 2046, The Masters" in morestuff.txt
Matt Mackall
tests: add exit codes to unified tests
r12316 [255]
Nicolas Dumazet
tests: unify test-custom-filters
r12124 $ hg stat
M stuff.txt
A morestuff.txt