tests/test-remove
author Dirkjan Ochtman <dirkjan@ochtman.nl>
Sat, 22 Mar 2008 10:07:49 +0100
changeset 6346 8e3b651382f5
parent 4394 a6436e9333db
child 6356 b34b876d1f6f
permissions -rwxr-xr-x
improved semantics for remove (issue438) - Added files are never deleted (only removed with --force). - Modified files can only be removed with --force. - With --after, only deleted files are removed. - With --after --force, all files are removed but not deleted.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
     1
#!/bin/sh
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
     2
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     3
remove() {
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     4
    hg rm $@
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     5
    hg st
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     6
    ls -R
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     7
    hg up -C
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     8
}
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     9
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    10
hg init a
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    11
cd a
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    12
echo a > foo
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    13
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    14
echo % file not managed
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    15
remove foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    16
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    17
hg add foo
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    18
hg commit -m1
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    19
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    20
# the table cases
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    21
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    22
echo % 00 state added, options none
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    23
echo b > bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    24
hg add bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    25
remove bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    26
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    27
echo % 01 state clean, options none
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    28
remove foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    29
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    30
echo % 02 state modified, options none
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    31
echo b >> foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    32
remove foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    33
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    34
echo % 03 state missing, options none
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    35
rm foo
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    36
remove foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    37
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    38
echo % 10 state added, options -f
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    39
echo b > bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    40
hg add bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    41
remove -f bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    42
rm bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    43
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    44
echo % 11 state clean, options -f
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    45
remove -f foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    46
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    47
echo % 12 state modified, options -f
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    48
echo b >> foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    49
remove -f foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    50
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    51
echo % 13 state missing, options -f
2180
82385773df6c make test-remove check some more cases.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1953
diff changeset
    52
rm foo
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    53
remove -f foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    54
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    55
echo % 20 state added, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    56
echo b > bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    57
hg add bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    58
remove -A bar
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    59
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    60
echo % 21 state clean, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    61
remove -A foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    62
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    63
echo % 22 state modified, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    64
echo b >> foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    65
remove -A foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    66
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    67
echo % 23 state missing, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    68
rm foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    69
remove -A foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    70
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    71
echo % 30 state added, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    72
echo b > bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    73
hg add bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    74
remove -Af bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    75
rm bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    76
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    77
echo % 31 state clean, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    78
remove -Af foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    79
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    80
echo % 32 state modified, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    81
echo b >> foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    82
remove -Af foo
2309
b2f37c7026ca remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2180
diff changeset
    83
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    84
echo % 33 state missing, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    85
rm foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    86
remove -Af foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    87
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    88
# test some directory stuff
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    89
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    90
mkdir test
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    91
echo a > test/foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    92
echo b > test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    93
hg ci -Am2
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    94
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    95
echo % dir, options none
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    96
rm test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    97
remove test
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    98
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    99
echo % dir, options -f
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   100
rm test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   101
remove -f test
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   102
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   103
echo % dir, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   104
rm test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   105
remove -A test
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   106
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   107
echo % dir, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   108
rm test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   109
remove -Af test