##// END OF EJS Templates
test-revert: add revert --all case when nothing changed...
Adrian Buehlmann -
r14767:aab323df stable
parent child Browse files
Show More
@@ -1,273 +1,274 b''
1 $ hg init repo
1 $ hg init repo
2 $ cd repo
2 $ cd repo
3 $ echo 123 > a
3 $ echo 123 > a
4 $ echo 123 > c
4 $ echo 123 > c
5 $ echo 123 > e
5 $ echo 123 > e
6 $ hg add a c e
6 $ hg add a c e
7 $ hg commit -m "first" a c e
7 $ hg commit -m "first" a c e
8
8
9 nothing changed
9 nothing changed
10
10
11 $ hg revert
11 $ hg revert
12 abort: no files or directories specified
12 abort: no files or directories specified
13 (use --all to revert all files)
13 (use --all to revert all files)
14 [255]
14 [255]
15 $ hg revert --all
15
16
16 $ echo 123 > b
17 $ echo 123 > b
17
18
18 should show b unknown
19 should show b unknown
19
20
20 $ hg status
21 $ hg status
21 ? b
22 ? b
22 $ echo 12 > c
23 $ echo 12 > c
23
24
24 should show b unknown and c modified
25 should show b unknown and c modified
25
26
26 $ hg status
27 $ hg status
27 M c
28 M c
28 ? b
29 ? b
29 $ hg add b
30 $ hg add b
30
31
31 should show b added and c modified
32 should show b added and c modified
32
33
33 $ hg status
34 $ hg status
34 M c
35 M c
35 A b
36 A b
36 $ hg rm a
37 $ hg rm a
37
38
38 should show a removed, b added and c modified
39 should show a removed, b added and c modified
39
40
40 $ hg status
41 $ hg status
41 M c
42 M c
42 A b
43 A b
43 R a
44 R a
44 $ hg revert a
45 $ hg revert a
45
46
46 should show b added, copy saved, and c modified
47 should show b added, copy saved, and c modified
47
48
48 $ hg status
49 $ hg status
49 M c
50 M c
50 A b
51 A b
51 $ hg revert b
52 $ hg revert b
52
53
53 should show b unknown, and c modified
54 should show b unknown, and c modified
54
55
55 $ hg status
56 $ hg status
56 M c
57 M c
57 ? b
58 ? b
58 $ hg revert --no-backup c
59 $ hg revert --no-backup c
59
60
60 should show unknown: b
61 should show unknown: b
61
62
62 $ hg status
63 $ hg status
63 ? b
64 ? b
64 $ hg add b
65 $ hg add b
65
66
66 should show b added
67 should show b added
67
68
68 $ hg status b
69 $ hg status b
69 A b
70 A b
70 $ rm b
71 $ rm b
71
72
72 should show b deleted
73 should show b deleted
73
74
74 $ hg status b
75 $ hg status b
75 ! b
76 ! b
76 $ hg revert -v b
77 $ hg revert -v b
77 forgetting b
78 forgetting b
78
79
79 should not find b
80 should not find b
80
81
81 $ hg status b
82 $ hg status b
82 b: No such file or directory
83 b: No such file or directory
83
84
84 should show a c e
85 should show a c e
85
86
86 $ ls
87 $ ls
87 a
88 a
88 c
89 c
89 e
90 e
90
91
91 should verbosely save backup to e.orig
92 should verbosely save backup to e.orig
92
93
93 $ echo z > e
94 $ echo z > e
94 $ hg revert --all -v
95 $ hg revert --all -v
95 saving current version of e as e.orig
96 saving current version of e as e.orig
96 reverting e
97 reverting e
97
98
98 should say no changes needed
99 should say no changes needed
99
100
100 $ hg revert a
101 $ hg revert a
101 no changes needed to a
102 no changes needed to a
102
103
103 should say file not managed
104 should say file not managed
104
105
105 $ echo q > q
106 $ echo q > q
106 $ hg revert q
107 $ hg revert q
107 file not managed: q
108 file not managed: q
108 $ rm q
109 $ rm q
109
110
110 should say file not found
111 should say file not found
111
112
112 $ hg revert notfound
113 $ hg revert notfound
113 notfound: no such file in rev 334a9e57682c
114 notfound: no such file in rev 334a9e57682c
114 $ touch d
115 $ touch d
115 $ hg add d
116 $ hg add d
116 $ hg rm a
117 $ hg rm a
117 $ hg commit -m "second"
118 $ hg commit -m "second"
118 $ echo z > z
119 $ echo z > z
119 $ hg add z
120 $ hg add z
120 $ hg st
121 $ hg st
121 A z
122 A z
122 ? e.orig
123 ? e.orig
123
124
124 should add a, remove d, forget z
125 should add a, remove d, forget z
125
126
126 $ hg revert --all -r0
127 $ hg revert --all -r0
127 adding a
128 adding a
128 removing d
129 removing d
129 forgetting z
130 forgetting z
130
131
131 should forget a, undelete d
132 should forget a, undelete d
132
133
133 $ hg revert --all -rtip
134 $ hg revert --all -rtip
134 forgetting a
135 forgetting a
135 undeleting d
136 undeleting d
136 $ rm a *.orig
137 $ rm a *.orig
137
138
138 should silently add a
139 should silently add a
139
140
140 $ hg revert -r0 a
141 $ hg revert -r0 a
141 $ hg st a
142 $ hg st a
142 A a
143 A a
143 $ hg rm d
144 $ hg rm d
144 $ hg st d
145 $ hg st d
145 R d
146 R d
146
147
147 should silently keep d removed
148 should silently keep d removed
148
149
149 $ hg revert -r0 d
150 $ hg revert -r0 d
150 $ hg st d
151 $ hg st d
151 R d
152 R d
152
153
153 $ hg update -C
154 $ hg update -C
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 $ chmod +x c
156 $ chmod +x c
156 $ hg revert --all
157 $ hg revert --all
157 reverting c
158 reverting c
158
159
159 should print non-executable
160 should print non-executable
160
161
161 $ test -x c || echo non-executable
162 $ test -x c || echo non-executable
162 non-executable
163 non-executable
163
164
164 $ chmod +x c
165 $ chmod +x c
165 $ hg commit -m exe
166 $ hg commit -m exe
166
167
167 $ chmod -x c
168 $ chmod -x c
168 $ hg revert --all
169 $ hg revert --all
169 reverting c
170 reverting c
170
171
171 should print executable
172 should print executable
172
173
173 $ test -x c && echo executable
174 $ test -x c && echo executable
174 executable
175 executable
175
176
176 $ cd ..
177 $ cd ..
177
178
178
179
179 Issue241: update and revert produces inconsistent repositories
180 Issue241: update and revert produces inconsistent repositories
180
181
181 $ hg init a
182 $ hg init a
182 $ cd a
183 $ cd a
183 $ echo a >> a
184 $ echo a >> a
184 $ hg commit -A -d '1 0' -m a
185 $ hg commit -A -d '1 0' -m a
185 adding a
186 adding a
186 $ echo a >> a
187 $ echo a >> a
187 $ hg commit -d '2 0' -m a
188 $ hg commit -d '2 0' -m a
188 $ hg update 0
189 $ hg update 0
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 $ mkdir b
191 $ mkdir b
191 $ echo b > b/b
192 $ echo b > b/b
192
193
193 should fail - no arguments
194 should fail - no arguments
194
195
195 $ hg revert -rtip
196 $ hg revert -rtip
196 abort: no files or directories specified
197 abort: no files or directories specified
197 (use --all to revert all files, or 'hg update 1' to update)
198 (use --all to revert all files, or 'hg update 1' to update)
198 [255]
199 [255]
199
200
200 should succeed
201 should succeed
201
202
202 $ hg revert --all -rtip
203 $ hg revert --all -rtip
203 reverting a
204 reverting a
204
205
205
206
206 Issue332: confusing message when reverting directory
207 Issue332: confusing message when reverting directory
207
208
208 $ hg ci -A -m b
209 $ hg ci -A -m b
209 adding b/b
210 adding b/b
210 created new head
211 created new head
211 $ echo foobar > b/b
212 $ echo foobar > b/b
212 $ mkdir newdir
213 $ mkdir newdir
213 $ echo foo > newdir/newfile
214 $ echo foo > newdir/newfile
214 $ hg add newdir/newfile
215 $ hg add newdir/newfile
215 $ hg revert b newdir
216 $ hg revert b newdir
216 reverting b/b
217 reverting b/b
217 forgetting newdir/newfile
218 forgetting newdir/newfile
218 $ echo foobar > b/b
219 $ echo foobar > b/b
219 $ hg revert .
220 $ hg revert .
220 reverting b/b
221 reverting b/b
221
222
222
223
223 reverting a rename target should revert the source
224 reverting a rename target should revert the source
224
225
225 $ hg mv a newa
226 $ hg mv a newa
226 $ hg revert newa
227 $ hg revert newa
227 $ hg st a newa
228 $ hg st a newa
228 ? newa
229 ? newa
229
230
230 $ cd ..
231 $ cd ..
231
232
232 $ hg init ignored
233 $ hg init ignored
233 $ cd ignored
234 $ cd ignored
234 $ echo '^ignored$' > .hgignore
235 $ echo '^ignored$' > .hgignore
235 $ echo '^ignoreddir$' >> .hgignore
236 $ echo '^ignoreddir$' >> .hgignore
236 $ echo '^removed$' >> .hgignore
237 $ echo '^removed$' >> .hgignore
237
238
238 $ mkdir ignoreddir
239 $ mkdir ignoreddir
239 $ touch ignoreddir/file
240 $ touch ignoreddir/file
240 $ touch ignoreddir/removed
241 $ touch ignoreddir/removed
241 $ touch ignored
242 $ touch ignored
242 $ touch removed
243 $ touch removed
243
244
244 4 ignored files (we will add/commit everything)
245 4 ignored files (we will add/commit everything)
245
246
246 $ hg st -A -X .hgignore
247 $ hg st -A -X .hgignore
247 I ignored
248 I ignored
248 I ignoreddir/file
249 I ignoreddir/file
249 I ignoreddir/removed
250 I ignoreddir/removed
250 I removed
251 I removed
251 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
252 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
252
253
253 $ echo >> ignored
254 $ echo >> ignored
254 $ echo >> ignoreddir/file
255 $ echo >> ignoreddir/file
255 $ hg rm removed ignoreddir/removed
256 $ hg rm removed ignoreddir/removed
256
257
257 should revert ignored* and undelete *removed
258 should revert ignored* and undelete *removed
258
259
259 $ hg revert -a --no-backup
260 $ hg revert -a --no-backup
260 reverting ignored
261 reverting ignored
261 reverting ignoreddir/file
262 reverting ignoreddir/file
262 undeleting ignoreddir/removed
263 undeleting ignoreddir/removed
263 undeleting removed
264 undeleting removed
264 $ hg st -mardi
265 $ hg st -mardi
265
266
266 $ hg up -qC
267 $ hg up -qC
267 $ echo >> ignored
268 $ echo >> ignored
268 $ hg rm removed
269 $ hg rm removed
269
270
270 should silently revert the named files
271 should silently revert the named files
271
272
272 $ hg revert --no-backup ignored removed
273 $ hg revert --no-backup ignored removed
273 $ hg st -mardi
274 $ hg st -mardi
General Comments 0
You need to be logged in to leave comments. Login now