tests/test-remove
changeset 12099 54c9549ccb22
parent 12098 12108d7f2ce1
child 12100 4d6bb7615564
equal deleted inserted replaced
12098:12108d7f2ce1 12099:54c9549ccb22
     1 #!/bin/sh
       
     2 
       
     3 remove() {
       
     4     hg rm $@
       
     5     hg st
       
     6     # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5
       
     7     find . -name .hg -prune -o -type f -print | sort
       
     8     hg up -C
       
     9 }
       
    10 
       
    11 hg init a
       
    12 cd a
       
    13 echo a > foo
       
    14 
       
    15 echo % file not managed
       
    16 remove foo
       
    17 
       
    18 hg add foo
       
    19 hg commit -m1
       
    20 
       
    21 # the table cases
       
    22 
       
    23 echo % 00 state added, options none
       
    24 echo b > bar
       
    25 hg add bar
       
    26 remove bar
       
    27 
       
    28 echo % 01 state clean, options none
       
    29 remove foo
       
    30 
       
    31 echo % 02 state modified, options none
       
    32 echo b >> foo
       
    33 remove foo
       
    34 
       
    35 echo % 03 state missing, options none
       
    36 rm foo
       
    37 remove foo
       
    38 
       
    39 echo % 10 state added, options -f
       
    40 echo b > bar
       
    41 hg add bar
       
    42 remove -f bar
       
    43 rm bar
       
    44 
       
    45 echo % 11 state clean, options -f
       
    46 remove -f foo
       
    47 
       
    48 echo % 12 state modified, options -f
       
    49 echo b >> foo
       
    50 remove -f foo
       
    51 
       
    52 echo % 13 state missing, options -f
       
    53 rm foo
       
    54 remove -f foo
       
    55 
       
    56 echo % 20 state added, options -A
       
    57 echo b > bar
       
    58 hg add bar
       
    59 remove -A bar
       
    60 
       
    61 echo % 21 state clean, options -A
       
    62 remove -A foo
       
    63 
       
    64 echo % 22 state modified, options -A
       
    65 echo b >> foo
       
    66 remove -A foo
       
    67 
       
    68 echo % 23 state missing, options -A
       
    69 rm foo
       
    70 remove -A foo
       
    71 
       
    72 echo % 30 state added, options -Af
       
    73 echo b > bar
       
    74 hg add bar
       
    75 remove -Af bar
       
    76 rm bar
       
    77 
       
    78 echo % 31 state clean, options -Af
       
    79 remove -Af foo
       
    80 
       
    81 echo % 32 state modified, options -Af
       
    82 echo b >> foo
       
    83 remove -Af foo
       
    84 
       
    85 echo % 33 state missing, options -Af
       
    86 rm foo
       
    87 remove -Af foo
       
    88 
       
    89 # test some directory stuff
       
    90 
       
    91 mkdir test
       
    92 echo a > test/foo
       
    93 echo b > test/bar
       
    94 hg ci -Am2
       
    95 
       
    96 echo % dir, options none
       
    97 rm test/bar
       
    98 remove test
       
    99 
       
   100 echo % dir, options -f
       
   101 rm test/bar
       
   102 remove -f test
       
   103 
       
   104 echo % dir, options -A
       
   105 rm test/bar
       
   106 remove -A test
       
   107 
       
   108 echo % dir, options -Af
       
   109 rm test/bar
       
   110 remove -Af test
       
   111 
       
   112 echo 'test remove dropping empty trees (issue1861)'
       
   113 mkdir -p issue1861/b/c
       
   114 echo x > issue1861/x
       
   115 echo y > issue1861/b/c/y
       
   116 hg ci -Am add
       
   117 hg rm issue1861/b
       
   118 hg ci -m remove
       
   119 ls issue1861