mercurial/commands.py
changeset 16660 2a71cc53f244
parent 16659 58edd786e96f
child 16683 525fdb738975
equal deleted inserted replaced
16659:58edd786e96f 16660:2a71cc53f244
  2579 
  2579 
  2580 @command(
  2580 @command(
  2581     'graft',
  2581     'graft',
  2582     [('c', 'continue', False, _('resume interrupted graft')),
  2582     [('c', 'continue', False, _('resume interrupted graft')),
  2583      ('e', 'edit', False, _('invoke editor on commit messages')),
  2583      ('e', 'edit', False, _('invoke editor on commit messages')),
       
  2584      ('', 'log', None, _('append graft info to log message')),
  2584      ('D', 'currentdate', False,
  2585      ('D', 'currentdate', False,
  2585       _('record the current date as commit date')),
  2586       _('record the current date as commit date')),
  2586      ('U', 'currentuser', False,
  2587      ('U', 'currentuser', False,
  2587       _('record the current user as committer'), _('DATE'))]
  2588       _('record the current user as committer'), _('DATE'))]
  2588     + commitopts2 + mergetoolopts  + dryrunopts,
  2589     + commitopts2 + mergetoolopts  + dryrunopts,
  2596     'cherry-picking'. By default, graft will copy user, date, and
  2597     'cherry-picking'. By default, graft will copy user, date, and
  2597     description from the source changesets.
  2598     description from the source changesets.
  2598 
  2599 
  2599     Changesets that are ancestors of the current revision, that have
  2600     Changesets that are ancestors of the current revision, that have
  2600     already been grafted, or that are merges will be skipped.
  2601     already been grafted, or that are merges will be skipped.
       
  2602 
       
  2603     If --log is specified, log messages will have a comment appended
       
  2604     of the form::
       
  2605 
       
  2606       (grafted from CHANGESETHASH)
  2601 
  2607 
  2602     If a graft merge results in conflicts, the graft process is
  2608     If a graft merge results in conflicts, the graft process is
  2603     interrupted so that the current merge can be manually resolved.
  2609     interrupted so that the current merge can be manually resolved.
  2604     Once all conflicts are addressed, the graft process can be
  2610     Once all conflicts are addressed, the graft process can be
  2605     continued with the -c/--continue option.
  2611     continued with the -c/--continue option.
  2746             if opts.get('user'):
  2752             if opts.get('user'):
  2747                 user = opts['user']
  2753                 user = opts['user']
  2748             date = ctx.date()
  2754             date = ctx.date()
  2749             if opts.get('date'):
  2755             if opts.get('date'):
  2750                 date = opts['date']
  2756                 date = opts['date']
  2751             node = repo.commit(text=ctx.description(), user=user,
  2757             message = ctx.description()
       
  2758             if opts.get('log'):
       
  2759                 message += '\n(grafted from %s)' % ctx.hex()
       
  2760             node = repo.commit(text=message, user=user,
  2752                         date=date, extra=extra, editor=editor)
  2761                         date=date, extra=extra, editor=editor)
  2753             if node is None:
  2762             if node is None:
  2754                 ui.status(_('graft for revision %s is empty\n') % ctx.rev())
  2763                 ui.status(_('graft for revision %s is empty\n') % ctx.rev())
  2755     finally:
  2764     finally:
  2756         wlock.release()
  2765         wlock.release()