Mercurial > hg
comparison tests/test-purge.t @ 12122:9bab9ee901e8
tests: unify test-purge
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 18:50:44 +0900 |
parents | tests/test-purge@bb5ea66789e3 |
children | f2719b387380 |
comparison
equal
deleted
inserted
replaced
12121:8f258dd4ed02 | 12122:9bab9ee901e8 |
---|---|
1 $ cat <<EOF >> $HGRCPATH | |
2 > [extensions] | |
3 > purge = | |
4 > EOF | |
5 | |
6 init | |
7 | |
8 $ hg init t | |
9 $ cd t | |
10 | |
11 setup | |
12 | |
13 $ echo r1 > r1 | |
14 $ hg ci -qAmr1 -d'0 0' | |
15 $ mkdir directory | |
16 $ echo r2 > directory/r2 | |
17 $ hg ci -qAmr2 -d'1 0' | |
18 $ echo 'ignored' > .hgignore | |
19 $ hg ci -qAmr3 -d'2 0' | |
20 | |
21 delete an empty directory | |
22 | |
23 $ mkdir empty_dir | |
24 $ hg purge -p | |
25 empty_dir | |
26 $ hg purge -v | |
27 Removing directory empty_dir | |
28 $ ls | |
29 directory | |
30 r1 | |
31 | |
32 delete an untracked directory | |
33 | |
34 $ mkdir untracked_dir | |
35 $ touch untracked_dir/untracked_file1 | |
36 $ touch untracked_dir/untracked_file2 | |
37 $ hg purge -p | |
38 untracked_dir/untracked_file1 | |
39 untracked_dir/untracked_file2 | |
40 $ hg purge -v | |
41 Removing file untracked_dir/untracked_file1 | |
42 Removing file untracked_dir/untracked_file2 | |
43 Removing directory untracked_dir | |
44 $ ls | |
45 directory | |
46 r1 | |
47 | |
48 delete an untracked file | |
49 | |
50 $ touch untracked_file | |
51 $ touch untracked_file_readonly | |
52 $ python <<EOF | |
53 > import os, stat | |
54 > f= 'untracked_file_readonly' | |
55 > os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE) | |
56 > EOF | |
57 $ hg purge -p | |
58 untracked_file | |
59 untracked_file_readonly | |
60 $ hg purge -v | |
61 Removing file untracked_file | |
62 Removing file untracked_file_readonly | |
63 $ ls | |
64 directory | |
65 r1 | |
66 | |
67 delete an untracked file in a tracked directory | |
68 | |
69 $ touch directory/untracked_file | |
70 $ hg purge -p | |
71 directory/untracked_file | |
72 $ hg purge -v | |
73 Removing file directory/untracked_file | |
74 $ ls | |
75 directory | |
76 r1 | |
77 | |
78 delete nested directories | |
79 | |
80 $ mkdir -p untracked_directory/nested_directory | |
81 $ hg purge -p | |
82 untracked_directory/nested_directory | |
83 $ hg purge -v | |
84 Removing directory untracked_directory/nested_directory | |
85 Removing directory untracked_directory | |
86 $ ls | |
87 directory | |
88 r1 | |
89 | |
90 delete nested directories from a subdir | |
91 | |
92 $ mkdir -p untracked_directory/nested_directory | |
93 $ cd directory | |
94 $ hg purge -p | |
95 untracked_directory/nested_directory | |
96 $ hg purge -v | |
97 Removing directory untracked_directory/nested_directory | |
98 Removing directory untracked_directory | |
99 $ cd .. | |
100 $ ls | |
101 directory | |
102 r1 | |
103 | |
104 delete only part of the tree | |
105 | |
106 $ mkdir -p untracked_directory/nested_directory | |
107 $ touch directory/untracked_file | |
108 $ cd directory | |
109 $ hg purge -p ../untracked_directory | |
110 untracked_directory/nested_directory | |
111 $ hg purge -v ../untracked_directory | |
112 Removing directory untracked_directory/nested_directory | |
113 Removing directory untracked_directory | |
114 $ cd .. | |
115 $ ls | |
116 directory | |
117 r1 | |
118 $ ls directory/untracked_file | |
119 directory/untracked_file | |
120 $ rm directory/untracked_file | |
121 | |
122 skip ignored files if --all not specified | |
123 | |
124 $ touch ignored | |
125 $ hg purge -p | |
126 $ hg purge -v | |
127 $ ls | |
128 directory | |
129 ignored | |
130 r1 | |
131 $ hg purge -p --all | |
132 ignored | |
133 $ hg purge -v --all | |
134 Removing file ignored | |
135 $ ls | |
136 directory | |
137 r1 | |
138 | |
139 abort with missing files until we support name mangling filesystems | |
140 | |
141 $ touch untracked_file | |
142 $ rm r1 | |
143 | |
144 hide error messages to avoid changing the output when the text changes | |
145 | |
146 $ hg purge -p 2> /dev/null | |
147 untracked_file | |
148 $ hg st | |
149 ! r1 | |
150 ? untracked_file | |
151 | |
152 $ hg purge -p | |
153 untracked_file | |
154 $ hg purge -v 2> /dev/null | |
155 Removing file untracked_file | |
156 $ hg st | |
157 ! r1 | |
158 | |
159 $ hg purge -v | |
160 $ hg revert --all --quiet | |
161 $ hg st -a | |
162 | |
163 tracked file in ignored directory (issue621) | |
164 | |
165 $ echo directory >> .hgignore | |
166 $ hg ci -m 'ignore directory' | |
167 $ touch untracked_file | |
168 $ hg purge -p | |
169 untracked_file | |
170 $ hg purge -v | |
171 Removing file untracked_file | |
172 | |
173 skip excluded files | |
174 | |
175 $ touch excluded_file | |
176 $ hg purge -p -X excluded_file | |
177 $ hg purge -v -X excluded_file | |
178 $ ls | |
179 directory | |
180 excluded_file | |
181 r1 | |
182 $ rm excluded_file | |
183 | |
184 skip files in excluded dirs | |
185 | |
186 $ mkdir excluded_dir | |
187 $ touch excluded_dir/file | |
188 $ hg purge -p -X excluded_dir | |
189 $ hg purge -v -X excluded_dir | |
190 $ ls | |
191 directory | |
192 excluded_dir | |
193 r1 | |
194 $ ls excluded_dir | |
195 file | |
196 $ rm -R excluded_dir | |
197 | |
198 skip excluded empty dirs | |
199 | |
200 $ mkdir excluded_dir | |
201 $ hg purge -p -X excluded_dir | |
202 $ hg purge -v -X excluded_dir | |
203 $ ls | |
204 directory | |
205 excluded_dir | |
206 r1 | |
207 $ rmdir excluded_dir | |
208 | |
209 skip patterns | |
210 | |
211 $ mkdir .svn | |
212 $ touch .svn/foo | |
213 $ mkdir directory/.svn | |
214 $ touch directory/.svn/foo | |
215 $ hg purge -p -X .svn -X '*/.svn' | |
216 $ hg purge -p -X re:.*.svn |