Show More
@@ -1,54 +1,86 b'' | |||
|
1 | # generate proper file state to test working copy behavior | |
|
1 | # Helper script used for generating history and working copy files and content. | |
|
2 | # The file's name corresponds to its history. The number of changesets can | |
|
3 | # be specified on the command line. With 2 changesets, files with names like | |
|
4 | # content1_content2_content1-untracked are generated. The first two filename | |
|
5 | # segments describe the contents in the two changesets. The third segment | |
|
6 | # ("content1-untracked") describes the state in the working copy, i.e. | |
|
7 | # the file has content "content1" and is untracked (since it was previously | |
|
8 | # tracked, it has been forgotten). | |
|
9 | # | |
|
10 | # This script generates the filenames and their content, but it's up to the | |
|
11 | # caller to tell hg about the state. | |
|
12 | # | |
|
13 | # There are two subcommands: | |
|
14 | # filelist <numchangesets> | |
|
15 | # state <numchangesets> (<changeset>|wc) | |
|
16 | # | |
|
17 | # Typical usage: | |
|
18 | # | |
|
19 | # $ python $TESTDIR/generate-working-copy-states.py state 2 1 | |
|
20 | # $ hg addremove --similarity 0 | |
|
21 | # $ hg commit -m 'first' | |
|
22 | # | |
|
23 | # $ python $TESTDIR/generate-working-copy-states.py state 2 1 | |
|
24 | # $ hg addremove --similarity 0 | |
|
25 | # $ hg commit -m 'second' | |
|
26 | # | |
|
27 | # $ python $TESTDIR/generate-working-copy-states.py state 2 wc | |
|
28 | # $ hg addremove --similarity 0 | |
|
29 | # $ hg forget *_*_*-untracked | |
|
30 | # $ rm *_*_missing-* | |
|
31 | ||
|
2 | 32 | import sys |
|
3 | 33 | import os |
|
4 | 34 | |
|
5 | 35 | # Generates pairs of (filename, contents), where 'contents' is a list |
|
6 | 36 | # describing the file's content at each revision (or in the working copy). |
|
7 | 37 | # At each revision, it is either None or the file's actual content. When not |
|
8 | 38 | # None, it may be either new content or the same content as an earlier |
|
9 | 39 | # revisions, so all of (modified,clean,added,removed) can be tested. |
|
10 | 40 | def generatestates(maxchangesets, parentcontents): |
|
11 | 41 | depth = len(parentcontents) |
|
12 | 42 | if depth == maxchangesets + 1: |
|
13 | 43 | for tracked in ('untracked', 'tracked'): |
|
14 | 44 | filename = "_".join([(content is None and 'missing' or content) for |
|
15 | 45 | content in parentcontents]) + "-" + tracked |
|
16 | 46 | yield (filename, parentcontents) |
|
17 | 47 | else: |
|
18 | 48 | for content in (set([None, 'content' + str(depth + 1)]) | |
|
19 | 49 | set(parentcontents)): |
|
20 | 50 | for combination in generatestates(maxchangesets, |
|
21 | 51 | parentcontents + [content]): |
|
22 | 52 | yield combination |
|
23 | 53 | |
|
24 | # sort to make sure we have stable output | |
|
25 | combinations = sorted(generatestates(2, [])) | |
|
54 | # retrieve the command line arguments | |
|
55 | target = sys.argv[1] | |
|
56 | maxchangesets = int(sys.argv[2]) | |
|
57 | if target == 'state': | |
|
58 | depth = sys.argv[3] | |
|
26 | 59 | |
|
27 | # retrieve the state we must generate | |
|
28 | target = sys.argv[1] | |
|
60 | # sort to make sure we have stable output | |
|
61 | combinations = sorted(generatestates(maxchangesets, [])) | |
|
29 | 62 | |
|
30 | 63 | # compute file content |
|
31 | 64 | content = [] |
|
32 |
for filename, |
|
|
65 | for filename, states in combinations: | |
|
33 | 66 | if target == 'filelist': |
|
34 | 67 | print filename |
|
35 |
elif target == ' |
|
|
36 | content.append((filename, base)) | |
|
37 | elif target == 'parent': | |
|
38 | content.append((filename, parent)) | |
|
39 | elif target == 'wc': | |
|
40 | # Make sure there is content so the file gets written and can be | |
|
41 | # tracked. It will be deleted outside of this script. | |
|
42 | content.append((filename, wcc or 'TOBEDELETED')) | |
|
68 | elif target == 'state': | |
|
69 | if depth == 'wc': | |
|
70 | # Make sure there is content so the file gets written and can be | |
|
71 | # tracked. It will be deleted outside of this script. | |
|
72 | content.append((filename, states[maxchangesets] or 'TOBEDELETED')) | |
|
73 | else: | |
|
74 | content.append((filename, states[int(depth) - 1])) | |
|
43 | 75 | else: |
|
44 | 76 | print >> sys.stderr, "unknown target:", target |
|
45 | 77 | sys.exit(1) |
|
46 | 78 | |
|
47 | 79 | # write actual content |
|
48 | 80 | for filename, data in content: |
|
49 | 81 | if data is not None: |
|
50 | 82 | f = open(filename, 'w') |
|
51 | 83 | f.write(data + '\n') |
|
52 | 84 | f.close() |
|
53 | 85 | elif os.path.exists(filename): |
|
54 | 86 | os.remove(filename) |
@@ -1,1014 +1,1014 b'' | |||
|
1 | 1 | $ hg init repo |
|
2 | 2 | $ cd repo |
|
3 | 3 | $ echo 123 > a |
|
4 | 4 | $ echo 123 > c |
|
5 | 5 | $ echo 123 > e |
|
6 | 6 | $ hg add a c e |
|
7 | 7 | $ hg commit -m "first" a c e |
|
8 | 8 | |
|
9 | 9 | nothing changed |
|
10 | 10 | |
|
11 | 11 | $ hg revert |
|
12 | 12 | abort: no files or directories specified |
|
13 | 13 | (use --all to revert all files) |
|
14 | 14 | [255] |
|
15 | 15 | $ hg revert --all |
|
16 | 16 | |
|
17 | 17 | Introduce some changes and revert them |
|
18 | 18 | -------------------------------------- |
|
19 | 19 | |
|
20 | 20 | $ echo 123 > b |
|
21 | 21 | |
|
22 | 22 | $ hg status |
|
23 | 23 | ? b |
|
24 | 24 | $ echo 12 > c |
|
25 | 25 | |
|
26 | 26 | $ hg status |
|
27 | 27 | M c |
|
28 | 28 | ? b |
|
29 | 29 | $ hg add b |
|
30 | 30 | |
|
31 | 31 | $ hg status |
|
32 | 32 | M c |
|
33 | 33 | A b |
|
34 | 34 | $ hg rm a |
|
35 | 35 | |
|
36 | 36 | $ hg status |
|
37 | 37 | M c |
|
38 | 38 | A b |
|
39 | 39 | R a |
|
40 | 40 | |
|
41 | 41 | revert removal of a file |
|
42 | 42 | |
|
43 | 43 | $ hg revert a |
|
44 | 44 | $ hg status |
|
45 | 45 | M c |
|
46 | 46 | A b |
|
47 | 47 | |
|
48 | 48 | revert addition of a file |
|
49 | 49 | |
|
50 | 50 | $ hg revert b |
|
51 | 51 | $ hg status |
|
52 | 52 | M c |
|
53 | 53 | ? b |
|
54 | 54 | |
|
55 | 55 | revert modification of a file (--no-backup) |
|
56 | 56 | |
|
57 | 57 | $ hg revert --no-backup c |
|
58 | 58 | $ hg status |
|
59 | 59 | ? b |
|
60 | 60 | |
|
61 | 61 | revert deletion (! status) of a added file |
|
62 | 62 | ------------------------------------------ |
|
63 | 63 | |
|
64 | 64 | $ hg add b |
|
65 | 65 | |
|
66 | 66 | $ hg status b |
|
67 | 67 | A b |
|
68 | 68 | $ rm b |
|
69 | 69 | $ hg status b |
|
70 | 70 | ! b |
|
71 | 71 | $ hg revert -v b |
|
72 | 72 | forgetting b |
|
73 | 73 | $ hg status b |
|
74 | 74 | b: * (glob) |
|
75 | 75 | |
|
76 | 76 | $ ls |
|
77 | 77 | a |
|
78 | 78 | c |
|
79 | 79 | e |
|
80 | 80 | |
|
81 | 81 | Test creation of backup (.orig) files |
|
82 | 82 | ------------------------------------- |
|
83 | 83 | |
|
84 | 84 | $ echo z > e |
|
85 | 85 | $ hg revert --all -v |
|
86 | 86 | saving current version of e as e.orig |
|
87 | 87 | reverting e |
|
88 | 88 | |
|
89 | 89 | revert on clean file (no change) |
|
90 | 90 | -------------------------------- |
|
91 | 91 | |
|
92 | 92 | $ hg revert a |
|
93 | 93 | no changes needed to a |
|
94 | 94 | |
|
95 | 95 | revert on an untracked file |
|
96 | 96 | --------------------------- |
|
97 | 97 | |
|
98 | 98 | $ echo q > q |
|
99 | 99 | $ hg revert q |
|
100 | 100 | file not managed: q |
|
101 | 101 | $ rm q |
|
102 | 102 | |
|
103 | 103 | revert on file that does not exists |
|
104 | 104 | ----------------------------------- |
|
105 | 105 | |
|
106 | 106 | $ hg revert notfound |
|
107 | 107 | notfound: no such file in rev 334a9e57682c |
|
108 | 108 | $ touch d |
|
109 | 109 | $ hg add d |
|
110 | 110 | $ hg rm a |
|
111 | 111 | $ hg commit -m "second" |
|
112 | 112 | $ echo z > z |
|
113 | 113 | $ hg add z |
|
114 | 114 | $ hg st |
|
115 | 115 | A z |
|
116 | 116 | ? e.orig |
|
117 | 117 | |
|
118 | 118 | revert to another revision (--rev) |
|
119 | 119 | ---------------------------------- |
|
120 | 120 | |
|
121 | 121 | $ hg revert --all -r0 |
|
122 | 122 | adding a |
|
123 | 123 | removing d |
|
124 | 124 | forgetting z |
|
125 | 125 | |
|
126 | 126 | revert explicitly to parent (--rev) |
|
127 | 127 | ----------------------------------- |
|
128 | 128 | |
|
129 | 129 | $ hg revert --all -rtip |
|
130 | 130 | forgetting a |
|
131 | 131 | undeleting d |
|
132 | 132 | $ rm a *.orig |
|
133 | 133 | |
|
134 | 134 | revert to another revision (--rev) and exact match |
|
135 | 135 | -------------------------------------------------- |
|
136 | 136 | |
|
137 | 137 | exact match are more silent |
|
138 | 138 | |
|
139 | 139 | $ hg revert -r0 a |
|
140 | 140 | $ hg st a |
|
141 | 141 | A a |
|
142 | 142 | $ hg rm d |
|
143 | 143 | $ hg st d |
|
144 | 144 | R d |
|
145 | 145 | |
|
146 | 146 | should keep d removed |
|
147 | 147 | |
|
148 | 148 | $ hg revert -r0 d |
|
149 | 149 | no changes needed to d |
|
150 | 150 | $ hg st d |
|
151 | 151 | R d |
|
152 | 152 | |
|
153 | 153 | $ hg update -C |
|
154 | 154 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
155 | 155 | |
|
156 | 156 | revert of exec bit |
|
157 | 157 | ------------------ |
|
158 | 158 | |
|
159 | 159 | #if execbit |
|
160 | 160 | $ chmod +x c |
|
161 | 161 | $ hg revert --all |
|
162 | 162 | reverting c |
|
163 | 163 | |
|
164 | 164 | $ test -x c || echo non-executable |
|
165 | 165 | non-executable |
|
166 | 166 | |
|
167 | 167 | $ chmod +x c |
|
168 | 168 | $ hg commit -m exe |
|
169 | 169 | |
|
170 | 170 | $ chmod -x c |
|
171 | 171 | $ hg revert --all |
|
172 | 172 | reverting c |
|
173 | 173 | |
|
174 | 174 | $ test -x c && echo executable |
|
175 | 175 | executable |
|
176 | 176 | #endif |
|
177 | 177 | |
|
178 | 178 | $ cd .. |
|
179 | 179 | |
|
180 | 180 | |
|
181 | 181 | Issue241: update and revert produces inconsistent repositories |
|
182 | 182 | -------------------------------------------------------------- |
|
183 | 183 | |
|
184 | 184 | $ hg init a |
|
185 | 185 | $ cd a |
|
186 | 186 | $ echo a >> a |
|
187 | 187 | $ hg commit -A -d '1 0' -m a |
|
188 | 188 | adding a |
|
189 | 189 | $ echo a >> a |
|
190 | 190 | $ hg commit -d '2 0' -m a |
|
191 | 191 | $ hg update 0 |
|
192 | 192 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
193 | 193 | $ mkdir b |
|
194 | 194 | $ echo b > b/b |
|
195 | 195 | |
|
196 | 196 | call `hg revert` with no file specified |
|
197 | 197 | --------------------------------------- |
|
198 | 198 | |
|
199 | 199 | $ hg revert -rtip |
|
200 | 200 | abort: no files or directories specified |
|
201 | 201 | (use --all to revert all files, or 'hg update 1' to update) |
|
202 | 202 | [255] |
|
203 | 203 | |
|
204 | 204 | call `hg revert` with --all |
|
205 | 205 | --------------------------- |
|
206 | 206 | |
|
207 | 207 | $ hg revert --all -rtip |
|
208 | 208 | reverting a |
|
209 | 209 | |
|
210 | 210 | |
|
211 | 211 | Issue332: confusing message when reverting directory |
|
212 | 212 | ---------------------------------------------------- |
|
213 | 213 | |
|
214 | 214 | $ hg ci -A -m b |
|
215 | 215 | adding b/b |
|
216 | 216 | created new head |
|
217 | 217 | $ echo foobar > b/b |
|
218 | 218 | $ mkdir newdir |
|
219 | 219 | $ echo foo > newdir/newfile |
|
220 | 220 | $ hg add newdir/newfile |
|
221 | 221 | $ hg revert b newdir |
|
222 | 222 | reverting b/b (glob) |
|
223 | 223 | forgetting newdir/newfile (glob) |
|
224 | 224 | $ echo foobar > b/b |
|
225 | 225 | $ hg revert . |
|
226 | 226 | reverting b/b (glob) |
|
227 | 227 | |
|
228 | 228 | |
|
229 | 229 | reverting a rename target should revert the source |
|
230 | 230 | -------------------------------------------------- |
|
231 | 231 | |
|
232 | 232 | $ hg mv a newa |
|
233 | 233 | $ hg revert newa |
|
234 | 234 | $ hg st a newa |
|
235 | 235 | ? newa |
|
236 | 236 | |
|
237 | 237 | Also true for move overwriting an existing file |
|
238 | 238 | |
|
239 | 239 | $ hg mv --force a b/b |
|
240 | 240 | $ hg revert b/b |
|
241 | 241 | $ hg status a b/b |
|
242 | 242 | |
|
243 | 243 | $ cd .. |
|
244 | 244 | |
|
245 | 245 | $ hg init ignored |
|
246 | 246 | $ cd ignored |
|
247 | 247 | $ echo '^ignored$' > .hgignore |
|
248 | 248 | $ echo '^ignoreddir$' >> .hgignore |
|
249 | 249 | $ echo '^removed$' >> .hgignore |
|
250 | 250 | |
|
251 | 251 | $ mkdir ignoreddir |
|
252 | 252 | $ touch ignoreddir/file |
|
253 | 253 | $ touch ignoreddir/removed |
|
254 | 254 | $ touch ignored |
|
255 | 255 | $ touch removed |
|
256 | 256 | |
|
257 | 257 | 4 ignored files (we will add/commit everything) |
|
258 | 258 | |
|
259 | 259 | $ hg st -A -X .hgignore |
|
260 | 260 | I ignored |
|
261 | 261 | I ignoreddir/file |
|
262 | 262 | I ignoreddir/removed |
|
263 | 263 | I removed |
|
264 | 264 | $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed |
|
265 | 265 | |
|
266 | 266 | $ echo >> ignored |
|
267 | 267 | $ echo >> ignoreddir/file |
|
268 | 268 | $ hg rm removed ignoreddir/removed |
|
269 | 269 | |
|
270 | 270 | should revert ignored* and undelete *removed |
|
271 | 271 | -------------------------------------------- |
|
272 | 272 | |
|
273 | 273 | $ hg revert -a --no-backup |
|
274 | 274 | reverting ignored |
|
275 | 275 | reverting ignoreddir/file (glob) |
|
276 | 276 | undeleting ignoreddir/removed (glob) |
|
277 | 277 | undeleting removed |
|
278 | 278 | $ hg st -mardi |
|
279 | 279 | |
|
280 | 280 | $ hg up -qC |
|
281 | 281 | $ echo >> ignored |
|
282 | 282 | $ hg rm removed |
|
283 | 283 | |
|
284 | 284 | should silently revert the named files |
|
285 | 285 | -------------------------------------- |
|
286 | 286 | |
|
287 | 287 | $ hg revert --no-backup ignored removed |
|
288 | 288 | $ hg st -mardi |
|
289 | 289 | |
|
290 | 290 | Reverting copy (issue3920) |
|
291 | 291 | -------------------------- |
|
292 | 292 | |
|
293 | 293 | someone set up us the copies |
|
294 | 294 | |
|
295 | 295 | $ rm .hgignore |
|
296 | 296 | $ hg update -C |
|
297 | 297 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
298 | 298 | $ hg mv ignored allyour |
|
299 | 299 | $ hg copy removed base |
|
300 | 300 | $ hg commit -m rename |
|
301 | 301 | |
|
302 | 302 | copies and renames, you have no chance to survive make your time (issue3920) |
|
303 | 303 | |
|
304 | 304 | $ hg update '.^' |
|
305 | 305 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
306 | 306 | $ hg revert -rtip -a |
|
307 | 307 | adding allyour |
|
308 | 308 | adding base |
|
309 | 309 | removing ignored |
|
310 | 310 | $ hg status -C |
|
311 | 311 | A allyour |
|
312 | 312 | ignored |
|
313 | 313 | A base |
|
314 | 314 | removed |
|
315 | 315 | R ignored |
|
316 | 316 | |
|
317 | 317 | Test revert of a file added by one side of the merge |
|
318 | 318 | ==================================================== |
|
319 | 319 | |
|
320 | 320 | remove any pending change |
|
321 | 321 | |
|
322 | 322 | $ hg revert --all |
|
323 | 323 | forgetting allyour |
|
324 | 324 | forgetting base |
|
325 | 325 | undeleting ignored |
|
326 | 326 | $ hg purge --all --config extensions.purge= |
|
327 | 327 | |
|
328 | 328 | Adds a new commit |
|
329 | 329 | |
|
330 | 330 | $ echo foo > newadd |
|
331 | 331 | $ hg add newadd |
|
332 | 332 | $ hg commit -m 'other adds' |
|
333 | 333 | created new head |
|
334 | 334 | |
|
335 | 335 | |
|
336 | 336 | merge it with the other head |
|
337 | 337 | |
|
338 | 338 | $ hg merge # merge 1 into 2 |
|
339 | 339 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
340 | 340 | (branch merge, don't forget to commit) |
|
341 | 341 | $ hg summary |
|
342 | 342 | parent: 2:b8ec310b2d4e tip |
|
343 | 343 | other adds |
|
344 | 344 | parent: 1:f6180deb8fbe |
|
345 | 345 | rename |
|
346 | 346 | branch: default |
|
347 | 347 | commit: 2 modified, 1 removed (merge) |
|
348 | 348 | update: (current) |
|
349 | 349 | |
|
350 | 350 | clarifies who added what |
|
351 | 351 | |
|
352 | 352 | $ hg status |
|
353 | 353 | M allyour |
|
354 | 354 | M base |
|
355 | 355 | R ignored |
|
356 | 356 | $ hg status --change 'p1()' |
|
357 | 357 | A newadd |
|
358 | 358 | $ hg status --change 'p2()' |
|
359 | 359 | A allyour |
|
360 | 360 | A base |
|
361 | 361 | R ignored |
|
362 | 362 | |
|
363 | 363 | revert file added by p1() to p1() state |
|
364 | 364 | ----------------------------------------- |
|
365 | 365 | |
|
366 | 366 | $ hg revert -r 'p1()' 'glob:newad?' |
|
367 | 367 | $ hg status |
|
368 | 368 | M allyour |
|
369 | 369 | M base |
|
370 | 370 | R ignored |
|
371 | 371 | |
|
372 | 372 | revert file added by p1() to p2() state |
|
373 | 373 | ------------------------------------------ |
|
374 | 374 | |
|
375 | 375 | $ hg revert -r 'p2()' 'glob:newad?' |
|
376 | 376 | removing newadd |
|
377 | 377 | $ hg status |
|
378 | 378 | M allyour |
|
379 | 379 | M base |
|
380 | 380 | R ignored |
|
381 | 381 | R newadd |
|
382 | 382 | |
|
383 | 383 | revert file added by p2() to p2() state |
|
384 | 384 | ------------------------------------------ |
|
385 | 385 | |
|
386 | 386 | $ hg revert -r 'p2()' 'glob:allyou?' |
|
387 | 387 | $ hg status |
|
388 | 388 | M allyour |
|
389 | 389 | M base |
|
390 | 390 | R ignored |
|
391 | 391 | R newadd |
|
392 | 392 | |
|
393 | 393 | revert file added by p2() to p1() state |
|
394 | 394 | ------------------------------------------ |
|
395 | 395 | |
|
396 | 396 | $ hg revert -r 'p1()' 'glob:allyou?' |
|
397 | 397 | removing allyour |
|
398 | 398 | $ hg status |
|
399 | 399 | M base |
|
400 | 400 | R allyour |
|
401 | 401 | R ignored |
|
402 | 402 | R newadd |
|
403 | 403 | |
|
404 | 404 | Systematic behavior validation of most possible cases |
|
405 | 405 | ===================================================== |
|
406 | 406 | |
|
407 | 407 | This section tests most of the possible combinations of revision states and |
|
408 | 408 | working directory states. The number of possible cases is significant but they |
|
409 | 409 | but they all have a slightly different handling. So this section commits to |
|
410 | 410 | and testing all of them to allow safe refactoring of the revert code. |
|
411 | 411 | |
|
412 | 412 | A python script is used to generate a file history for each combination of |
|
413 | 413 | states, on one side the content (or lack thereof) in two revisions, and |
|
414 | 414 | on the other side, the content and "tracked-ness" of the working directory. The |
|
415 | 415 | three states generated are: |
|
416 | 416 | |
|
417 | 417 | - a "base" revision |
|
418 | 418 | - a "parent" revision |
|
419 | 419 | - the working directory (based on "parent") |
|
420 | 420 | |
|
421 | 421 | The files generated have names of the form: |
|
422 | 422 | |
|
423 | 423 | <rev1-content>_<rev2-content>_<working-copy-content>-<tracked-ness> |
|
424 | 424 | |
|
425 | 425 | All known states are not tested yet. See inline documentation for details. |
|
426 | 426 | Special cases from merge and rename are not tested by this section. |
|
427 | 427 | |
|
428 | 428 | Write the python script to disk |
|
429 | 429 | ------------------------------- |
|
430 | 430 | |
|
431 | 431 | check list of planned files |
|
432 | 432 | |
|
433 | $ python $TESTDIR/generate-working-copy-states.py filelist | |
|
433 | $ python $TESTDIR/generate-working-copy-states.py filelist 2 | |
|
434 | 434 | content1_content1_content1-tracked |
|
435 | 435 | content1_content1_content1-untracked |
|
436 | 436 | content1_content1_content3-tracked |
|
437 | 437 | content1_content1_content3-untracked |
|
438 | 438 | content1_content1_missing-tracked |
|
439 | 439 | content1_content1_missing-untracked |
|
440 | 440 | content1_content2_content1-tracked |
|
441 | 441 | content1_content2_content1-untracked |
|
442 | 442 | content1_content2_content2-tracked |
|
443 | 443 | content1_content2_content2-untracked |
|
444 | 444 | content1_content2_content3-tracked |
|
445 | 445 | content1_content2_content3-untracked |
|
446 | 446 | content1_content2_missing-tracked |
|
447 | 447 | content1_content2_missing-untracked |
|
448 | 448 | content1_missing_content1-tracked |
|
449 | 449 | content1_missing_content1-untracked |
|
450 | 450 | content1_missing_content3-tracked |
|
451 | 451 | content1_missing_content3-untracked |
|
452 | 452 | content1_missing_missing-tracked |
|
453 | 453 | content1_missing_missing-untracked |
|
454 | 454 | missing_content2_content2-tracked |
|
455 | 455 | missing_content2_content2-untracked |
|
456 | 456 | missing_content2_content3-tracked |
|
457 | 457 | missing_content2_content3-untracked |
|
458 | 458 | missing_content2_missing-tracked |
|
459 | 459 | missing_content2_missing-untracked |
|
460 | 460 | missing_missing_content3-tracked |
|
461 | 461 | missing_missing_content3-untracked |
|
462 | 462 | missing_missing_missing-tracked |
|
463 | 463 | missing_missing_missing-untracked |
|
464 | 464 | |
|
465 | 465 | Script to make a simple text version of the content |
|
466 | 466 | --------------------------------------------------- |
|
467 | 467 | |
|
468 | 468 | $ cat << EOF >> dircontent.py |
|
469 | 469 | > # generate a simple text view of the directory for easy comparison |
|
470 | 470 | > import os |
|
471 | 471 | > files = os.listdir('.') |
|
472 | 472 | > files.sort() |
|
473 | 473 | > for filename in files: |
|
474 | 474 | > if os.path.isdir(filename): |
|
475 | 475 | > continue |
|
476 | 476 | > content = open(filename).read() |
|
477 | 477 | > print '%-6s %s' % (content.strip(), filename) |
|
478 | 478 | > EOF |
|
479 | 479 | |
|
480 | 480 | Generate appropriate repo state |
|
481 | 481 | ------------------------------- |
|
482 | 482 | |
|
483 | 483 | $ hg init revert-ref |
|
484 | 484 | $ cd revert-ref |
|
485 | 485 | |
|
486 | 486 | Generate base changeset |
|
487 | 487 | |
|
488 |
$ python $TESTDIR/generate-working-copy-states.py |
|
|
488 | $ python $TESTDIR/generate-working-copy-states.py state 2 1 | |
|
489 | 489 | $ hg addremove --similarity 0 |
|
490 | 490 | adding content1_content1_content1-tracked |
|
491 | 491 | adding content1_content1_content1-untracked |
|
492 | 492 | adding content1_content1_content3-tracked |
|
493 | 493 | adding content1_content1_content3-untracked |
|
494 | 494 | adding content1_content1_missing-tracked |
|
495 | 495 | adding content1_content1_missing-untracked |
|
496 | 496 | adding content1_content2_content1-tracked |
|
497 | 497 | adding content1_content2_content1-untracked |
|
498 | 498 | adding content1_content2_content2-tracked |
|
499 | 499 | adding content1_content2_content2-untracked |
|
500 | 500 | adding content1_content2_content3-tracked |
|
501 | 501 | adding content1_content2_content3-untracked |
|
502 | 502 | adding content1_content2_missing-tracked |
|
503 | 503 | adding content1_content2_missing-untracked |
|
504 | 504 | adding content1_missing_content1-tracked |
|
505 | 505 | adding content1_missing_content1-untracked |
|
506 | 506 | adding content1_missing_content3-tracked |
|
507 | 507 | adding content1_missing_content3-untracked |
|
508 | 508 | adding content1_missing_missing-tracked |
|
509 | 509 | adding content1_missing_missing-untracked |
|
510 | 510 | $ hg status |
|
511 | 511 | A content1_content1_content1-tracked |
|
512 | 512 | A content1_content1_content1-untracked |
|
513 | 513 | A content1_content1_content3-tracked |
|
514 | 514 | A content1_content1_content3-untracked |
|
515 | 515 | A content1_content1_missing-tracked |
|
516 | 516 | A content1_content1_missing-untracked |
|
517 | 517 | A content1_content2_content1-tracked |
|
518 | 518 | A content1_content2_content1-untracked |
|
519 | 519 | A content1_content2_content2-tracked |
|
520 | 520 | A content1_content2_content2-untracked |
|
521 | 521 | A content1_content2_content3-tracked |
|
522 | 522 | A content1_content2_content3-untracked |
|
523 | 523 | A content1_content2_missing-tracked |
|
524 | 524 | A content1_content2_missing-untracked |
|
525 | 525 | A content1_missing_content1-tracked |
|
526 | 526 | A content1_missing_content1-untracked |
|
527 | 527 | A content1_missing_content3-tracked |
|
528 | 528 | A content1_missing_content3-untracked |
|
529 | 529 | A content1_missing_missing-tracked |
|
530 | 530 | A content1_missing_missing-untracked |
|
531 | 531 | $ hg commit -m 'base' |
|
532 | 532 | |
|
533 | 533 | (create a simple text version of the content) |
|
534 | 534 | |
|
535 | 535 | $ python ../dircontent.py > ../content-base.txt |
|
536 | 536 | $ cat ../content-base.txt |
|
537 | 537 | content1 content1_content1_content1-tracked |
|
538 | 538 | content1 content1_content1_content1-untracked |
|
539 | 539 | content1 content1_content1_content3-tracked |
|
540 | 540 | content1 content1_content1_content3-untracked |
|
541 | 541 | content1 content1_content1_missing-tracked |
|
542 | 542 | content1 content1_content1_missing-untracked |
|
543 | 543 | content1 content1_content2_content1-tracked |
|
544 | 544 | content1 content1_content2_content1-untracked |
|
545 | 545 | content1 content1_content2_content2-tracked |
|
546 | 546 | content1 content1_content2_content2-untracked |
|
547 | 547 | content1 content1_content2_content3-tracked |
|
548 | 548 | content1 content1_content2_content3-untracked |
|
549 | 549 | content1 content1_content2_missing-tracked |
|
550 | 550 | content1 content1_content2_missing-untracked |
|
551 | 551 | content1 content1_missing_content1-tracked |
|
552 | 552 | content1 content1_missing_content1-untracked |
|
553 | 553 | content1 content1_missing_content3-tracked |
|
554 | 554 | content1 content1_missing_content3-untracked |
|
555 | 555 | content1 content1_missing_missing-tracked |
|
556 | 556 | content1 content1_missing_missing-untracked |
|
557 | 557 | |
|
558 | 558 | Create parent changeset |
|
559 | 559 | |
|
560 |
$ python $TESTDIR/generate-working-copy-states.py |
|
|
560 | $ python $TESTDIR/generate-working-copy-states.py state 2 2 | |
|
561 | 561 | $ hg addremove --similarity 0 |
|
562 | 562 | removing content1_missing_content1-tracked |
|
563 | 563 | removing content1_missing_content1-untracked |
|
564 | 564 | removing content1_missing_content3-tracked |
|
565 | 565 | removing content1_missing_content3-untracked |
|
566 | 566 | removing content1_missing_missing-tracked |
|
567 | 567 | removing content1_missing_missing-untracked |
|
568 | 568 | adding missing_content2_content2-tracked |
|
569 | 569 | adding missing_content2_content2-untracked |
|
570 | 570 | adding missing_content2_content3-tracked |
|
571 | 571 | adding missing_content2_content3-untracked |
|
572 | 572 | adding missing_content2_missing-tracked |
|
573 | 573 | adding missing_content2_missing-untracked |
|
574 | 574 | $ hg status |
|
575 | 575 | M content1_content2_content1-tracked |
|
576 | 576 | M content1_content2_content1-untracked |
|
577 | 577 | M content1_content2_content2-tracked |
|
578 | 578 | M content1_content2_content2-untracked |
|
579 | 579 | M content1_content2_content3-tracked |
|
580 | 580 | M content1_content2_content3-untracked |
|
581 | 581 | M content1_content2_missing-tracked |
|
582 | 582 | M content1_content2_missing-untracked |
|
583 | 583 | A missing_content2_content2-tracked |
|
584 | 584 | A missing_content2_content2-untracked |
|
585 | 585 | A missing_content2_content3-tracked |
|
586 | 586 | A missing_content2_content3-untracked |
|
587 | 587 | A missing_content2_missing-tracked |
|
588 | 588 | A missing_content2_missing-untracked |
|
589 | 589 | R content1_missing_content1-tracked |
|
590 | 590 | R content1_missing_content1-untracked |
|
591 | 591 | R content1_missing_content3-tracked |
|
592 | 592 | R content1_missing_content3-untracked |
|
593 | 593 | R content1_missing_missing-tracked |
|
594 | 594 | R content1_missing_missing-untracked |
|
595 | 595 | $ hg commit -m 'parent' |
|
596 | 596 | |
|
597 | 597 | (create a simple text version of the content) |
|
598 | 598 | |
|
599 | 599 | $ python ../dircontent.py > ../content-parent.txt |
|
600 | 600 | $ cat ../content-parent.txt |
|
601 | 601 | content1 content1_content1_content1-tracked |
|
602 | 602 | content1 content1_content1_content1-untracked |
|
603 | 603 | content1 content1_content1_content3-tracked |
|
604 | 604 | content1 content1_content1_content3-untracked |
|
605 | 605 | content1 content1_content1_missing-tracked |
|
606 | 606 | content1 content1_content1_missing-untracked |
|
607 | 607 | content2 content1_content2_content1-tracked |
|
608 | 608 | content2 content1_content2_content1-untracked |
|
609 | 609 | content2 content1_content2_content2-tracked |
|
610 | 610 | content2 content1_content2_content2-untracked |
|
611 | 611 | content2 content1_content2_content3-tracked |
|
612 | 612 | content2 content1_content2_content3-untracked |
|
613 | 613 | content2 content1_content2_missing-tracked |
|
614 | 614 | content2 content1_content2_missing-untracked |
|
615 | 615 | content2 missing_content2_content2-tracked |
|
616 | 616 | content2 missing_content2_content2-untracked |
|
617 | 617 | content2 missing_content2_content3-tracked |
|
618 | 618 | content2 missing_content2_content3-untracked |
|
619 | 619 | content2 missing_content2_missing-tracked |
|
620 | 620 | content2 missing_content2_missing-untracked |
|
621 | 621 | |
|
622 | 622 | Setup working directory |
|
623 | 623 | |
|
624 | $ python $TESTDIR/generate-working-copy-states.py wc | |
|
624 | $ python $TESTDIR/generate-working-copy-states.py state 2 wc | |
|
625 | 625 | $ hg addremove --similarity 0 |
|
626 | 626 | adding content1_missing_content1-tracked |
|
627 | 627 | adding content1_missing_content1-untracked |
|
628 | 628 | adding content1_missing_content3-tracked |
|
629 | 629 | adding content1_missing_content3-untracked |
|
630 | 630 | adding content1_missing_missing-tracked |
|
631 | 631 | adding content1_missing_missing-untracked |
|
632 | 632 | adding missing_missing_content3-tracked |
|
633 | 633 | adding missing_missing_content3-untracked |
|
634 | 634 | adding missing_missing_missing-tracked |
|
635 | 635 | adding missing_missing_missing-untracked |
|
636 | 636 | $ hg forget *_*_*-untracked |
|
637 | 637 | $ rm *_*_missing-* |
|
638 | 638 | $ hg status |
|
639 | 639 | M content1_content1_content3-tracked |
|
640 | 640 | M content1_content2_content1-tracked |
|
641 | 641 | M content1_content2_content3-tracked |
|
642 | 642 | M missing_content2_content3-tracked |
|
643 | 643 | A content1_missing_content1-tracked |
|
644 | 644 | A content1_missing_content3-tracked |
|
645 | 645 | A missing_missing_content3-tracked |
|
646 | 646 | R content1_content1_content1-untracked |
|
647 | 647 | R content1_content1_content3-untracked |
|
648 | 648 | R content1_content1_missing-untracked |
|
649 | 649 | R content1_content2_content1-untracked |
|
650 | 650 | R content1_content2_content2-untracked |
|
651 | 651 | R content1_content2_content3-untracked |
|
652 | 652 | R content1_content2_missing-untracked |
|
653 | 653 | R missing_content2_content2-untracked |
|
654 | 654 | R missing_content2_content3-untracked |
|
655 | 655 | R missing_content2_missing-untracked |
|
656 | 656 | ! content1_content1_missing-tracked |
|
657 | 657 | ! content1_content2_missing-tracked |
|
658 | 658 | ! content1_missing_missing-tracked |
|
659 | 659 | ! missing_content2_missing-tracked |
|
660 | 660 | ! missing_missing_missing-tracked |
|
661 | 661 | ? content1_missing_content1-untracked |
|
662 | 662 | ? content1_missing_content3-untracked |
|
663 | 663 | ? missing_missing_content3-untracked |
|
664 | 664 | |
|
665 | 665 | $ hg status --rev 'desc("base")' |
|
666 | 666 | M content1_content1_content3-tracked |
|
667 | 667 | M content1_content2_content2-tracked |
|
668 | 668 | M content1_content2_content3-tracked |
|
669 | 669 | M content1_missing_content3-tracked |
|
670 | 670 | A missing_content2_content2-tracked |
|
671 | 671 | A missing_content2_content3-tracked |
|
672 | 672 | A missing_missing_content3-tracked |
|
673 | 673 | R content1_content1_content1-untracked |
|
674 | 674 | R content1_content1_content3-untracked |
|
675 | 675 | R content1_content1_missing-untracked |
|
676 | 676 | R content1_content2_content1-untracked |
|
677 | 677 | R content1_content2_content2-untracked |
|
678 | 678 | R content1_content2_content3-untracked |
|
679 | 679 | R content1_content2_missing-untracked |
|
680 | 680 | R content1_missing_content1-untracked |
|
681 | 681 | R content1_missing_content3-untracked |
|
682 | 682 | R content1_missing_missing-tracked |
|
683 | 683 | R content1_missing_missing-untracked |
|
684 | 684 | ! content1_content1_missing-tracked |
|
685 | 685 | ! content1_content2_missing-tracked |
|
686 | 686 | ! content1_missing_missing-tracked |
|
687 | 687 | ! missing_content2_missing-tracked |
|
688 | 688 | ! missing_missing_missing-tracked |
|
689 | 689 | ? missing_missing_content3-untracked |
|
690 | 690 | |
|
691 | 691 | (create a simple text version of the content) |
|
692 | 692 | |
|
693 | 693 | $ python ../dircontent.py > ../content-wc.txt |
|
694 | 694 | $ cat ../content-wc.txt |
|
695 | 695 | content1 content1_content1_content1-tracked |
|
696 | 696 | content1 content1_content1_content1-untracked |
|
697 | 697 | content3 content1_content1_content3-tracked |
|
698 | 698 | content3 content1_content1_content3-untracked |
|
699 | 699 | content1 content1_content2_content1-tracked |
|
700 | 700 | content1 content1_content2_content1-untracked |
|
701 | 701 | content2 content1_content2_content2-tracked |
|
702 | 702 | content2 content1_content2_content2-untracked |
|
703 | 703 | content3 content1_content2_content3-tracked |
|
704 | 704 | content3 content1_content2_content3-untracked |
|
705 | 705 | content1 content1_missing_content1-tracked |
|
706 | 706 | content1 content1_missing_content1-untracked |
|
707 | 707 | content3 content1_missing_content3-tracked |
|
708 | 708 | content3 content1_missing_content3-untracked |
|
709 | 709 | content2 missing_content2_content2-tracked |
|
710 | 710 | content2 missing_content2_content2-untracked |
|
711 | 711 | content3 missing_content2_content3-tracked |
|
712 | 712 | content3 missing_content2_content3-untracked |
|
713 | 713 | content3 missing_missing_content3-tracked |
|
714 | 714 | content3 missing_missing_content3-untracked |
|
715 | 715 | |
|
716 | 716 | $ cd .. |
|
717 | 717 | |
|
718 | 718 | Test revert --all to parent content |
|
719 | 719 | ----------------------------------- |
|
720 | 720 | |
|
721 | 721 | (setup from reference repo) |
|
722 | 722 | |
|
723 | 723 | $ cp -r revert-ref revert-parent-all |
|
724 | 724 | $ cd revert-parent-all |
|
725 | 725 | |
|
726 | 726 | check revert output |
|
727 | 727 | |
|
728 | 728 | $ hg revert --all |
|
729 | 729 | undeleting content1_content1_content1-untracked |
|
730 | 730 | reverting content1_content1_content3-tracked |
|
731 | 731 | undeleting content1_content1_content3-untracked |
|
732 | 732 | reverting content1_content1_missing-tracked |
|
733 | 733 | undeleting content1_content1_missing-untracked |
|
734 | 734 | reverting content1_content2_content1-tracked |
|
735 | 735 | undeleting content1_content2_content1-untracked |
|
736 | 736 | undeleting content1_content2_content2-untracked |
|
737 | 737 | reverting content1_content2_content3-tracked |
|
738 | 738 | undeleting content1_content2_content3-untracked |
|
739 | 739 | reverting content1_content2_missing-tracked |
|
740 | 740 | undeleting content1_content2_missing-untracked |
|
741 | 741 | forgetting content1_missing_content1-tracked |
|
742 | 742 | forgetting content1_missing_content3-tracked |
|
743 | 743 | forgetting content1_missing_missing-tracked |
|
744 | 744 | undeleting missing_content2_content2-untracked |
|
745 | 745 | reverting missing_content2_content3-tracked |
|
746 | 746 | undeleting missing_content2_content3-untracked |
|
747 | 747 | reverting missing_content2_missing-tracked |
|
748 | 748 | undeleting missing_content2_missing-untracked |
|
749 | 749 | forgetting missing_missing_content3-tracked |
|
750 | 750 | forgetting missing_missing_missing-tracked |
|
751 | 751 | |
|
752 | 752 | Compare resulting directory with revert target. |
|
753 | 753 | |
|
754 | 754 | The diff is filtered to include change only. The only difference should be |
|
755 | 755 | additional `.orig` backup file when applicable. |
|
756 | 756 | |
|
757 | 757 | $ python ../dircontent.py > ../content-parent-all.txt |
|
758 | 758 | $ cd .. |
|
759 | 759 | $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _ |
|
760 | 760 | +content3 content1_content1_content3-tracked.orig |
|
761 | 761 | +content3 content1_content1_content3-untracked.orig |
|
762 | 762 | +content1 content1_content2_content1-tracked.orig |
|
763 | 763 | +content1 content1_content2_content1-untracked.orig |
|
764 | 764 | +content3 content1_content2_content3-tracked.orig |
|
765 | 765 | +content3 content1_content2_content3-untracked.orig |
|
766 | 766 | +content1 content1_missing_content1-tracked |
|
767 | 767 | +content1 content1_missing_content1-untracked |
|
768 | 768 | +content3 content1_missing_content3-tracked |
|
769 | 769 | +content3 content1_missing_content3-untracked |
|
770 | 770 | +content3 missing_content2_content3-tracked.orig |
|
771 | 771 | +content3 missing_content2_content3-untracked.orig |
|
772 | 772 | +content3 missing_missing_content3-tracked |
|
773 | 773 | +content3 missing_missing_content3-untracked |
|
774 | 774 | |
|
775 | 775 | Test revert --all to "base" content |
|
776 | 776 | ----------------------------------- |
|
777 | 777 | |
|
778 | 778 | (setup from reference repo) |
|
779 | 779 | |
|
780 | 780 | $ cp -r revert-ref revert-base-all |
|
781 | 781 | $ cd revert-base-all |
|
782 | 782 | |
|
783 | 783 | check revert output |
|
784 | 784 | |
|
785 | 785 | $ hg revert --all --rev 'desc(base)' |
|
786 | 786 | undeleting content1_content1_content1-untracked |
|
787 | 787 | reverting content1_content1_content3-tracked |
|
788 | 788 | undeleting content1_content1_content3-untracked |
|
789 | 789 | reverting content1_content1_missing-tracked |
|
790 | 790 | undeleting content1_content1_missing-untracked |
|
791 | 791 | undeleting content1_content2_content1-untracked |
|
792 | 792 | reverting content1_content2_content2-tracked |
|
793 | 793 | undeleting content1_content2_content2-untracked |
|
794 | 794 | reverting content1_content2_content3-tracked |
|
795 | 795 | undeleting content1_content2_content3-untracked |
|
796 | 796 | reverting content1_content2_missing-tracked |
|
797 | 797 | undeleting content1_content2_missing-untracked |
|
798 | 798 | adding content1_missing_content1-untracked |
|
799 | 799 | reverting content1_missing_content3-tracked |
|
800 | 800 | adding content1_missing_content3-untracked |
|
801 | 801 | reverting content1_missing_missing-tracked |
|
802 | 802 | adding content1_missing_missing-untracked |
|
803 | 803 | removing missing_content2_content2-tracked |
|
804 | 804 | removing missing_content2_content3-tracked |
|
805 | 805 | removing missing_content2_missing-tracked |
|
806 | 806 | forgetting missing_missing_content3-tracked |
|
807 | 807 | forgetting missing_missing_missing-tracked |
|
808 | 808 | |
|
809 | 809 | Compare resulting directory with revert target. |
|
810 | 810 | |
|
811 | 811 | The diff is filtered to include change only. The only difference should be |
|
812 | 812 | additional `.orig` backup file when applicable. |
|
813 | 813 | |
|
814 | 814 | $ python ../dircontent.py > ../content-base-all.txt |
|
815 | 815 | $ cd .. |
|
816 | 816 | $ diff -U 0 -- content-base.txt content-base-all.txt | grep _ |
|
817 | 817 | +content3 content1_content1_content3-tracked.orig |
|
818 | 818 | +content3 content1_content1_content3-untracked.orig |
|
819 | 819 | +content2 content1_content2_content2-untracked.orig |
|
820 | 820 | +content3 content1_content2_content3-tracked.orig |
|
821 | 821 | +content3 content1_content2_content3-untracked.orig |
|
822 | 822 | +content3 content1_missing_content3-tracked.orig |
|
823 | 823 | +content3 content1_missing_content3-untracked.orig |
|
824 | 824 | +content2 missing_content2_content2-untracked |
|
825 | 825 | +content3 missing_content2_content3-tracked.orig |
|
826 | 826 | +content3 missing_content2_content3-untracked |
|
827 | 827 | +content3 missing_missing_content3-tracked |
|
828 | 828 | +content3 missing_missing_content3-untracked |
|
829 | 829 | |
|
830 | 830 | Test revert to parent content with explicit file name |
|
831 | 831 | ----------------------------------------------------- |
|
832 | 832 | |
|
833 | 833 | (setup from reference repo) |
|
834 | 834 | |
|
835 | 835 | $ cp -r revert-ref revert-parent-explicit |
|
836 | 836 | $ cd revert-parent-explicit |
|
837 | 837 | |
|
838 | 838 | revert all files individually and check the output |
|
839 | 839 | (output is expected to be different than in the --all case) |
|
840 | 840 | |
|
841 | $ for file in `python $TESTDIR/generate-working-copy-states.py filelist`; do | |
|
841 | $ for file in `python $TESTDIR/generate-working-copy-states.py filelist 2`; do | |
|
842 | 842 | > echo '### revert for:' $file; |
|
843 | 843 | > hg revert $file; |
|
844 | 844 | > echo |
|
845 | 845 | > done |
|
846 | 846 | ### revert for: content1_content1_content1-tracked |
|
847 | 847 | no changes needed to content1_content1_content1-tracked |
|
848 | 848 | |
|
849 | 849 | ### revert for: content1_content1_content1-untracked |
|
850 | 850 | |
|
851 | 851 | ### revert for: content1_content1_content3-tracked |
|
852 | 852 | |
|
853 | 853 | ### revert for: content1_content1_content3-untracked |
|
854 | 854 | |
|
855 | 855 | ### revert for: content1_content1_missing-tracked |
|
856 | 856 | |
|
857 | 857 | ### revert for: content1_content1_missing-untracked |
|
858 | 858 | |
|
859 | 859 | ### revert for: content1_content2_content1-tracked |
|
860 | 860 | |
|
861 | 861 | ### revert for: content1_content2_content1-untracked |
|
862 | 862 | |
|
863 | 863 | ### revert for: content1_content2_content2-tracked |
|
864 | 864 | no changes needed to content1_content2_content2-tracked |
|
865 | 865 | |
|
866 | 866 | ### revert for: content1_content2_content2-untracked |
|
867 | 867 | |
|
868 | 868 | ### revert for: content1_content2_content3-tracked |
|
869 | 869 | |
|
870 | 870 | ### revert for: content1_content2_content3-untracked |
|
871 | 871 | |
|
872 | 872 | ### revert for: content1_content2_missing-tracked |
|
873 | 873 | |
|
874 | 874 | ### revert for: content1_content2_missing-untracked |
|
875 | 875 | |
|
876 | 876 | ### revert for: content1_missing_content1-tracked |
|
877 | 877 | |
|
878 | 878 | ### revert for: content1_missing_content1-untracked |
|
879 | 879 | file not managed: content1_missing_content1-untracked |
|
880 | 880 | |
|
881 | 881 | ### revert for: content1_missing_content3-tracked |
|
882 | 882 | |
|
883 | 883 | ### revert for: content1_missing_content3-untracked |
|
884 | 884 | file not managed: content1_missing_content3-untracked |
|
885 | 885 | |
|
886 | 886 | ### revert for: content1_missing_missing-tracked |
|
887 | 887 | |
|
888 | 888 | ### revert for: content1_missing_missing-untracked |
|
889 | 889 | content1_missing_missing-untracked: no such file in rev * (glob) |
|
890 | 890 | |
|
891 | 891 | ### revert for: missing_content2_content2-tracked |
|
892 | 892 | no changes needed to missing_content2_content2-tracked |
|
893 | 893 | |
|
894 | 894 | ### revert for: missing_content2_content2-untracked |
|
895 | 895 | |
|
896 | 896 | ### revert for: missing_content2_content3-tracked |
|
897 | 897 | |
|
898 | 898 | ### revert for: missing_content2_content3-untracked |
|
899 | 899 | |
|
900 | 900 | ### revert for: missing_content2_missing-tracked |
|
901 | 901 | |
|
902 | 902 | ### revert for: missing_content2_missing-untracked |
|
903 | 903 | |
|
904 | 904 | ### revert for: missing_missing_content3-tracked |
|
905 | 905 | |
|
906 | 906 | ### revert for: missing_missing_content3-untracked |
|
907 | 907 | file not managed: missing_missing_content3-untracked |
|
908 | 908 | |
|
909 | 909 | ### revert for: missing_missing_missing-tracked |
|
910 | 910 | |
|
911 | 911 | ### revert for: missing_missing_missing-untracked |
|
912 | 912 | missing_missing_missing-untracked: no such file in rev * (glob) |
|
913 | 913 | |
|
914 | 914 | |
|
915 | 915 | check resulting directory against the --all run |
|
916 | 916 | (There should be no difference) |
|
917 | 917 | |
|
918 | 918 | $ python ../dircontent.py > ../content-parent-explicit.txt |
|
919 | 919 | $ cd .. |
|
920 | 920 | $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _ |
|
921 | 921 | [1] |
|
922 | 922 | |
|
923 | 923 | Test revert to "base" content with explicit file name |
|
924 | 924 | ----------------------------------------------------- |
|
925 | 925 | |
|
926 | 926 | (setup from reference repo) |
|
927 | 927 | |
|
928 | 928 | $ cp -r revert-ref revert-base-explicit |
|
929 | 929 | $ cd revert-base-explicit |
|
930 | 930 | |
|
931 | 931 | revert all files individually and check the output |
|
932 | 932 | (output is expected to be different than in the --all case) |
|
933 | 933 | |
|
934 | $ for file in `python $TESTDIR/generate-working-copy-states.py filelist`; do | |
|
934 | $ for file in `python $TESTDIR/generate-working-copy-states.py filelist 2`; do | |
|
935 | 935 | > echo '### revert for:' $file; |
|
936 | 936 | > hg revert $file --rev 'desc(base)'; |
|
937 | 937 | > echo |
|
938 | 938 | > done |
|
939 | 939 | ### revert for: content1_content1_content1-tracked |
|
940 | 940 | no changes needed to content1_content1_content1-tracked |
|
941 | 941 | |
|
942 | 942 | ### revert for: content1_content1_content1-untracked |
|
943 | 943 | |
|
944 | 944 | ### revert for: content1_content1_content3-tracked |
|
945 | 945 | |
|
946 | 946 | ### revert for: content1_content1_content3-untracked |
|
947 | 947 | |
|
948 | 948 | ### revert for: content1_content1_missing-tracked |
|
949 | 949 | |
|
950 | 950 | ### revert for: content1_content1_missing-untracked |
|
951 | 951 | |
|
952 | 952 | ### revert for: content1_content2_content1-tracked |
|
953 | 953 | no changes needed to content1_content2_content1-tracked |
|
954 | 954 | |
|
955 | 955 | ### revert for: content1_content2_content1-untracked |
|
956 | 956 | |
|
957 | 957 | ### revert for: content1_content2_content2-tracked |
|
958 | 958 | |
|
959 | 959 | ### revert for: content1_content2_content2-untracked |
|
960 | 960 | |
|
961 | 961 | ### revert for: content1_content2_content3-tracked |
|
962 | 962 | |
|
963 | 963 | ### revert for: content1_content2_content3-untracked |
|
964 | 964 | |
|
965 | 965 | ### revert for: content1_content2_missing-tracked |
|
966 | 966 | |
|
967 | 967 | ### revert for: content1_content2_missing-untracked |
|
968 | 968 | |
|
969 | 969 | ### revert for: content1_missing_content1-tracked |
|
970 | 970 | no changes needed to content1_missing_content1-tracked |
|
971 | 971 | |
|
972 | 972 | ### revert for: content1_missing_content1-untracked |
|
973 | 973 | |
|
974 | 974 | ### revert for: content1_missing_content3-tracked |
|
975 | 975 | |
|
976 | 976 | ### revert for: content1_missing_content3-untracked |
|
977 | 977 | |
|
978 | 978 | ### revert for: content1_missing_missing-tracked |
|
979 | 979 | |
|
980 | 980 | ### revert for: content1_missing_missing-untracked |
|
981 | 981 | |
|
982 | 982 | ### revert for: missing_content2_content2-tracked |
|
983 | 983 | |
|
984 | 984 | ### revert for: missing_content2_content2-untracked |
|
985 | 985 | no changes needed to missing_content2_content2-untracked |
|
986 | 986 | |
|
987 | 987 | ### revert for: missing_content2_content3-tracked |
|
988 | 988 | |
|
989 | 989 | ### revert for: missing_content2_content3-untracked |
|
990 | 990 | no changes needed to missing_content2_content3-untracked |
|
991 | 991 | |
|
992 | 992 | ### revert for: missing_content2_missing-tracked |
|
993 | 993 | |
|
994 | 994 | ### revert for: missing_content2_missing-untracked |
|
995 | 995 | no changes needed to missing_content2_missing-untracked |
|
996 | 996 | |
|
997 | 997 | ### revert for: missing_missing_content3-tracked |
|
998 | 998 | |
|
999 | 999 | ### revert for: missing_missing_content3-untracked |
|
1000 | 1000 | file not managed: missing_missing_content3-untracked |
|
1001 | 1001 | |
|
1002 | 1002 | ### revert for: missing_missing_missing-tracked |
|
1003 | 1003 | |
|
1004 | 1004 | ### revert for: missing_missing_missing-untracked |
|
1005 | 1005 | missing_missing_missing-untracked: no such file in rev * (glob) |
|
1006 | 1006 | |
|
1007 | 1007 | |
|
1008 | 1008 | check resulting directory against the --all run |
|
1009 | 1009 | (There should be no difference) |
|
1010 | 1010 | |
|
1011 | 1011 | $ python ../dircontent.py > ../content-base-explicit.txt |
|
1012 | 1012 | $ cd .. |
|
1013 | 1013 | $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _ |
|
1014 | 1014 | [1] |
@@ -1,166 +1,166 b'' | |||
|
1 | 1 | Tests of 'hg status --rev <rev>' to make sure status between <rev> and '.' get |
|
2 | 2 | combined correctly with the dirstate status. |
|
3 | 3 | |
|
4 | 4 | $ hg init |
|
5 | 5 | |
|
6 | 6 | First commit |
|
7 | 7 | |
|
8 |
$ python $TESTDIR/generate-working-copy-states.py |
|
|
8 | $ python $TESTDIR/generate-working-copy-states.py state 2 1 | |
|
9 | 9 | $ hg addremove --similarity 0 |
|
10 | 10 | adding content1_content1_content1-tracked |
|
11 | 11 | adding content1_content1_content1-untracked |
|
12 | 12 | adding content1_content1_content3-tracked |
|
13 | 13 | adding content1_content1_content3-untracked |
|
14 | 14 | adding content1_content1_missing-tracked |
|
15 | 15 | adding content1_content1_missing-untracked |
|
16 | 16 | adding content1_content2_content1-tracked |
|
17 | 17 | adding content1_content2_content1-untracked |
|
18 | 18 | adding content1_content2_content2-tracked |
|
19 | 19 | adding content1_content2_content2-untracked |
|
20 | 20 | adding content1_content2_content3-tracked |
|
21 | 21 | adding content1_content2_content3-untracked |
|
22 | 22 | adding content1_content2_missing-tracked |
|
23 | 23 | adding content1_content2_missing-untracked |
|
24 | 24 | adding content1_missing_content1-tracked |
|
25 | 25 | adding content1_missing_content1-untracked |
|
26 | 26 | adding content1_missing_content3-tracked |
|
27 | 27 | adding content1_missing_content3-untracked |
|
28 | 28 | adding content1_missing_missing-tracked |
|
29 | 29 | adding content1_missing_missing-untracked |
|
30 | 30 | $ hg commit -m first |
|
31 | 31 | |
|
32 | 32 | Second commit |
|
33 | 33 | |
|
34 |
$ python $TESTDIR/generate-working-copy-states.py |
|
|
34 | $ python $TESTDIR/generate-working-copy-states.py state 2 2 | |
|
35 | 35 | $ hg addremove --similarity 0 |
|
36 | 36 | removing content1_missing_content1-tracked |
|
37 | 37 | removing content1_missing_content1-untracked |
|
38 | 38 | removing content1_missing_content3-tracked |
|
39 | 39 | removing content1_missing_content3-untracked |
|
40 | 40 | removing content1_missing_missing-tracked |
|
41 | 41 | removing content1_missing_missing-untracked |
|
42 | 42 | adding missing_content2_content2-tracked |
|
43 | 43 | adding missing_content2_content2-untracked |
|
44 | 44 | adding missing_content2_content3-tracked |
|
45 | 45 | adding missing_content2_content3-untracked |
|
46 | 46 | adding missing_content2_missing-tracked |
|
47 | 47 | adding missing_content2_missing-untracked |
|
48 | 48 | $ hg commit -m second |
|
49 | 49 | |
|
50 | 50 | Working copy |
|
51 | 51 | |
|
52 | $ python $TESTDIR/generate-working-copy-states.py wc | |
|
52 | $ python $TESTDIR/generate-working-copy-states.py state 2 wc | |
|
53 | 53 | $ hg addremove --similarity 0 |
|
54 | 54 | adding content1_missing_content1-tracked |
|
55 | 55 | adding content1_missing_content1-untracked |
|
56 | 56 | adding content1_missing_content3-tracked |
|
57 | 57 | adding content1_missing_content3-untracked |
|
58 | 58 | adding content1_missing_missing-tracked |
|
59 | 59 | adding content1_missing_missing-untracked |
|
60 | 60 | adding missing_missing_content3-tracked |
|
61 | 61 | adding missing_missing_content3-untracked |
|
62 | 62 | adding missing_missing_missing-tracked |
|
63 | 63 | adding missing_missing_missing-untracked |
|
64 | 64 | $ hg forget *_*_*-untracked |
|
65 | 65 | $ rm *_*_missing-* |
|
66 | 66 | |
|
67 | 67 | Status compared to parent of the working copy, i.e. the dirstate status |
|
68 | 68 | |
|
69 | 69 | $ hg status -A --rev 1 'glob:missing_content2_content3-tracked' |
|
70 | 70 | M missing_content2_content3-tracked |
|
71 | 71 | $ hg status -A --rev 1 'glob:missing_content2_content2-tracked' |
|
72 | 72 | C missing_content2_content2-tracked |
|
73 | 73 | $ hg status -A --rev 1 'glob:missing_missing_content3-tracked' |
|
74 | 74 | A missing_missing_content3-tracked |
|
75 | 75 | $ hg status -A --rev 1 'glob:missing_missing_content3-untracked' |
|
76 | 76 | ? missing_missing_content3-untracked |
|
77 | 77 | $ hg status -A --rev 1 'glob:missing_content2_*-untracked' |
|
78 | 78 | R missing_content2_content2-untracked |
|
79 | 79 | R missing_content2_content3-untracked |
|
80 | 80 | R missing_content2_missing-untracked |
|
81 | 81 | $ hg status -A --rev 1 'glob:missing_*_missing-tracked' |
|
82 | 82 | ! missing_content2_missing-tracked |
|
83 | 83 | ! missing_missing_missing-tracked |
|
84 | 84 | #if windows |
|
85 | 85 | $ hg status -A --rev 1 'glob:missing_missing_missing-untracked' |
|
86 | 86 | missing_missing_missing-untracked: The system cannot find the file specified |
|
87 | 87 | #else |
|
88 | 88 | $ hg status -A --rev 1 'glob:missing_missing_missing-untracked' |
|
89 | 89 | missing_missing_missing-untracked: No such file or directory |
|
90 | 90 | #endif |
|
91 | 91 | |
|
92 | 92 | Status between first and second commit. Should ignore dirstate status. |
|
93 | 93 | |
|
94 | 94 | $ hg status -A --rev 0:1 'glob:content1_content2_*' |
|
95 | 95 | M content1_content2_content1-tracked |
|
96 | 96 | M content1_content2_content1-untracked |
|
97 | 97 | M content1_content2_content2-tracked |
|
98 | 98 | M content1_content2_content2-untracked |
|
99 | 99 | M content1_content2_content3-tracked |
|
100 | 100 | M content1_content2_content3-untracked |
|
101 | 101 | M content1_content2_missing-tracked |
|
102 | 102 | M content1_content2_missing-untracked |
|
103 | 103 | $ hg status -A --rev 0:1 'glob:content1_content1_*' |
|
104 | 104 | C content1_content1_content1-tracked |
|
105 | 105 | C content1_content1_content1-untracked |
|
106 | 106 | C content1_content1_content3-tracked |
|
107 | 107 | C content1_content1_content3-untracked |
|
108 | 108 | C content1_content1_missing-tracked |
|
109 | 109 | C content1_content1_missing-untracked |
|
110 | 110 | $ hg status -A --rev 0:1 'glob:missing_content2_*' |
|
111 | 111 | A missing_content2_content2-tracked |
|
112 | 112 | A missing_content2_content2-untracked |
|
113 | 113 | A missing_content2_content3-tracked |
|
114 | 114 | A missing_content2_content3-untracked |
|
115 | 115 | A missing_content2_missing-tracked |
|
116 | 116 | A missing_content2_missing-untracked |
|
117 | 117 | $ hg status -A --rev 0:1 'glob:content1_missing_*' |
|
118 | 118 | R content1_missing_content1-tracked |
|
119 | 119 | R content1_missing_content1-untracked |
|
120 | 120 | R content1_missing_content3-tracked |
|
121 | 121 | R content1_missing_content3-untracked |
|
122 | 122 | R content1_missing_missing-tracked |
|
123 | 123 | R content1_missing_missing-untracked |
|
124 | 124 | $ hg status -A --rev 0:1 'glob:missing_missing_*' |
|
125 | 125 | |
|
126 | 126 | Status compared to one revision back, checking that the dirstate status |
|
127 | 127 | is correctly combined with the inter-revision status |
|
128 | 128 | |
|
129 | 129 | $ hg status -A --rev 0 'glob:content1_*_content[23]-tracked' |
|
130 | 130 | M content1_content1_content3-tracked |
|
131 | 131 | M content1_content2_content2-tracked |
|
132 | 132 | M content1_content2_content3-tracked |
|
133 | 133 | M content1_missing_content3-tracked |
|
134 | 134 | $ hg status -A --rev 0 'glob:content1_*_content1-tracked' |
|
135 | 135 | C content1_content1_content1-tracked |
|
136 | 136 | C content1_content2_content1-tracked |
|
137 | 137 | C content1_missing_content1-tracked |
|
138 | 138 | $ hg status -A --rev 0 'glob:missing_*_content?-tracked' |
|
139 | 139 | A missing_content2_content2-tracked |
|
140 | 140 | A missing_content2_content3-tracked |
|
141 | 141 | A missing_missing_content3-tracked |
|
142 | 142 | BROKEN: missing_content2_content[23]-untracked exist, so should be listed |
|
143 | 143 | $ hg status -A --rev 0 'glob:missing_*_content?-untracked' |
|
144 | 144 | ? missing_missing_content3-untracked |
|
145 | 145 | $ hg status -A --rev 0 'glob:content1_*_*-untracked' |
|
146 | 146 | R content1_content1_content1-untracked |
|
147 | 147 | R content1_content1_content3-untracked |
|
148 | 148 | R content1_content1_missing-untracked |
|
149 | 149 | R content1_content2_content1-untracked |
|
150 | 150 | R content1_content2_content2-untracked |
|
151 | 151 | R content1_content2_content3-untracked |
|
152 | 152 | R content1_content2_missing-untracked |
|
153 | 153 | R content1_missing_content1-untracked |
|
154 | 154 | R content1_missing_content3-untracked |
|
155 | 155 | R content1_missing_missing-untracked |
|
156 | 156 | BROKEN: content1_*_missing-tracked appear twice; should just be '!' |
|
157 | 157 | $ hg status -A --rev 0 'glob:*_*_missing-tracked' |
|
158 | 158 | R content1_missing_missing-tracked |
|
159 | 159 | ! content1_content1_missing-tracked |
|
160 | 160 | ! content1_content2_missing-tracked |
|
161 | 161 | ! content1_missing_missing-tracked |
|
162 | 162 | ! missing_content2_missing-tracked |
|
163 | 163 | ! missing_missing_missing-tracked |
|
164 | 164 | C content1_content1_missing-tracked |
|
165 | 165 | C content1_content2_missing-tracked |
|
166 | 166 | $ hg status -A --rev 0 'glob:missing_*_missing-untracked' |
General Comments 0
You need to be logged in to leave comments.
Login now