tests/test-purge.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 24 Jan 2020 23:22:29 +0100
branchstable
changeset 44250 7e08d3885b28
parent 41738 c70bdd222dcd
child 44289 9f8eddd2723f
permissions -rw-r--r--
heptapod-ci: colorize output The run result are nicer to read with color. Differential Revision: https://phab.mercurial-scm.org/D8012
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     1
  $ cat <<EOF >> $HGRCPATH
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     2
  > [extensions]
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     3
  > purge =
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     4
  > EOF
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     5
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     6
init
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     7
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     8
  $ hg init t
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
     9
  $ cd t
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    10
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    11
setup
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    12
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    13
  $ echo r1 > r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    14
  $ hg ci -qAmr1 -d'0 0'
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    15
  $ mkdir directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    16
  $ echo r2 > directory/r2
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    17
  $ hg ci -qAmr2 -d'1 0'
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    18
  $ echo 'ignored' > .hgignore
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    19
  $ hg ci -qAmr3 -d'2 0'
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    20
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    21
delete an empty directory
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    22
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    23
  $ mkdir empty_dir
20565
f1c3ba167b0c purge: avoid duplicate output for --print (issue4092)
anuraggoel <anurag.dsps@gmail.com>
parents: 16930
diff changeset
    24
  $ hg purge -p -v
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    25
  empty_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    26
  $ hg purge -v
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    27
  removing directory empty_dir
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    28
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    29
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    30
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    31
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    32
delete an untracked directory
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    33
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    34
  $ mkdir untracked_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    35
  $ touch untracked_dir/untracked_file1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    36
  $ touch untracked_dir/untracked_file2
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    37
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    38
  untracked_dir/untracked_file1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    39
  untracked_dir/untracked_file2
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    40
  $ hg purge -v
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    41
  removing file untracked_dir/untracked_file1
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    42
  removing file untracked_dir/untracked_file2
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    43
  removing directory untracked_dir
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    44
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    45
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    46
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    47
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    48
delete an untracked file
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    49
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    50
  $ touch untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    51
  $ touch untracked_file_readonly
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 33262
diff changeset
    52
  $ "$PYTHON" <<EOF
40369
ef6cab7930b3 py3: fix module imports in tests, as flagged by test-check-module-imports.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 39707
diff changeset
    53
  > import os
ef6cab7930b3 py3: fix module imports in tests, as flagged by test-check-module-imports.t
Matt Harbison <matt_harbison@yahoo.com>
parents: 39707
diff changeset
    54
  > import stat
41738
c70bdd222dcd tests: bulk changes to avoid whitespace errors of check-code.py
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 40369
diff changeset
    55
  > f = 'untracked_file_readonly'
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    56
  > os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE)
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    57
  > EOF
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    58
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    59
  untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    60
  untracked_file_readonly
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    61
  $ hg purge -v
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    62
  removing file untracked_file
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    63
  removing file untracked_file_readonly
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    64
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    65
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    66
  r1
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    67
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    68
delete an untracked file in a tracked directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    69
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    70
  $ touch directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    71
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    72
  directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    73
  $ hg purge -v
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    74
  removing file directory/untracked_file
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    75
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    76
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    77
  r1
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    78
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    79
delete nested directories
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    80
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    81
  $ mkdir -p untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    82
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    83
  untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    84
  $ hg purge -v
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    85
  removing directory untracked_directory/nested_directory
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    86
  removing directory untracked_directory
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    87
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    88
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    89
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    90
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    91
delete nested directories from a subdir
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    92
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    93
  $ mkdir -p untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    94
  $ cd directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    95
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    96
  untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    97
  $ hg purge -v
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    98
  removing directory untracked_directory/nested_directory
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
    99
  removing directory untracked_directory
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   100
  $ cd ..
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   101
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   102
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   103
  r1
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
   104
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   105
delete only part of the tree
4155
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
   106
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   107
  $ mkdir -p untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   108
  $ touch directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   109
  $ cd directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   110
  $ hg purge -p ../untracked_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   111
  untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   112
  $ hg purge -v ../untracked_directory
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
   113
  removing directory untracked_directory/nested_directory
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
   114
  removing directory untracked_directory
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   115
  $ cd ..
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   116
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   117
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   118
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   119
  $ ls directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   120
  directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   121
  $ rm directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   123
