mercurial/commands.py
changeset 2618 8367b67ad397
parent 2617 0b4bff2b0ce3
parent 2614 8ba1c31f6864
child 2620 de82749d3a71
equal deleted inserted replaced
2617:0b4bff2b0ce3 2618:8367b67ad397
   863     bail_if_changed(repo)
   863     bail_if_changed(repo)
   864     op1, op2 = repo.dirstate.parents()
   864     op1, op2 = repo.dirstate.parents()
   865     if op2 != nullid:
   865     if op2 != nullid:
   866         raise util.Abort(_('outstanding uncommitted merge'))
   866         raise util.Abort(_('outstanding uncommitted merge'))
   867     node = repo.lookup(rev)
   867     node = repo.lookup(rev)
   868     parent, p2 = repo.changelog.parents(node)
   868     p1, p2 = repo.changelog.parents(node)
   869     if parent == nullid:
   869     if p1 == nullid:
   870         raise util.Abort(_('cannot back out a change with no parents'))
   870         raise util.Abort(_('cannot back out a change with no parents'))
   871     if p2 != nullid:
   871     if p2 != nullid:
   872         raise util.Abort(_('cannot back out a merge'))
   872         if not opts['parent']:
       
   873             raise util.Abort(_('cannot back out a merge changeset without '
       
   874                                '--parent'))
       
   875         p = repo.lookup(opts['parent'])
       
   876         if p not in (p1, p2):
       
   877             raise util.Abort(_('%s is not a parent of %s' %
       
   878                                (short(p), short(node))))
       
   879         parent = p
       
   880     else:
       
   881         if opts['parent']:
       
   882             raise util.Abort(_('cannot use --parent on non-merge changeset'))
       
   883         parent = p1
   873     repo.update(node, force=True, show_stats=False)
   884     repo.update(node, force=True, show_stats=False)
   874     revert_opts = opts.copy()
   885     revert_opts = opts.copy()
   875     revert_opts['rev'] = hex(parent)
   886     revert_opts['rev'] = hex(parent)
   876     revert(ui, repo, **revert_opts)
   887     revert(ui, repo, **revert_opts)
   877     commit_opts = opts.copy()
   888     commit_opts = opts.copy()
   957     for the pull command for important details about ssh:// URLs.
   968     for the pull command for important details about ssh:// URLs.
   958     """
   969     """
   959     ui.setconfig_remoteopts(**opts)
   970     ui.setconfig_remoteopts(**opts)
   960     hg.clone(ui, ui.expandpath(source), dest,
   971     hg.clone(ui, ui.expandpath(source), dest,
   961              pull=opts['pull'],
   972              pull=opts['pull'],
       
   973              stream=opts['stream'],
   962              rev=opts['rev'],
   974              rev=opts['rev'],
   963              update=not opts['noupdate'])
   975              update=not opts['noupdate'])
   964 
   976 
   965 def commit(ui, repo, *pats, **opts):
   977 def commit(ui, repo, *pats, **opts):
   966     """commit the specified files or all outstanding changes
   978     """commit the specified files or all outstanding changes
  2826          [('', 'merge', None,
  2838          [('', 'merge', None,
  2827            _('merge with old dirstate parent after backout')),
  2839            _('merge with old dirstate parent after backout')),
  2828           ('m', 'message', '', _('use <text> as commit message')),
  2840           ('m', 'message', '', _('use <text> as commit message')),
  2829           ('l', 'logfile', '', _('read commit message from <file>')),
  2841           ('l', 'logfile', '', _('read commit message from <file>')),
  2830           ('d', 'date', '', _('record datecode as commit date')),
  2842           ('d', 'date', '', _('record datecode as commit date')),
       
  2843           ('', 'parent', '', _('parent to choose when backing out merge')),
  2831           ('u', 'user', '', _('record user as committer')),
  2844           ('u', 'user', '', _('record user as committer')),
  2832           ('I', 'include', [], _('include names matching the given patterns')),
  2845           ('I', 'include', [], _('include names matching the given patterns')),
  2833           ('X', 'exclude', [], _('exclude names matching the given patterns'))],
  2846           ('X', 'exclude', [], _('exclude names matching the given patterns'))],
  2834          _('hg backout [OPTION]... REV')),
  2847          _('hg backout [OPTION]... REV')),
  2835     "bundle":
  2848     "bundle":
  2848         (clone,
  2861         (clone,
  2849          [('U', 'noupdate', None, _('do not update the new working directory')),
  2862          [('U', 'noupdate', None, _('do not update the new working directory')),
  2850           ('r', 'rev', [],
  2863           ('r', 'rev', [],
  2851            _('a changeset you would like to have after cloning')),
  2864            _('a changeset you would like to have after cloning')),
  2852           ('', 'pull', None, _('use pull protocol to copy metadata')),
  2865           ('', 'pull', None, _('use pull protocol to copy metadata')),
       
  2866           ('', 'stream', None, _('use streaming protocol (fast over LAN)')),
  2853           ('e', 'ssh', '', _('specify ssh command to use')),
  2867           ('e', 'ssh', '', _('specify ssh command to use')),
  2854           ('', 'remotecmd', '',
  2868           ('', 'remotecmd', '',
  2855            _('specify hg command to run on the remote side'))],
  2869            _('specify hg command to run on the remote side'))],
  2856          _('hg clone [OPTION]... SOURCE [DEST]')),
  2870          _('hg clone [OPTION]... SOURCE [DEST]')),
  2857     "^commit|ci":
  2871     "^commit|ci":