Show More
@@ -1,138 +1,216 b'' | |||
|
1 | #!/bin/sh | |
|
1 | $ cat <<EOF >> $HGRCPATH | |
|
2 | > [extensions] | |
|
3 | > purge = | |
|
4 | > EOF | |
|
5 | ||
|
6 | init | |
|
7 | ||
|
8 | $ hg init t | |
|
9 | $ cd t | |
|
2 | 10 | |
|
3 | cat <<EOF >> $HGRCPATH | |
|
4 | [extensions] | |
|
5 | purge = | |
|
6 | EOF | |
|
11 | setup | |
|
7 | 12 | |
|
8 | echo % init | |
|
9 | hg init t | |
|
10 | cd t | |
|
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 | |
|
11 | 22 | |
|
12 | echo % setup | |
|
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' | |
|
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 | |
|
20 | 33 | |
|
21 | echo % delete an empty directory | |
|
22 | mkdir empty_dir | |
|
23 | hg purge -p | |
|
24 |
hg purge - |
|
|
25 | ls | |
|
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 | |
|
26 | 49 | |
|
27 | echo % delete an untracked directory | |
|
28 | mkdir untracked_dir | |
|
29 | touch untracked_dir/untracked_file1 | |
|
30 | touch untracked_dir/untracked_file2 | |
|
31 | hg purge -p | |
|
32 | hg purge -v | |
|
33 | ls | |
|
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 | |
|
34 | 66 | |
|
35 |
|
|
|
36 | touch untracked_file | |
|
37 |
touch untracked_file |
|
|
38 | python <<EOF | |
|
39 | import os, stat | |
|
40 | f= 'untracked_file_readonly' | |
|
41 | os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE) | |
|
42 | EOF | |
|
43 | hg purge -p | |
|
44 | hg purge -v | |
|
45 | ls | |
|
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 | |
|
46 | 77 | |
|
47 | echo % delete an untracked file in a tracked directory | |
|
48 | touch directory/untracked_file | |
|
49 | hg purge -p | |
|
50 |
hg purge - |
|
|
51 | ls | |
|
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 | |
|
52 | 91 | |
|
53 | echo % delete nested directories | |
|
54 | mkdir -p untracked_directory/nested_directory | |
|
55 | hg purge -p | |
|
56 | hg purge -v | |
|
57 | ls | |
|
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 | |
|
58 | 103 | |
|
59 | echo % delete nested directories from a subdir | |
|
60 | mkdir -p untracked_directory/nested_directory | |
|
61 | cd directory | |
|
62 | hg purge -p | |
|
63 | hg purge -v | |
|
64 | cd .. | |
|
65 | ls | |
|
104 | delete only part of the tree | |
|
66 | 105 | |
|
67 | echo % delete only part of the tree | |
|
68 | mkdir -p untracked_directory/nested_directory | |
|
69 | touch directory/untracked_file | |
|
70 | cd directory | |
|
71 | hg purge -p ../untracked_directory | |
|
72 | hg purge -v ../untracked_directory | |
|
73 | cd .. | |
|
74 | ls | |
|
75 | ls directory/untracked_file | |
|
76 | rm directory/untracked_file | |
|
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 | |
|
77 | 123 | |
|
78 | echo % skip ignored files if --all not specified | |
|
79 | touch ignored | |
|
80 |
hg purge - |
|
|
81 | hg purge -v | |
|
82 | ls | |
|
83 | hg purge -p --all | |
|
84 | hg purge -v --all | |
|
85 | ls | |
|
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 | |
|
86 | 140 | |
|
87 | echo % abort with missing files until we support name mangling filesystems | |
|
88 | touch untracked_file | |
|
89 | rm r1 | |
|
90 |
|
|
|
91 | hg purge -p 2> /dev/null | |
|
92 | hg st | |
|
141 | $ touch untracked_file | |
|
142 | $ rm r1 | |
|
143 | ||
|
144 | hide error messages to avoid changing the output when the text changes | |
|
93 | 145 | |
|
94 | hg purge -p | |
|
95 | hg purge -v 2> /dev/null | |
|
96 | hg st | |
|
146 | $ hg purge -p 2> /dev/null | |
|
147 | untracked_file | |
|
148 | $ hg st | |
|
149 | ! r1 | |
|
150 | ? untracked_file | |
|
97 | 151 | |
|
98 |
hg purge - |
|
|
99 | hg revert --all --quiet | |
|
100 | hg st -a | |
|
152 | $ hg purge -p | |
|
153 | untracked_file | |
|
154 | $ hg purge -v 2> /dev/null | |
|
155 | Removing file untracked_file | |
|
156 | $ hg st | |
|
157 | ! r1 | |
|
101 | 158 | |
|
102 | echo '% tracked file in ignored directory (issue621)' | |
|
103 | echo directory >> .hgignore | |
|
104 | hg ci -m 'ignore directory' | |
|
105 | touch untracked_file | |
|
106 | hg purge -p | |
|
107 | hg purge -v | |
|
159 | $ hg purge -v | |
|
160 | $ hg revert --all --quiet | |
|
161 | $ hg st -a | |
|
162 | ||
|
163 | tracked file in ignored directory (issue621) | |
|
108 | 164 | |
|
109 | echo % skip excluded files | |
|
110 | touch excluded_file | |
|
111 | hg purge -p -X excluded_file | |
|
112 | hg purge -v -X excluded_file | |
|
113 | ls | |
|
114 | rm excluded_file | |
|
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 | |
|
115 | 185 | |
|
116 | echo % skip files in excluded dirs | |
|
117 | mkdir excluded_dir | |
|
118 | touch excluded_dir/file | |
|
119 |
hg purge - |
|
|
120 | hg purge -v -X excluded_dir | |
|
121 | ls | |
|
122 |
|
|
|
123 | rm -R excluded_dir | |
|
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 | |
|
124 | 199 | |
|
125 |
|
|
|
126 | mkdir excluded_dir | |
|
127 |
hg purge - |
|
|
128 | hg purge -v -X excluded_dir | |
|
129 | ls | |
|
130 |
|
|
|
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 | |
|
131 | 208 | |
|
132 |
|
|
|
133 | mkdir .svn | |
|
134 | touch .svn/foo | |
|
135 | mkdir directory/.svn | |
|
136 |
|
|
|
137 | hg purge -p -X .svn -X '*/.svn' | |
|
138 |
hg purge -p -X |
|
|
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 |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now