Show More
@@ -2447,8 +2447,14 b' def forget(ui, repo, *pats, **opts):' | |||||
2447 | repo[None].forget(forget) |
|
2447 | repo[None].forget(forget) | |
2448 | return errs |
|
2448 | return errs | |
2449 |
|
2449 | |||
2450 |
@command( |
|
2450 | @command( | |
2451 | [('e', 'edit', False, _('invoke editor on commit messages'))], |
|
2451 | 'graft', | |
|
2452 | [('e', 'edit', False, _('invoke editor on commit messages')), | |||
|
2453 | ('D', 'currentdate', False, | |||
|
2454 | _('record the current date as commit date')), | |||
|
2455 | ('U', 'currentuser', False, | |||
|
2456 | _('record the current user as committer'), _('DATE'))] | |||
|
2457 | + commitopts2 + mergetoolopts, | |||
2452 | _('[OPTION]... REVISION...')) |
|
2458 | _('[OPTION]... REVISION...')) | |
2453 | def graft(ui, repo, rev, *revs, **opts): |
|
2459 | def graft(ui, repo, rev, *revs, **opts): | |
2454 | '''copy changes from other branches onto the current branch |
|
2460 | '''copy changes from other branches onto the current branch | |
@@ -2466,6 +2472,11 b' def graft(ui, repo, rev, *revs, **opts):' | |||||
2466 |
|
2472 | |||
2467 | cmdutil.bailifchanged(repo) |
|
2473 | cmdutil.bailifchanged(repo) | |
2468 |
|
2474 | |||
|
2475 | if not opts.get('user') and opts.get('currentuser'): | |||
|
2476 | opts['user'] = ui.username() | |||
|
2477 | if not opts.get('date') and opts.get('currentdate'): | |||
|
2478 | opts['date'] = "%d %d" % util.makedate() | |||
|
2479 | ||||
2469 | editor = None |
|
2480 | editor = None | |
2470 | if opts.get('edit'): |
|
2481 | if opts.get('edit'): | |
2471 | editor = cmdutil.commitforceeditor |
|
2482 | editor = cmdutil.commitforceeditor | |
@@ -2502,8 +2513,13 b' def graft(ui, repo, rev, *revs, **opts):' | |||||
2502 | current = repo['.'] |
|
2513 | current = repo['.'] | |
2503 | ui.debug('grafting revision %s', ctx.rev()) |
|
2514 | ui.debug('grafting revision %s', ctx.rev()) | |
2504 | # perform the graft merge with p1(rev) as 'ancestor' |
|
2515 | # perform the graft merge with p1(rev) as 'ancestor' | |
2505 | stats = mergemod.update(repo, ctx.node(), True, True, False, |
|
2516 | try: | |
2506 | ctx.p1().node()) |
|
2517 | # ui.forcemerge is an internal variable, do not document | |
|
2518 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) | |||
|
2519 | stats = mergemod.update(repo, ctx.node(), True, True, False, | |||
|
2520 | ctx.p1().node()) | |||
|
2521 | finally: | |||
|
2522 | ui.setconfig('ui', 'forcemerge', '') | |||
2507 | # drop the second merge parent |
|
2523 | # drop the second merge parent | |
2508 | repo.dirstate.setparents(current.node(), nullid) |
|
2524 | repo.dirstate.setparents(current.node(), nullid) | |
2509 | repo.dirstate.write() |
|
2525 | repo.dirstate.write() | |
@@ -2515,8 +2531,14 b' def graft(ui, repo, rev, *revs, **opts):' | |||||
2515 | hint=_('use hg resolve and hg graft --continue')) |
|
2531 | hint=_('use hg resolve and hg graft --continue')) | |
2516 | # commit |
|
2532 | # commit | |
2517 | extra = {'source': ctx.hex()} |
|
2533 | extra = {'source': ctx.hex()} | |
2518 | repo.commit(text=ctx.description(), user=ctx.user(), |
|
2534 | user = ctx.user() | |
2519 | date=ctx.date(), extra=extra, editor=editor) |
|
2535 | if opts.get('user'): | |
|
2536 | user = opts['user'] | |||
|
2537 | date = ctx.date() | |||
|
2538 | if opts.get('date'): | |||
|
2539 | date = opts['date'] | |||
|
2540 | repo.commit(text=ctx.description(), user=user, | |||
|
2541 | date=date, extra=extra, editor=editor) | |||
2520 |
|
2542 | |||
2521 | return 0 |
|
2543 | return 0 | |
2522 |
|
2544 |
@@ -243,7 +243,7 b' Show all commands + options' | |||||
243 | debugsub: rev |
|
243 | debugsub: rev | |
244 | debugwalk: include, exclude |
|
244 | debugwalk: include, exclude | |
245 | debugwireargs: three, four, five, ssh, remotecmd, insecure |
|
245 | debugwireargs: three, four, five, ssh, remotecmd, insecure | |
246 | graft: edit |
|
246 | graft: edit, currentdate, currentuser, date, user, tool | |
247 | grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude |
|
247 | grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude | |
248 | heads: rev, topo, active, closed, style, template |
|
248 | heads: rev, topo, active, closed, style, template | |
249 | help: extension, command |
|
249 | help: extension, command |
General Comments 0
You need to be logged in to leave comments.
Login now