tests/test-purge.t
author Adrian Buehlmann <adrian@cadifra.com>
Thu, 02 Jun 2011 00:33:33 +0200
changeset 14518 a67e866f46f9
parent 12122 9bab9ee901e8
child 16913 f2719b387380
permissions -rw-r--r--
workingctx: eliminate remove function Inlining it into it's last remaining call place in cmdutil.copy. Note that cmdutil.copy is called with the wlock already held, so no additional locking is needed to call util.unlinkpath. We do not need to wrap the util.unlinkpath call into a try block, because at that point we already know whether abssrc exists or not -- thanks to the preceding util.copyfile call. Adding a new local 'srcexists' in cmdutil.copy for that purpose.
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
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    24
  $ hg purge -p
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
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    27
  Removing directory empty_dir
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
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    41
  Removing file untracked_dir/untracked_file1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    42
  Removing file untracked_dir/untracked_file2
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    43
  Removing directory untracked_dir
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
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    52
  $ python <<EOF
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    53
  > import os, stat
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    54
  > f= 'untracked_file_readonly'
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    55
  > 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
    56
  > EOF
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    57
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    58
  untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    59
  untracked_file_readonly
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    60
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    61
  Removing file untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    62
  Removing file untracked_file_readonly
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    63
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    64
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    65
  r1
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    66
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    67
delete an untracked file in a tracked directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    68
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    69
  $ touch directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    70
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    71
  directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    72
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    73
  Removing file directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    74
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    75
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    76
  r1
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    77
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    78
delete nested directories
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    79
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    80
  $ mkdir -p untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    81
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    82
  untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    83
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    84
  Removing directory untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    85
  Removing directory untracked_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    86
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    87
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    88
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    89
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    90
delete nested directories from a subdir
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
    91
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    92
  $ mkdir -p untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    93
  $ cd directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    94
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    95
  untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    96
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    97
  Removing directory untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    98
  Removing directory untracked_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
    99
  $ cd ..
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   100
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   101
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   102
  r1
4145
2ebdd33fe456 Add a test for the purge extension
Emanuele Aina <faina.mail@tiscali.it>
parents:
diff changeset
   103
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   104
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
   105
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   106
  $ mkdir -p untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   107
  $ touch directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   108
  $ cd directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   109
  $ hg purge -p ../untracked_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   110
  untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   111
  $ hg purge -v ../untracked_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   112
  Removing directory untracked_directory/nested_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   113
  Removing directory untracked_directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   114
  $ cd ..
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   115
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   116
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   117
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   118
  $ ls directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   119
  directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   120
  $ rm directory/untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   121
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   122
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
   123
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   124
  $ touch ignored
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   125
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   126
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   127
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   128
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   129
  ignored
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   130
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   131
  $ hg purge -p --all
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   132
  ignored
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   133
  $ hg purge -v --all
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   134
  Removing file ignored
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   135
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   136
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   137
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   138
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   139
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
   140
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   141
  $ touch untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   142
  $ rm r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   143
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   144
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
   145
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   146
  $ hg purge -p 2> /dev/null
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   147
  untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   148
  $ hg st
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   149
  ! r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   150
  ? untracked_file
6757
55c71226eceb purge: cleanup
Matt Mackall <mpm@selenic.com>
parents: 5517
diff changeset
   151
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   152
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   153
  untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   154
  $ hg purge -v 2> /dev/null
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   155
  Removing file untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   156
  $ hg st
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   157
  ! r1
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
   158
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   159
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   160
  $ hg revert --all --quiet
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   161
  $ hg st -a
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   162
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   163
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
   164
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   165
  $ echo directory >> .hgignore
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   166
  $ hg ci -m 'ignore directory'
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   167
  $ touch untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   168
  $ hg purge -p
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   169
  untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   170
  $ hg purge -v
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   171
  Removing file untracked_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   172
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   173
skip excluded files
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   174
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   175
  $ touch excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   176
  $ hg purge -p -X excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   177
  $ hg purge -v -X excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   178
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   179
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   180
  excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   181
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   182
  $ rm excluded_file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   183
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   184
skip files in excluded dirs
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
   185
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   186
  $ mkdir excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   187
  $ touch excluded_dir/file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   188
  $ hg purge -p -X excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   189
  $ hg purge -v -X excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   190
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   191
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   192
  excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   193
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   194
  $ ls excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   195
  file
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   196
  $ rm -R excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   197
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   198
skip excluded empty dirs
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
   199
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   200
  $ mkdir excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   201
  $ hg purge -p -X excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   202
  $ hg purge -v -X excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   203
  $ ls
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   204
  directory
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   205
  excluded_dir
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   206
  r1
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   207
  $ rmdir excluded_dir
4463
a73cf208b2a0 purge: add --include and --exclude options
Emanuele Aina <em@nerd.ocracy.org>
parents: 4311
diff changeset
   208
12122
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   209
skip patterns
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   210
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   211
  $ mkdir .svn
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   212
  $ touch .svn/foo
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   213
  $ mkdir directory/.svn
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   214
  $ touch directory/.svn/foo
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   215
  $ hg purge -p -X .svn -X '*/.svn'
9bab9ee901e8 tests: unify test-purge
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10119
diff changeset
   216
  $ hg purge -p -X re:.*.svn