Show More
@@ -2673,52 +2673,56 b' def graft(ui, repo, *revs, **opts):' | |||||
2673 | if not revs: |
|
2673 | if not revs: | |
2674 | return -1 |
|
2674 | return -1 | |
2675 |
|
2675 | |||
2676 | for pos, ctx in enumerate(repo.set("%ld", revs)): |
|
2676 | wlock = repo.wlock() | |
2677 | current = repo['.'] |
|
2677 | try: | |
2678 |
|
2678 | for pos, ctx in enumerate(repo.set("%ld", revs)): | ||
2679 | ui.status(_('grafting revision %s\n') % ctx.rev()) |
|
2679 | current = repo['.'] | |
2680 | if opts.get('dry_run'): |
|
2680 | ||
2681 | continue |
|
2681 | ui.status(_('grafting revision %s\n') % ctx.rev()) | |
2682 |
|
2682 | if opts.get('dry_run'): | ||
2683 | # we don't merge the first commit when continuing |
|
2683 | continue | |
2684 | if not cont: |
|
2684 | ||
2685 | # perform the graft merge with p1(rev) as 'ancestor' |
|
2685 | # we don't merge the first commit when continuing | |
2686 |
|
|
2686 | if not cont: | |
2687 | # ui.forcemerge is an internal variable, do not document |
|
2687 | # perform the graft merge with p1(rev) as 'ancestor' | |
2688 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) |
|
2688 | try: | |
2689 | stats = mergemod.update(repo, ctx.node(), True, True, False, |
|
2689 | # ui.forcemerge is an internal variable, do not document | |
2690 | ctx.p1().node()) |
|
2690 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) | |
2691 | finally: |
|
2691 | stats = mergemod.update(repo, ctx.node(), True, True, False, | |
2692 | ui.setconfig('ui', 'forcemerge', '') |
|
2692 | ctx.p1().node()) | |
2693 | # drop the second merge parent |
|
2693 | finally: | |
2694 | repo.dirstate.setparents(current.node(), nullid) |
|
2694 | ui.setconfig('ui', 'forcemerge', '') | |
2695 | repo.dirstate.write() |
|
2695 | # drop the second merge parent | |
2696 | # fix up dirstate for copies and renames |
|
2696 | repo.dirstate.setparents(current.node(), nullid) | |
2697 | cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) |
|
2697 | repo.dirstate.write() | |
2698 | # report any conflicts |
|
2698 | # fix up dirstate for copies and renames | |
2699 | if stats and stats[3] > 0: |
|
2699 | cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) | |
2700 |
# |
|
2700 | # report any conflicts | |
2701 | nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] |
|
2701 | if stats and stats[3] > 0: | |
2702 | repo.opener.write('graftstate', ''.join(nodelines)) |
|
2702 | # write out state for --continue | |
2703 | raise util.Abort( |
|
2703 | nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] | |
2704 | _("unresolved conflicts, can't continue"), |
|
2704 | repo.opener.write('graftstate', ''.join(nodelines)) | |
2705 | hint=_('use hg resolve and hg graft --continue')) |
|
2705 | raise util.Abort( | |
2706 | else: |
|
2706 | _("unresolved conflicts, can't continue"), | |
2707 | cont = False |
|
2707 | hint=_('use hg resolve and hg graft --continue')) | |
2708 |
|
2708 | else: | ||
2709 | # commit |
|
2709 | cont = False | |
2710 | source = ctx.extra().get('source') |
|
2710 | ||
2711 | if not source: |
|
2711 | # commit | |
2712 |
source = ctx. |
|
2712 | source = ctx.extra().get('source') | |
2713 | extra = {'source': source} |
|
2713 | if not source: | |
2714 |
|
|
2714 | source = ctx.hex() | |
2715 | if opts.get('user'): |
|
2715 | extra = {'source': source} | |
2716 |
user = |
|
2716 | user = ctx.user() | |
2717 | date = ctx.date() |
|
2717 | if opts.get('user'): | |
2718 | if opts.get('date'): |
|
2718 | user = opts['user'] | |
2719 |
date = |
|
2719 | date = ctx.date() | |
2720 | repo.commit(text=ctx.description(), user=user, |
|
2720 | if opts.get('date'): | |
2721 | date=date, extra=extra, editor=editor) |
|
2721 | date = opts['date'] | |
|
2722 | repo.commit(text=ctx.description(), user=user, | |||
|
2723 | date=date, extra=extra, editor=editor) | |||
|
2724 | finally: | |||
|
2725 | wlock.release() | |||
2722 |
|
2726 | |||
2723 | # remove state when we complete successfully |
|
2727 | # remove state when we complete successfully | |
2724 | if not opts.get('dry_run') and os.path.exists(repo.join('graftstate')): |
|
2728 | if not opts.get('dry_run') and os.path.exists(repo.join('graftstate')): |
@@ -242,12 +242,12 b' Graft again onto another branch should p' | |||||
242 | 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4 |
|
242 | 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4 | |
243 |
|
243 | |||
244 | $ hg log --debug -r tip |
|
244 | $ hg log --debug -r tip | |
245 | changeset: 13:39bb1d13572759bd1e6fc874fed1b12ece047a18 |
|
245 | changeset: 13:95adbe5de6b10f376b699ece9ed5a57cd7b4b0f6 | |
246 | tag: tip |
|
246 | tag: tip | |
247 | phase: draft |
|
247 | phase: draft | |
248 | parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f |
|
248 | parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f | |
249 | parent: -1:0000000000000000000000000000000000000000 |
|
249 | parent: -1:0000000000000000000000000000000000000000 | |
250 | manifest: 13:0780e055d8f4cd12eadd5a2719481648f336f7a9 |
|
250 | manifest: 13:9944044f82a462bbaccc9bdf7e0ac5b811db7d1b | |
251 | user: foo |
|
251 | user: foo | |
252 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
252 | date: Thu Jan 01 00:00:00 1970 +0000 | |
253 | files+: b |
|
253 | files+: b |
General Comments 0
You need to be logged in to leave comments.
Login now