mercurial/commands.py
changeset 15239 f5d9d0d0f588
parent 15238 2d710c12ffc0
child 15240 bfb93963bb39
equal deleted inserted replaced
15238:2d710c12ffc0 15239:f5d9d0d0f588
  2446 
  2446 
  2447     repo[None].forget(forget)
  2447     repo[None].forget(forget)
  2448     return errs
  2448     return errs
  2449 
  2449 
  2450 @command('graft',
  2450 @command('graft',
  2451     [],
  2451     [('e', 'edit', False, _('invoke editor on commit messages'))],
  2452     _('[OPTION]... REVISION...'))
  2452     _('[OPTION]... REVISION...'))
  2453 def graft(ui, repo, rev, *revs, **opts):
  2453 def graft(ui, repo, rev, *revs, **opts):
  2454     '''copy changes from other branches onto the current branch
  2454     '''copy changes from other branches onto the current branch
  2455 
  2455 
  2456     This command uses Mercurial's merge logic to copy individual
  2456     This command uses Mercurial's merge logic to copy individual
  2463 
  2463 
  2464     Returns 0 on successful completion.
  2464     Returns 0 on successful completion.
  2465     '''
  2465     '''
  2466 
  2466 
  2467     cmdutil.bailifchanged(repo)
  2467     cmdutil.bailifchanged(repo)
       
  2468 
       
  2469     editor = None
       
  2470     if opts.get('edit'):
       
  2471         editor = cmdutil.commitforceeditor
  2468 
  2472 
  2469     revs = [rev] + list(revs)
  2473     revs = [rev] + list(revs)
  2470     revs = scmutil.revrange(repo, revs)
  2474     revs = scmutil.revrange(repo, revs)
  2471 
  2475 
  2472     # check for merges
  2476     # check for merges
  2510             raise util.Abort(_("unresolved conflicts, can't continue"),
  2514             raise util.Abort(_("unresolved conflicts, can't continue"),
  2511                              hint=_('use hg resolve and hg graft --continue'))
  2515                              hint=_('use hg resolve and hg graft --continue'))
  2512         # commit
  2516         # commit
  2513         extra = {'source': ctx.hex()}
  2517         extra = {'source': ctx.hex()}
  2514         repo.commit(text=ctx.description(), user=ctx.user(),
  2518         repo.commit(text=ctx.description(), user=ctx.user(),
  2515                     date=ctx.date(), extra=extra)
  2519                     date=ctx.date(), extra=extra, editor=editor)
  2516 
  2520 
  2517     return 0
  2521     return 0
  2518 
  2522 
  2519 @command('grep',
  2523 @command('grep',
  2520     [('0', 'print0', None, _('end fields with NUL')),
  2524     [('0', 'print0', None, _('end fields with NUL')),