Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 15211:1209de02034e
backout: deprecate/hide support for backing out merges
This has never worked usefully:
- it can't undo a completely unwanted merge, as it leaves the merge in the DAG
- it can't undo a faulty merge as that means doing a merge correctly,
not simply reverting to one or the other parent
Both of these kinds of merge also require coordinated action among
developers to avoid the bad merge continuing to affect future merges,
so we should stop pretending that backout is of any help here.
As backing out a merge now requires a hidden option, it can't be done
by accident, but will continue to 'work' for anyone who's already
dependent on --parent for some unknown reason.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 08 Oct 2011 14:18:18 -0500 |
parents | 9d8115c5fbda |
children | fad02a84c4ac |
comparison
equal
deleted
inserted
replaced
15210:9d8115c5fbda | 15211:1209de02034e |
---|---|
362 archival.archive(repo, dest, node, kind, not opts.get('no_decode'), | 362 archival.archive(repo, dest, node, kind, not opts.get('no_decode'), |
363 matchfn, prefix, subrepos=opts.get('subrepos')) | 363 matchfn, prefix, subrepos=opts.get('subrepos')) |
364 | 364 |
365 @command('backout', | 365 @command('backout', |
366 [('', 'merge', None, _('merge with old dirstate parent after backout')), | 366 [('', 'merge', None, _('merge with old dirstate parent after backout')), |
367 ('', 'parent', '', _('parent to choose when backing out merge'), _('REV')), | 367 ('', 'parent', '', |
368 _('parent to choose when backing out merge (DEPRECATED)'), _('REV')), | |
368 ('r', 'rev', '', _('revision to backout'), _('REV')), | 369 ('r', 'rev', '', _('revision to backout'), _('REV')), |
369 ] + mergetoolopts + walkopts + commitopts + commitopts2, | 370 ] + mergetoolopts + walkopts + commitopts + commitopts2, |
370 _('[OPTION]... [-r] REV')) | 371 _('[OPTION]... [-r] REV')) |
371 def backout(ui, repo, node=None, rev=None, **opts): | 372 def backout(ui, repo, node=None, rev=None, **opts): |
372 '''reverse effect of earlier changeset | 373 '''reverse effect of earlier changeset |
422 p1, p2 = repo.changelog.parents(node) | 423 p1, p2 = repo.changelog.parents(node) |
423 if p1 == nullid: | 424 if p1 == nullid: |
424 raise util.Abort(_('cannot backout a change with no parents')) | 425 raise util.Abort(_('cannot backout a change with no parents')) |
425 if p2 != nullid: | 426 if p2 != nullid: |
426 if not opts.get('parent'): | 427 if not opts.get('parent'): |
427 raise util.Abort(_('cannot backout a merge changeset without ' | 428 raise util.Abort(_('cannot backout a merge changeset')) |
428 '--parent')) | |
429 p = repo.lookup(opts['parent']) | 429 p = repo.lookup(opts['parent']) |
430 if p not in (p1, p2): | 430 if p not in (p1, p2): |
431 raise util.Abort(_('%s is not a parent of %s') % | 431 raise util.Abort(_('%s is not a parent of %s') % |
432 (short(p), short(node))) | 432 (short(p), short(node))) |
433 parent = p | 433 parent = p |