tests/test-remove
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
Thu, 10 Jun 2010 11:49:48 +0200
changeset 11337 0f3c8a47960e
parent 9572 1f665246dab3
child 12129 07ac2a560fce
permissions -rwxr-xr-x
debugbuilddag: build a changelog dag from a concise description Useful in tests to quickly build a complex DAG in an empty repo. Handles local tags and named branches. Options to, at each rev, - create a new file, - overwrite the same file, - append to the same file, - write to a specific line in a mergeable file. Can run shell commands during DAG buildup.
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
6356
b34b876d1f6f test-remove: make it pass on Mac OS X 10.5
Florent Guillaume <fg@nuxeo.com>
parents: 6346
diff changeset
     6
    # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5
6358
7cb9af02e250 test-remove: make tests really pass
Florent Guillaume <fg@nuxeo.com>
parents: 6357
diff changeset
     7
    find . -name .hg -prune -o -type f -print | sort
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     8
    hg up -C
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
     9
}
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    10
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    11
hg init a
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    12
cd a
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    13
echo a > foo
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    14
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    15
echo % file not managed
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    16
remove foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    17
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    18
hg add foo
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    19
hg commit -m1
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    20
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    21
# the table cases
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    22
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    23
echo % 00 state added, options none
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    24
echo b > bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    25
hg add bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    26
remove bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    27
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    28
echo % 01 state clean, options none
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    29
remove foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    30
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    31
echo % 02 state modified, options none
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    32
echo b >> foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    33
remove foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    34
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    35
echo % 03 state missing, options none
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    36
rm foo
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    37
remove foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    38
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    39
echo % 10 state added, options -f
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    40
echo b > bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    41
hg add bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    42
remove -f bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    43
rm bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    44
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    45
echo % 11 state clean, options -f
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    46
remove -f foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    47
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    48
echo % 12 state modified, options -f
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    49
echo b >> foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    50
remove -f foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    51
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    52
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
    53
rm foo
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    54
remove -f foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    55
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    56
echo % 20 state added, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    57
echo b > bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    58
hg add bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    59
remove -A bar
936
b62d1e738fa9 Add a simple remove test
mpm@selenic.com
parents:
diff changeset
    60
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    61
echo % 21 state clean, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    62
remove -A foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    63
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    64
echo % 22 state modified, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    65
echo b >> foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    66
remove -A foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    67
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    68
echo % 23 state missing, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    69
rm foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    70
remove -A foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    71
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    72
echo % 30 state added, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    73
echo b > bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    74
hg add bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    75
remove -Af bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    76
rm bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    77
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    78
echo % 31 state clean, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    79
remove -Af foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    80
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    81
echo % 32 state modified, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    82
echo b >> foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    83
remove -Af foo
2309
b2f37c7026ca remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2180
diff changeset
    84
6346
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    85
echo % 33 state missing, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    86
rm foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    87
remove -Af foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    88
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    89
# test some directory stuff
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    90
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    91
mkdir test
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    92
echo a > test/foo
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    93
echo b > test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    94
hg ci -Am2
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    95
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    96
echo % dir, options none
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    97
rm test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    98
remove test
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
    99
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   100
echo % dir, options -f
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   101
rm test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   102
remove -f test
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   103
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   104
echo % dir, options -A
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   105
rm test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   106
remove -A test
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   107
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   108
echo % dir, options -Af
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   109
rm test/bar
8e3b651382f5 improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 4394
diff changeset
   110
remove -Af test
9572
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   111
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   112
echo 'test remove dropping empty trees (issue1861)'
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   113
mkdir -p issue1861/b/c
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   114
echo x > issue1861/x
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   115
echo y > issue1861/b/c/y
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   116
hg ci -Am add
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   117
hg rm issue1861/b
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   118
hg ci -m remove
1f665246dab3 windows: fix unlink() not dropping empty tree (issue1861)
Patrick Mezard <pmezard@gmail.com>
parents: 6358
diff changeset
   119
ls issue1861