##// END OF EJS Templates
fix: add --all flag to fix non-public non-obsolete revisions...
Danny Hooper -
r37613:e2506748 default
parent child Browse files
Show More
@@ -95,7 +95,8 b' for key in FIXER_ATTRS:'
95 95 configitem('fix', 'maxfilesize', default='2MB')
96 96
97 97 @command('fix',
98 [('', 'base', [], _('revisions to diff against (overrides automatic '
98 [('', 'all', False, _('fix all non-public non-obsolete revisions')),
99 ('', 'base', [], _('revisions to diff against (overrides automatic '
99 100 'selection, and applies to every revision being '
100 101 'fixed)'), _('REV')),
101 102 ('r', 'rev', [], _('revisions to fix'), _('REV')),
@@ -125,6 +126,11 b' def fix(ui, repo, *pats, **opts):'
125 126 revisions are not forgotten in later ones. The --base flag can be used to
126 127 override this default behavior, though it is not usually desirable to do so.
127 128 """
129 if opts['all']:
130 if opts['rev']:
131 raise error.Abort(_('cannot specify both "--rev" and "--all"'))
132 opts['rev'] = ['not public() and not obsolete()']
133 opts['working_dir'] = True
128 134 with repo.wlock(), repo.lock():
129 135 revstofix = getrevstofix(ui, repo, opts)
130 136 basectxs = getbasectxs(repo, opts, revstofix)
@@ -266,3 +266,152 b' Change A was never a baserev because non'
266 266
267 267 $ cd ..
268 268
269 The --all flag should fix anything that wouldn't cause a problem if you fixed
270 it, including the working copy. Obsolete revisions are not fixed because that
271 could cause divergence. Public revisions would cause an abort because they are
272 immutable. We can fix orphans because their successors are still just orphans
273 of the original obsolete parent. When obsolesence is off, we're just fixing and
274 replacing anything that isn't public.
275
276 $ hg init fixall
277 $ cd fixall
278
279 #if obsstore-on
280 $ printf "one\n" > foo.whole
281 $ hg commit -Aqm "first"
282 $ hg phase --public
283 $ hg tag --local root
284 $ printf "two\n" > foo.whole
285 $ hg commit -m "second"
286 $ printf "three\n" > foo.whole
287 $ hg commit -m "third" --secret
288 $ hg tag --local secret
289 $ hg checkout root
290 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
291 $ printf "four\n" > foo.whole
292 $ hg commit -m "fourth"
293 created new head
294 $ printf "five\n" > foo.whole
295 $ hg commit -m "fifth"
296 $ hg tag --local replaced
297 $ printf "six\n" > foo.whole
298 $ hg commit -m "sixth"
299 $ hg checkout replaced
300 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
301 $ printf "seven\n" > foo.whole
302 $ hg commit --amend
303 1 new orphan changesets
304 $ hg checkout secret
305 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
306 $ printf "uncommitted\n" > foo.whole
307
308 $ hg log --graph --template '{rev} {desc} {phase}\n'
309 o 6 fifth draft
310 |
311 | * 5 sixth draft
312 | |
313 | x 4 fifth draft
314 |/
315 o 3 fourth draft
316 |
317 | @ 2 third secret
318 | |
319 | o 1 second draft
320 |/
321 o 0 first public
322
323
324 $ hg fix --all
325 1 new orphan changesets
326
327 $ hg log --graph --template '{rev} {desc}\n' -r 'sort(all(), topo)' --hidden
328 o 11 fifth
329 |
330 o 9 fourth
331 |
332 | @ 8 third
333 | |
334 | o 7 second
335 |/
336 | * 10 sixth
337 | |
338 | | x 5 sixth
339 | |/
340 | x 4 fifth
341 | |
342 | | x 6 fifth
343 | |/
344 | x 3 fourth
345 |/
346 | x 2 third
347 | |
348 | x 1 second
349 |/
350 o 0 first
351
352
353 $ hg cat -r 7 foo.whole
354 TWO
355 $ hg cat -r 8 foo.whole
356 THREE
357 $ hg cat -r 9 foo.whole
358 FOUR
359 $ hg cat -r 10 foo.whole
360 SIX
361 $ hg cat -r 11 foo.whole
362 SEVEN
363 $ cat foo.whole
364 UNCOMMITTED
365 #else
366 $ printf "one\n" > foo.whole
367 $ hg commit -Aqm "first"
368 $ hg phase --public
369 $ hg tag --local root
370 $ printf "two\n" > foo.whole
371 $ hg commit -m "second"
372 $ printf "three\n" > foo.whole
373 $ hg commit -m "third" --secret
374 $ hg tag --local secret
375 $ hg checkout root
376 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 $ printf "four\n" > foo.whole
378 $ hg commit -m "fourth"
379 created new head
380 $ printf "uncommitted\n" > foo.whole
381
382 $ hg log --graph --template '{rev} {desc} {phase}\n'
383 @ 3 fourth draft
384 |
385 | o 2 third secret
386 | |
387 | o 1 second draft
388 |/
389 o 0 first public
390
391
392 $ hg fix --all
393 saved backup bundle to * (glob)
394
395 $ hg log --graph --template '{rev} {desc} {phase}\n'
396 @ 3 fourth draft
397 |
398 | o 2 third secret
399 | |
400 | o 1 second draft
401 |/
402 o 0 first public
403
404 $ hg cat -r 0 foo.whole
405 one
406 $ hg cat -r 1 foo.whole
407 TWO
408 $ hg cat -r 2 foo.whole
409 THREE
410 $ hg cat -r 3 foo.whole
411 FOUR
412 $ cat foo.whole
413 UNCOMMITTED
414 #endif
415
416 $ cd ..
417
@@ -104,6 +104,7 b' Help text for fix.'
104 104
105 105 options ([+] can be repeated):
106 106
107 --all fix all non-public non-obsolete revisions
107 108 --base REV [+] revisions to diff against (overrides automatic selection,
108 109 and applies to every revision being fixed)
109 110 -r --rev REV [+] revisions to fix
General Comments 0
You need to be logged in to leave comments. Login now