| 1 |
Test encode/decode filters |
| 2 |
|
| 3 |
$ hg init repo |
| 4 |
$ cd repo |
| 5 |
$ cat > .hg/hgrc <<EOF |
| 6 |
> [encode] |
| 7 |
> not.gz = tr [:lower:] [:upper:] |
| 8 |
> *.gz = gzip -d |
| 9 |
> [decode] |
| 10 |
> not.gz = tr [:upper:] [:lower:] |
| 11 |
> *.gz = gzip |
| 12 |
> EOF |
| 13 |
$ echo "this is a test" | gzip > a.gz |
| 14 |
$ echo "this is a test" > not.gz |
| 15 |
$ hg add * |
| 16 |
$ hg ci -m "test" |
| 17 |
|
| 18 |
no changes |
| 19 |
|
| 20 |
$ hg status |
| 21 |
$ touch * |
| 22 |
|
| 23 |
no changes |
| 24 |
|
| 25 |
$ hg status |
| 26 |
|
| 27 |
check contents in repo are encoded |
| 28 |
|
| 29 |
$ hg debugdata a.gz 0 |
| 30 |
this is a test |
| 31 |
$ hg debugdata not.gz 0 |
| 32 |
THIS IS A TEST |
| 33 |
|
| 34 |
check committed content was decoded |
| 35 |
|
| 36 |
$ gunzip < a.gz |
| 37 |
this is a test |
| 38 |
$ cat not.gz |
| 39 |
this is a test |
| 40 |
$ rm * |
| 41 |
$ hg co -C |
| 42 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 43 |
|
| 44 |
check decoding of our new working dir copy |
| 45 |
|
| 46 |
$ gunzip < a.gz |
| 47 |
this is a test |
| 48 |
$ cat not.gz |
| 49 |
this is a test |
| 50 |
|
| 51 |
check hg cat operation |
| 52 |
|
| 53 |
$ hg cat a.gz |
| 54 |
this is a test |
| 55 |
$ hg cat --decode a.gz | gunzip |
| 56 |
this is a test |
| 57 |
$ mkdir subdir |
| 58 |
$ cd subdir |
| 59 |
$ hg -R .. cat ../a.gz |
| 60 |
this is a test |
| 61 |
$ hg -R .. cat --decode ../a.gz | gunzip |
| 62 |
this is a test |
| 63 |
$ cd .. |
| 64 |
|
| 65 |
check tempfile filter |
| 66 |
|
| 67 |
$ hg cat a.gz --decode --config 'decode.*.gz=tempfile:gzip -c INFILE > OUTFILE' | gunzip |
| 68 |
this is a test |
| 69 |
$ hg cat a.gz --decode --config 'decode.*.gz=tempfile:sh -c "exit 1"' |
| 70 |
abort: command '*' failed: exited with status 1 (glob) |
| 71 |
[255] |
| 72 |
|
| 73 |
$ cd .. |