300 @eh.command( |
300 @eh.command( |
301 'uncommit', |
301 'uncommit', |
302 [('a', 'all', None, _('uncommit all changes when no arguments given')), |
302 [('a', 'all', None, _('uncommit all changes when no arguments given')), |
303 ('i', 'interactive', False, _('interactive mode to uncommit (EXPERIMENTAL)')), |
303 ('i', 'interactive', False, _('interactive mode to uncommit (EXPERIMENTAL)')), |
304 ('r', 'rev', '', _('revert commit content to REV instead')), |
304 ('r', 'rev', '', _('revert commit content to REV instead')), |
|
305 ('', 'revert', False, _('discard working directory changes after uncommit')), |
305 ('n', 'note', '', _('store a note on uncommit')), |
306 ('n', 'note', '', _('store a note on uncommit')), |
306 ] + commands.walkopts + commitopts + commitopts2 + commitopts3, |
307 ] + commands.walkopts + commitopts + commitopts2 + commitopts3, |
307 _('[OPTION]... [NAME]')) |
308 _('[OPTION]... [NAME]')) |
308 def uncommit(ui, repo, *pats, **opts): |
309 def uncommit(ui, repo, *pats, **opts): |
309 """move changes from parent revision to working directory |
310 """move changes from parent revision to working directory |
386 if opts.get('note'): |
387 if opts.get('note'): |
387 metadata['note'] = opts['note'] |
388 metadata['note'] = opts['note'] |
388 |
389 |
389 obsolete.createmarkers(repo, [(old, (repo[newid],))], metadata=metadata) |
390 obsolete.createmarkers(repo, [(old, (repo[newid],))], metadata=metadata) |
390 phases.retractboundary(repo, tr, oldphase, [newid]) |
391 phases.retractboundary(repo, tr, oldphase, [newid]) |
391 with repo.dirstate.parentchange(): |
392 if opts.get('revert'): |
392 repo.dirstate.setparents(newid, node.nullid) |
393 hg.updaterepo(repo, newid, True) |
393 _uncommitdirstate(repo, old, match, interactive) |
394 else: |
|
395 with repo.dirstate.parentchange(): |
|
396 repo.dirstate.setparents(newid, node.nullid) |
|
397 _uncommitdirstate(repo, old, match, interactive) |
394 updatebookmarks(newid) |
398 updatebookmarks(newid) |
395 if not repo[newid].files(): |
399 if not repo[newid].files(): |
396 ui.warn(_("new changeset is empty\n")) |
400 ui.warn(_("new changeset is empty\n")) |
397 ui.status(_("(use 'hg prune .' to remove it)\n")) |
401 ui.status(_("(use 'hg prune .' to remove it)\n")) |
398 tr.close() |
402 tr.close() |