##// END OF EJS Templates
internals: extract frame-based protocol docs to own document...
internals: extract frame-based protocol docs to own document wireprotocol.txt is quite long and difficult to digest. The frame-based protocol is effectively a standalone concept (and could even be used outside of Mercurial). So this commit extracts its docs to a standalone file. The first few paragraphs were rewritten as part of the extraction. Sections headers were adjusted accordingly. Existing referalls in wireprotocol.txt were updated to refer to the new doc / concept, which I've started referring to as `hgrpc`. I'm on the fence as to whether to move the HTTP and SSH transport details to the new doc as well. For now, I'm leaving them in wireprotocol.txt. Differential Revision: https://phab.mercurial-scm.org/D4443

File last commit:

r38082:6e713711 default
r39594:b0e0db15 default
Show More
test-custom-filters.t
66 lines | 1.5 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
> 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