skip ignored files if --all not specified
4155
4c714ed245d6 purge.py: fix invocation of statwalk
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4145
diff changeset
   124
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   125
  $ touch ignored
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   126
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   127
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   128
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   129
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   130
  ignored
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   131
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   132
  $ hg purge -p --all
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   133
  ignored
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   134
  $ hg purge -v --all
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
   135
  removing file ignored
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   136
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   137
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   138
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   139
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   140
abort with missing files until we support name mangling filesystems
4310
c8919eb0f315 purge: abort with missing files avoiding problems with name-mangling fs
Emanuele Aina <em@nerd.ocracy.org>
parents: 4155
diff changeset
   141
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   142
  $ touch untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   143
  $ rm r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   144
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   145
hide error messages to avoid changing the output when the text changes
6757
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
   146
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   147
  $ hg purge -p 2> /dev/null
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   148
  untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   149
  $ hg st
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   150
  ! r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   151
  ? untracked_file
6757
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
   152
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   153
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   154
  untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   155
  $ hg purge -v 2> /dev/null
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
   156
  removing file untracked_file
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   157
  $ hg st
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   158
  ! r1
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
   159
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   160
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   161
  $ hg revert --all --quiet
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   162
  $ hg st -a
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   163
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   164
tracked file in ignored directory (issue621)
5517
98d5f9b95699 purge: simplify safety net for case mangling filesystems
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4691
diff changeset
   165
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   166
  $ echo directory >> .hgignore
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   167
  $ hg ci -m 'ignore directory'
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   168
  $ touch untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   169
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   170
  untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   171
  $ hg purge -v
16930
9efe4a95c099 purge: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
   172
  removing file untracked_file
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   173
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   174
skip excluded files
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   175
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   176
  $ touch excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   177
  $ hg purge -p -X excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   178
  $ hg purge -v -X excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   179
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   180
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   181
  excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   182
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   183
  $ rm excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   184
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   185
skip files in excluded dirs
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
   186
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   187
  $ mkdir excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   188
  $ touch excluded_dir/file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   189
  $ hg purge -p -X excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   190
  $ hg purge -v -X excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   191
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   192
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   193
  excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   194
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   195
  $ ls excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   196
  file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   197
  $ rm -R excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   198
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   199
skip excluded empty dirs
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
   200
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   201
  $ mkdir excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   202
  $ hg purge -p -X excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   203
  $ hg purge -v -X excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   204
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   205
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   206
  excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   207
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   208
  $ rmdir excluded_dir
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
   209
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   210
skip patterns
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   211
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   212
  $ mkdir .svn
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   213
  $ touch .svn/foo
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   214
  $ mkdir directory/.svn
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   215
  $ touch directory/.svn/foo
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   216
  $ hg purge -p -X .svn -X '*/.svn'
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   217
  $ hg purge -p -X re:.*.svn
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 12122
diff changeset
   218
21853
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   219
  $ rm -R .svn directory r1
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   220
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   221
only remove files
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   222
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   223
  $ mkdir -p empty_dir dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   224
  $ touch untracked_file dir/untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   225
  $ hg purge -p --files
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   226
  dir/untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   227
  untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   228
  $ hg purge -v --files
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   229
  removing file dir/untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   230
  removing file untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   231
  $ ls
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   232
  dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   233
  empty_dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   234
  $ ls dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   235
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   236
only remove dirs
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   237
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   238
  $ mkdir -p empty_dir dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   239
  $ touch untracked_file dir/untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   240
  $ hg purge -p --dirs
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   241
  empty_dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   242
  $ hg purge -v --dirs
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   243
  removing directory empty_dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   244
  $ ls
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   245
  dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   246
  untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   247
  $ ls dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   248
  untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   249
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   250
remove both files and dirs
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   251
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   252
  $ mkdir -p empty_dir dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   253
  $ touch untracked_file dir/untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   254
  $ hg purge -p --files --dirs
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   255
  dir/untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   256
  untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   257
  empty_dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   258
  $ hg purge -v --files --dirs
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   259
  removing file dir/untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   260
  removing file untracked_file
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   261
  removing directory empty_dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   262
  removing directory dir
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   263
  $ ls
8127b9e798b1 purge: add options for deleting only files or only directories
Ben Kehoe <benk@berkeley.edu>
parents: 20565
diff changeset
   264
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 12122
diff changeset
   265
  $ cd ..