##// END OF EJS Templates
tests: unify test-purge
Nicolas Dumazet -
r12122:9bab9ee9 default
parent child Browse files
Show More
@@ -1,138 +1,216
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
11 setup
4 [extensions]
5 purge =
6 EOF
7
12
8 echo % init
13 $ echo r1 > r1
9 hg init t
14 $ hg ci -qAmr1 -d'0 0'
10 cd t
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
23 $ mkdir empty_dir
13 echo r1 > r1
24 $ hg purge -p
14 hg ci -qAmr1 -d'0 0'
25 empty_dir
15 mkdir directory
26 $ hg purge -v
16 echo r2 > directory/r2
27 Removing directory empty_dir
17 hg ci -qAmr2 -d'1 0'
28 $ ls
18 echo 'ignored' > .hgignore
29 directory
19 hg ci -qAmr3 -d'2 0'
30 r1
31
32 delete an untracked directory
20
33
21 echo % delete an empty directory
34 $ mkdir untracked_dir
22 mkdir empty_dir
35 $ touch untracked_dir/untracked_file1
23 hg purge -p
36 $ touch untracked_dir/untracked_file2
24 hg purge -v
37 $ hg purge -p
25 ls
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
50 $ touch untracked_file
28 mkdir untracked_dir
51 $ touch untracked_file_readonly
29 touch untracked_dir/untracked_file1
52 $ python <<EOF
30 touch untracked_dir/untracked_file2
53 > import os, stat
31 hg purge -p
54 > f= 'untracked_file_readonly'
32 hg purge -v
55 > os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE)
33 ls
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 echo % delete an untracked file
67 delete an untracked file in a tracked directory
36 touch untracked_file
68
37 touch untracked_file_readonly
69 $ touch directory/untracked_file
38 python <<EOF
70 $ hg purge -p
39 import os, stat
71 directory/untracked_file
40 f= 'untracked_file_readonly'
72 $ hg purge -v
41 os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE)
73 Removing file directory/untracked_file
42 EOF
74 $ ls
43 hg purge -p
75 directory
44 hg purge -v
76 r1
45 ls
46
77
47 echo % delete an untracked file in a tracked directory
78 delete nested directories
48 touch directory/untracked_file
79
49 hg purge -p
80 $ mkdir -p untracked_directory/nested_directory
50 hg purge -v
81 $ hg purge -p
51 ls
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
92 $ mkdir -p untracked_directory/nested_directory
54 mkdir -p untracked_directory/nested_directory
93 $ cd directory
55 hg purge -p
94 $ hg purge -p
56 hg purge -v
95 untracked_directory/nested_directory
57 ls
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
104 delete only part of the tree
60 mkdir -p untracked_directory/nested_directory
61 cd directory
62 hg purge -p
63 hg purge -v
64 cd ..
65 ls
66
105
67 echo % delete only part of the tree
106 $ mkdir -p untracked_directory/nested_directory
68 mkdir -p untracked_directory/nested_directory
107 $ touch directory/untracked_file
69 touch directory/untracked_file
108 $ cd directory
70 cd directory
109 $ hg purge -p ../untracked_directory
71 hg purge -p ../untracked_directory
110 untracked_directory/nested_directory
72 hg purge -v ../untracked_directory
111 $ hg purge -v ../untracked_directory
73 cd ..
112 Removing directory untracked_directory/nested_directory
74 ls
113 Removing directory untracked_directory
75 ls directory/untracked_file
114 $ cd ..
76 rm directory/untracked_file
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
124 $ touch ignored
79 touch ignored
125 $ hg purge -p
80 hg purge -p
126 $ hg purge -v
81 hg purge -v
127 $ ls
82 ls
128 directory
83 hg purge -p --all
129 ignored
84 hg purge -v --all
130 r1
85 ls
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
141 $ touch untracked_file
88 touch untracked_file
142 $ rm r1
89 rm r1
143
90 # hide error messages to avoid changing the output when the text changes
144 hide error messages to avoid changing the output when the text changes
91 hg purge -p 2> /dev/null
92 hg st
93
145
94 hg purge -p
146 $ hg purge -p 2> /dev/null
95 hg purge -v 2> /dev/null
147 untracked_file
96 hg st
148 $ hg st
149 ! r1
150 ? untracked_file
97
151
98 hg purge -v
152 $ hg purge -p
99 hg revert --all --quiet
153 untracked_file
100 hg st -a
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)'
159 $ hg purge -v
103 echo directory >> .hgignore
160 $ hg revert --all --quiet
104 hg ci -m 'ignore directory'
161 $ hg st -a
105 touch untracked_file
162
106 hg purge -p
163 tracked file in ignored directory (issue621)
107 hg purge -v
108
164
109 echo % skip excluded files
165 $ echo directory >> .hgignore
110 touch excluded_file
166 $ hg ci -m 'ignore directory'
111 hg purge -p -X excluded_file
167 $ touch untracked_file
112 hg purge -v -X excluded_file
168 $ hg purge -p
113 ls
169 untracked_file
114 rm excluded_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
186 $ mkdir excluded_dir
117 mkdir excluded_dir
187 $ touch excluded_dir/file
118 touch excluded_dir/file
188 $ hg purge -p -X excluded_dir
119 hg purge -p -X excluded_dir
189 $ hg purge -v -X excluded_dir
120 hg purge -v -X excluded_dir
190 $ ls
121 ls
191 directory
122 ls excluded_dir
192 excluded_dir
123 rm -R excluded_dir
193 r1
194 $ ls excluded_dir
195 file
196 $ rm -R excluded_dir
197
198 skip excluded empty dirs
124
199
125 echo % skip excluded empty dirs
200 $ mkdir excluded_dir
126 mkdir excluded_dir
201 $ hg purge -p -X excluded_dir
127 hg purge -p -X excluded_dir
202 $ hg purge -v -X excluded_dir
128 hg purge -v -X excluded_dir
203 $ ls
129 ls
204 directory
130 rmdir excluded_dir
205 excluded_dir
206 r1
207 $ rmdir excluded_dir
131
208
132 echo % skip patterns
209 skip patterns
133 mkdir .svn
210
134 touch .svn/foo
211 $ mkdir .svn
135 mkdir directory/.svn
212 $ touch .svn/foo
136 touch directory/.svn/foo
213 $ mkdir directory/.svn
137 hg purge -p -X .svn -X '*/.svn'
214 $ touch directory/.svn/foo
138 hg purge -p -X re:.*.svn
215 $ hg purge -p -X .svn -X '*/.svn'
216 $ hg purge -p -X re:.*.svn
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