##// 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() {
13 file not managed
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
14
11 hg init a
15 $ remove foo
12 cd a
16 not removing foo: file is untracked
13 echo a > foo
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
27 $ echo b > bar
16 remove foo
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
36 01 state clean, options none
19 hg commit -m1
20
21 # the table cases
22
37
23 echo % 00 state added, options none
38 $ remove foo
24 echo b > bar
39 R foo
25 hg add bar
40 ? bar
26 remove 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
46 $ echo b >> foo
29 remove 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
57 $ rm foo
32 echo b >> foo
58 $ remove foo
33 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
66 $ echo b > bar
36 rm foo
67 $ hg add bar
37 remove foo
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
75 11 state clean, options -f
40 echo b > bar
76
41 hg add bar
77 $ remove -f foo
42 remove -f bar
78 R foo
43 rm bar
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
83 $ echo b >> foo
46 remove -f 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
90 $ rm foo
49 echo b >> foo
91 $ remove -f foo
50 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
97 $ echo b > bar
53 rm foo
98 $ hg add bar
54 remove -f foo
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
106 21 state clean, options -A
57 echo b > bar
107
58 hg add bar
108 $ remove -A foo
59 remove -A bar
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
117 $ echo b >> foo
62 remove -A 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
126 23 state missing, options -A
65 echo b >> foo
66 remove -A foo
67
127
68 echo % 23 state missing, options -A
128 $ rm foo
69 rm foo
129 $ remove -A foo
70 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
137 $ echo b > bar
73 echo b > bar
138 $ hg add bar
74 hg add bar
139 $ remove -Af bar
75 remove -Af bar
140 ? bar
76 rm 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
146 31 state clean, options -Af
79 remove -Af foo
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
153 32 state modified, options -Af
82 echo b >> foo
154
83 remove -Af foo
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
161 33 state missing, options -Af
86 rm foo
87 remove -Af foo
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
170 $ mkdir test
92 echo a > test/foo
171 $ echo a > test/foo
93 echo b > test/bar
172 $ echo b > test/bar
94 hg ci -Am2
173 $ hg ci -Am2
174 adding test/bar
175 adding test/foo
176
177 dir, options none
95
178
96 echo % dir, options none
179 $ rm test/bar
97 rm test/bar
180 $ remove test
98 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
190 $ rm test/bar
101 rm test/bar
191 $ remove -f test
102 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
201 $ rm test/bar
105 rm test/bar
202 $ remove -A test
106 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
210 dir, options -Af
109 rm test/bar
110 remove -Af test
111
211
112 echo 'test remove dropping empty trees (issue1861)'
212 $ rm test/bar
113 mkdir -p issue1861/b/c
213 $ remove -Af test
114 echo x > issue1861/x
214 removing test/bar
115 echo y > issue1861/b/c/y
215 removing test/foo
116 hg ci -Am add
216 R test/bar
117 hg rm issue1861/b
217 R test/foo
118 hg ci -m remove
218 ./foo
119 ls issue1861
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
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now