##// END OF EJS Templates
tests: unify test-remove
Nicolas Dumazet -
r12099:54c9549c default
parent child Browse files
Show More
@@ -1,119 +1,234 b''
1 #!/bin/sh
1 $ remove() {
2 > hg rm $@
3 > hg st
4 > # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5
5 > find . -name .hg -prune -o -type f -print | sort
6 > hg up -C
7 > }
8
9 $ hg init a
10 $ cd a
11 $ echo a > foo
2 12
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 }
13 file not managed
10 14
11 hg init a
12 cd a
13 echo a > foo
15 $ remove foo
16 not removing foo: file is untracked
17 ? foo
18 ./foo
19 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
20
21 $ hg add foo
22 $ hg commit -m1
23
24 the table cases
25 00 state added, options none
14 26
15 echo % file not managed
16 remove foo
27 $ echo b > bar
28 $ hg add bar
29 $ remove bar
30 not removing bar: file has been marked for add (use -f to force removal)
31 A bar
32 ./bar
33 ./foo
34 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 35
18 hg add foo
19 hg commit -m1
20
21 # the table cases
36 01 state clean, options none
22 37
23 echo % 00 state added, options none
24 echo b > bar
25 hg add bar
26 remove bar
38 $ remove foo
39 R foo
40 ? bar
41 ./bar
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43
44 02 state modified, options none
27 45
28 echo % 01 state clean, options none
29 remove foo
46 $ echo b >> foo
47 $ remove foo
48 not removing foo: file is modified (use -f to force removal)
49 M foo
50 ? bar
51 ./bar
52 ./foo
53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
54
55 03 state missing, options none
30 56
31 echo % 02 state modified, options none
32 echo b >> foo
33 remove foo
57 $ rm foo
58 $ remove foo
59 R foo
60 ? bar
61 ./bar
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63
64 10 state added, options -f
34 65
35 echo % 03 state missing, options none
36 rm foo
37 remove foo
66 $ echo b > bar
67 $ hg add bar
68 $ remove -f bar
69 ? bar
70 ./bar
71 ./foo
72 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 $ rm bar
38 74
39 echo % 10 state added, options -f
40 echo b > bar
41 hg add bar
42 remove -f bar
43 rm bar
75 11 state clean, options -f
76
77 $ remove -f foo
78 R foo
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80
81 12 state modified, options -f
44 82
45 echo % 11 state clean, options -f
46 remove -f foo
83 $ echo b >> foo
84 $ remove -f foo
85 R foo
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
87
88 13 state missing, options -f
47 89
48 echo % 12 state modified, options -f
49 echo b >> foo
50 remove -f foo
90 $ rm foo
91 $ remove -f foo
92 R foo
93 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94
95 20 state added, options -A
51 96
52 echo % 13 state missing, options -f
53 rm foo
54 remove -f foo
97 $ echo b > bar
98 $ hg add bar
99 $ remove -A bar
100 not removing bar: file still exists (use -f to force removal)
101 A bar
102 ./bar
103 ./foo
104 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 105
56 echo % 20 state added, options -A
57 echo b > bar
58 hg add bar
59 remove -A bar
106 21 state clean, options -A
107
108 $ remove -A foo
109 not removing foo: file still exists (use -f to force removal)
110 ? bar
111 ./bar
112 ./foo
113 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
114
115 22 state modified, options -A
60 116
61 echo % 21 state clean, options -A
62 remove -A foo
117 $ echo b >> foo
118 $ remove -A foo
119 not removing foo: file still exists (use -f to force removal)
120 M foo
121 ? bar
122 ./bar
123 ./foo
124 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 125
64 echo % 22 state modified, options -A
65 echo b >> foo
66 remove -A foo
126 23 state missing, options -A
67 127
68 echo % 23 state missing, options -A
69 rm foo
70 remove -A foo
128 $ rm foo
129 $ remove -A foo
130 R foo
131 ? bar
132 ./bar
133 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
134
135 30 state added, options -Af
71 136
72 echo % 30 state added, options -Af
73 echo b > bar
74 hg add bar
75 remove -Af bar
76 rm bar
137 $ echo b > bar
138 $ hg add bar
139 $ remove -Af bar
140 ? bar
141 ./bar
142 ./foo
143 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
144 $ rm bar
77 145
78 echo % 31 state clean, options -Af
79 remove -Af foo
146 31 state clean, options -Af
147
148 $ remove -Af foo
149 R foo
150 ./foo
151 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 152
81 echo % 32 state modified, options -Af
82 echo b >> foo
83 remove -Af foo
153 32 state modified, options -Af
154
155 $ echo b >> foo
156 $ remove -Af foo
157 R foo
158 ./foo
159 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 160
85 echo % 33 state missing, options -Af
86 rm foo
87 remove -Af foo
161 33 state missing, options -Af
88 162
89 # test some directory stuff
163 $ rm foo
164 $ remove -Af foo
165 R foo
166 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
167
168 test some directory stuff
90 169
91 mkdir test
92 echo a > test/foo
93 echo b > test/bar
94 hg ci -Am2
170 $ mkdir test
171 $ echo a > test/foo
172 $ echo b > test/bar
173 $ hg ci -Am2
174 adding test/bar
175 adding test/foo
176
177 dir, options none
95 178
96 echo % dir, options none
97 rm test/bar
98 remove test
179 $ rm test/bar
180 $ remove test
181 removing test/bar
182 removing test/foo
183 R test/bar
184 R test/foo
185 ./foo
186 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
187
188 dir, options -f
99 189
100 echo % dir, options -f
101 rm test/bar
102 remove -f test
190 $ rm test/bar
191 $ remove -f test
192 removing test/bar
193 removing test/foo
194 R test/bar
195 R test/foo
196 ./foo
197 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
198
199 dir, options -A
103 200
104 echo % dir, options -A
105 rm test/bar
106 remove -A test
201 $ rm test/bar
202 $ remove -A test
203 not removing test/foo: file still exists (use -f to force removal)
204 removing test/bar
205 R test/bar
206 ./foo
207 ./test/foo
208 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 209
108 echo % dir, options -Af
109 rm test/bar
110 remove -Af test
210 dir, options -Af
111 211
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
212 $ rm test/bar
213 $ remove -Af test
214 removing test/bar
215 removing test/foo
216 R test/bar
217 R test/foo
218 ./foo
219 ./test/foo
220 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
221
222 test remove dropping empty trees (issue1861)
223
224 $ mkdir -p issue1861/b/c
225 $ echo x > issue1861/x
226 $ echo y > issue1861/b/c/y
227 $ hg ci -Am add
228 adding issue1861/b/c/y
229 adding issue1861/x
230 $ hg rm issue1861/b
231 removing issue1861/b/c/y
232 $ hg ci -m remove
233 $ ls issue1861
234 x
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now