##// END OF EJS Templates
issue6528: add a config option to control the fixing on the fly...
issue6528: add a config option to control the fixing on the fly This will allow people who know to be safe to avoid any performance overhead (and other potential issue). Differential Revision: https://phab.mercurial-scm.org/D11271

File last commit:

r46732:17a69535 default
r48630:2813d406 5.9rc1 stable
Show More
test-flagprocessor.t
305 lines | 8.0 KiB | text/troff | Tads3Lexer
/ tests / test-flagprocessor.t
Remi Chaintron
revlog: flag processor...
r30745 # Create server
$ hg init server
$ cd server
$ cat >> .hg/hgrc << EOF
> [extensions]
> extension=$TESTDIR/flagprocessorext.py
> EOF
$ cd ../
# Clone server and enable extensions
$ hg clone -q server client
$ cd client
$ cat >> .hg/hgrc << EOF
> [extensions]
> extension=$TESTDIR/flagprocessorext.py
> EOF
# Commit file that will trigger the noop extension
$ echo '[NOOP]' > noop
$ hg commit -Aqm "noop"
# Commit file that will trigger the base64 extension
$ echo '[BASE64]' > base64
$ hg commit -Aqm 'base64'
# Commit file that will trigger the gzip extension
$ echo '[GZIP]' > gzip
$ hg commit -Aqm 'gzip'
# Commit file that will trigger noop and base64
$ echo '[NOOP][BASE64]' > noop-base64
$ hg commit -Aqm 'noop+base64'
# Commit file that will trigger noop and gzip
$ echo '[NOOP][GZIP]' > noop-gzip
$ hg commit -Aqm 'noop+gzip'
# Commit file that will trigger base64 and gzip
$ echo '[BASE64][GZIP]' > base64-gzip
$ hg commit -Aqm 'base64+gzip'
# Commit file that will trigger base64, gzip and noop
$ echo '[BASE64][GZIP][NOOP]' > base64-gzip-noop
$ hg commit -Aqm 'base64+gzip+noop'
# TEST: ensure the revision data is consistent
$ hg cat noop
[NOOP]
$ hg debugdata noop 0
[NOOP]
$ hg cat -r . base64
[BASE64]
$ hg debugdata base64 0
W0JBU0U2NF0K (no-eol)
$ hg cat -r . gzip
[GZIP]
$ hg debugdata gzip 0
x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc)
$ hg cat -r . noop-base64
[NOOP][BASE64]
$ hg debugdata noop-base64 0
W05PT1BdW0JBU0U2NF0K (no-eol)
$ hg cat -r . noop-gzip
[NOOP][GZIP]
$ hg debugdata noop-gzip 0
x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc)
$ hg cat -r . base64-gzip
[BASE64][GZIP]
$ hg debugdata base64-gzip 0
eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol)
$ hg cat -r . base64-gzip-noop
[BASE64][GZIP][NOOP]
$ hg debugdata base64-gzip-noop 0
eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol)
# Push to the server
$ hg push
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 pushing to $TESTTMP/server
Remi Chaintron
revlog: flag processor...
r30745 searching for changes
adding changesets
adding manifests
adding file changes
added 7 changesets with 7 changes to 7 files
Gregory Szorc
simplestore: correctly implement flag processors...
r37454 Ensure the data got to the server OK
$ cd ../server
$ hg cat -r 6e48f4215d24 noop
[NOOP]
$ hg debugdata noop 0
[NOOP]
$ hg cat -r 6e48f4215d24 base64
[BASE64]
$ hg debugdata base64 0
W0JBU0U2NF0K (no-eol)
$ hg cat -r 6e48f4215d24 gzip
[GZIP]
$ hg debugdata gzip 0
x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc)
$ hg cat -r 6e48f4215d24 noop-base64
[NOOP][BASE64]
$ hg debugdata noop-base64 0
W05PT1BdW0JBU0U2NF0K (no-eol)
$ hg cat -r 6e48f4215d24 noop-gzip
[NOOP][GZIP]
$ hg debugdata noop-gzip 0
x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc)
$ hg cat -r 6e48f4215d24 base64-gzip
[BASE64][GZIP]
$ hg debugdata base64-gzip 0
eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol)
$ hg cat -r 6e48f4215d24 base64-gzip-noop
[BASE64][GZIP][NOOP]
$ hg debugdata base64-gzip-noop 0
eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol)
Remi Chaintron
revlog: flag processor...
r30745 # Initialize new client (not cloning) and setup extension
$ cd ..
$ hg init client2
$ cd client2
$ cat >> .hg/hgrc << EOF
> [paths]
> default = $TESTTMP/server
> [extensions]
> extension=$TESTDIR/flagprocessorext.py
> EOF
# Pull from server and update to latest revision
$ hg pull default
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 pulling from $TESTTMP/server
Remi Chaintron
revlog: flag processor...
r30745 requesting all changes
adding changesets
adding manifests
adding file changes
added 7 changesets with 7 changes to 7 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 07b1b9442c5b:6e48f4215d24
Remi Chaintron
revlog: flag processor...
r30745 (run 'hg update' to get a working copy)
$ hg update
7 files updated, 0 files merged, 0 files removed, 0 files unresolved
# TEST: ensure the revision data is consistent
$ hg cat noop
[NOOP]
$ hg debugdata noop 0
[NOOP]
$ hg cat -r . base64
[BASE64]
$ hg debugdata base64 0
W0JBU0U2NF0K (no-eol)
$ hg cat -r . gzip
[GZIP]
$ hg debugdata gzip 0
x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc)
$ hg cat -r . noop-base64
[NOOP][BASE64]
$ hg debugdata noop-base64 0
W05PT1BdW0JBU0U2NF0K (no-eol)
$ hg cat -r . noop-gzip
[NOOP][GZIP]
$ hg debugdata noop-gzip 0
x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc)
$ hg cat -r . base64-gzip
[BASE64][GZIP]
$ hg debugdata base64-gzip 0
eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol)
$ hg cat -r . base64-gzip-noop
[BASE64][GZIP][NOOP]
$ hg debugdata base64-gzip-noop 0
eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol)
# TEST: ensure a missing processor is handled
$ echo '[FAIL][BASE64][GZIP][NOOP]' > fail-base64-gzip-noop
$ hg commit -Aqm 'fail+base64+gzip+noop'
Martin von Zweigbergk
errors: remove trailing "!" from some error messages for consistency...
r46518 abort: missing processor for flag '0x1'
Martin von Zweigbergk
errors: use detailed exit code 50 for StorageError...
r46732 [50]
Martin von Zweigbergk
tests: clarify that duplicate flag processors is not an error...
r33616 $ rm fail-base64-gzip-noop
Remi Chaintron
revlog: flag processor...
r30745
# TEST: ensure we cannot register several flag processors on the same flag
$ cat >> .hg/hgrc << EOF
> [extensions]
> extension=$TESTDIR/flagprocessorext.py
> duplicate=$TESTDIR/flagprocessorext.py
> EOF
Martin von Zweigbergk
tests: fix test-flagprocessor.t flakiness...
r33617 $ hg debugrebuilddirstate
Martin von Zweigbergk
extensions: always include traceback when extension setup fails...
r34846 Traceback (most recent call last):
File "*/mercurial/extensions.py", line *, in _runextsetup (glob)
extsetup(ui)
File "*/tests/flagprocessorext.py", line *, in extsetup (glob)
Gregory Szorc
py3: conditionalize test-flagprocessor.t on Python 3.8...
r44579 flagutil.addflagprocessor( (py38 !)
test: fix some expect output in a traceback...
r46572 validatehash, (no-py38 !)
flagutil: move addflagprocessor to the new module (API)
r42958 File "*/mercurial/revlogutils/flagutil.py", line *, in addflagprocessor (glob)
insertflagprocessor(flag, processor, flagprocessors)
flagutil: move insertflagprocessor to the new module (API)
r42957 File "*/mercurial/revlogutils/flagutil.py", line *, in insertflagprocessor (glob)
Martin von Zweigbergk
extensions: always include traceback when extension setup fails...
r34846 raise error.Abort(msg)
Denis Laxalde
py3: add a __str__ method to Abort...
r43720 mercurial.error.Abort: cannot register multiple processors on flag '0x8'. (py3 !)
Gregory Szorc
py3: add Python 3 output for test-flagprocessor.t...
r41661 Abort: cannot register multiple processors on flag '0x8'. (no-py3 !)
Augie Fackler
extensions: catch uisetup and extsetup failures and don't let them break hg...
r32724 *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
Martin von Zweigbergk
tests: fix test-flagprocessor.t flakiness...
r33617 $ hg st 2>&1 | egrep 'cannot register multiple processors|flagprocessorext'
Martin von Zweigbergk
extensions: always include traceback when extension setup fails...
r34846 File "*/tests/flagprocessorext.py", line *, in extsetup (glob)
Denis Laxalde
py3: add a __str__ method to Abort...
r43720 mercurial.error.Abort: cannot register multiple processors on flag '0x8'. (py3 !)
Gregory Szorc
py3: add Python 3 output for test-flagprocessor.t...
r41661 Abort: cannot register multiple processors on flag '0x8'. (no-py3 !)
Martin von Zweigbergk
tests: fix test-flagprocessor.t flakiness...
r33617 *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
File "*/tests/flagprocessorext.py", line *, in b64decode (glob)
Jun Wu
test-flagprocessor: add tests about bundlerepo...
r31833
$ cd ..
# TEST: bundle repo
$ hg init bundletest
$ cd bundletest
$ cat >> .hg/hgrc << EOF
> [extensions]
> flagprocessor=$TESTDIR/flagprocessorext.py
> EOF
$ for i in 0 single two three 4; do
> echo '[BASE64]a-bit-longer-'$i > base64
> hg commit -m base64-$i -A base64
> done
$ hg update 2 -q
$ echo '[BASE64]a-bit-longer-branching' > base64
$ hg commit -q -m branching
Gregory Szorc
simplestore: correctly implement flag processors...
r37454 #if repobundlerepo
Jun Wu
test-flagprocessor: add tests about bundlerepo...
r31833 $ hg bundle --base 1 bundle.hg
4 changesets found
$ hg --config extensions.strip= strip -r 2 --no-backup --force -q
Jun Wu
test-flagprocessor: remove unnecessary greps...
r31838 $ hg -R bundle.hg log --stat -T '{rev} {desc}\n' base64
Jun Wu
bundlerepo: fix raw handling in revision()...
r31836 5 branching
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
4 base64-4
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
3 base64-three
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
2 base64-two
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 base64-single
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
0 base64-0
base64 | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Jun Wu
test-flagprocessor: add tests about bundlerepo...
r31833
Jun Wu
test-flagprocessor: remove unnecessary greps...
r31838 $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q
$ hg -R bundle-again.hg log --stat -T '{rev} {desc}\n' base64
Jun Wu
bundlerepo: use raw revision in revdiff()...
r31837 5 branching
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
4 base64-4
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
3 base64-three
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
2 base64-two
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
1 base64-single
base64 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
0 base64-0
base64 | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Jun Wu
test-flagprocessor: add a case about hg status...
r31855 $ rm bundle.hg bundle-again.hg
Gregory Szorc
simplestore: correctly implement flag processors...
r37454 #endif
Jun Wu
test-flagprocessor: add a case about hg status...
r31855
# TEST: hg status
$ hg status
$ hg diff