tests/test-encode.t
author Simon Sapin <simon.sapin@octobus.net>
Tue, 09 Nov 2021 19:55:46 +0100
changeset 48335 b7fde9237c92
parent 37461 538353b80676
child 48339 a2e278b5e265
permissions -rw-r--r--
rhg: Enable `rhg status` in most tests This subcommand is disabled by default because of bugs that make some test fail. Enable it in the rest of the tests in order to avoid regressing them. As with `RHG_ON_UNSUPPORTED`, an environment variable is used instead of a configuration file and `HGRCPATH` because some tests override `HGRCPATH`. Running `unset RHG_STATUS` at the start of a test restores the default of `rhg status` being disabled. Hopefully it can be increasingly removed from test files as bugs are fixed. Differential Revision: https://phab.mercurial-scm.org/D11756
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48335
b7fde9237c92 rhg: Enable `rhg status` in most tests
Simon Sapin <simon.sapin@octobus.net>
parents: 37461
diff changeset
     1
TODO: fix rhg bugs that make this test fail when status is enabled
b7fde9237c92 rhg: Enable `rhg status` in most tests
Simon Sapin <simon.sapin@octobus.net>
parents: 37461
diff changeset
     2
  $ unset RHG_STATUS
b7fde9237c92 rhg: Enable `rhg status` in most tests
Simon Sapin <simon.sapin@octobus.net>
parents: 37461
diff changeset
     3
b7fde9237c92 rhg: Enable `rhg status` in most tests
Simon Sapin <simon.sapin@octobus.net>
parents: 37461
diff changeset
     4
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     5
Test encode/decode filters
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
     6
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     7
  $ hg init
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     8
  $ cat > .hg/hgrc <<EOF
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
     9
  > [encode]
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    10
  > not.gz = tr [:lower:] [:upper:]
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    11
  > *.gz = gzip -d
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    12
  > [decode]
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    13
  > not.gz = tr [:upper:] [:lower:]
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    14
  > *.gz = gzip
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    15
  > EOF
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    16
  $ echo "this is a test" | gzip > a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    17
  $ echo "this is a test" > not.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    18
  $ hg add *
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    19
  $ hg ci -m "test"
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
    20
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    21
no changes
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    22
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    23
  $ hg status
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    24
  $ touch *
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    25
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    26
no changes
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    27
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    28
  $ hg status
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    29
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    30
check contents in repo are encoded
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
    31
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 12416
diff changeset
    32
  $ hg debugdata a.gz 0
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    33
  this is a test
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 12416
diff changeset
    34
  $ hg debugdata not.gz 0
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    35
  THIS IS A TEST
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    36
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    37
check committed content was decoded
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
    38
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    39
  $ gunzip < a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    40
  this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    41
  $ cat not.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    42
  this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    43
  $ rm *
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    44
  $ hg co -C
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    45
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
    46
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    47
check decoding of our new working dir copy
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
    48
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    49
  $ gunzip < a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    50
  this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    51
  $ cat not.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    52
  this is a test
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
    53
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    54
check hg cat operation
6093
f5b00b6e426a Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents: 3853
diff changeset
    55
12416
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    56
  $ hg cat a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    57
  this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    58
  $ hg cat --decode a.gz | gunzip
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    59
  this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    60
  $ mkdir subdir
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    61
  $ cd subdir
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    62
  $ hg -R .. cat ../a.gz
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    63
  this is a test
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    64
  $ hg -R .. cat --decode ../a.gz | gunzip
1fcdd9b7f657 tests: unify test-encode
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
    65
  this is a test
37461
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    66
  $ cd ..
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    67
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    68
check tempfile filter
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    69
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    70
  $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:gzip -c INFILE > OUTFILE' | gunzip
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    71
  this is a test
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    72
  $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:sh -c "exit 1"'
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    73
  abort: command '*' failed: exited with status 1 (glob)
538353b80676 procutil: fix error message of tempfile filter
Yuya Nishihara <yuya@tcha.org>
parents: 16913
diff changeset
    74
  [255]
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 14182
diff changeset
    75
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 14182
diff changeset
    76
  $ cd ..