Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 18038:f8aee8033ab2
graft: move commit info building
This moves the logic for generating the commit metadata ahead of the
merge operation. The only purposae of this patch is to make
subsequent patches easier to read, and there should be no behavior
changes.
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Tue, 04 Dec 2012 12:54:18 -0800 |
parents | 8216eb592dcd |
children | 2c2564280900 |
comparison
equal
deleted
inserted
replaced
18037:c8326ffdcb4f | 18038:f8aee8033ab2 |
---|---|
2835 | 2835 |
2836 ui.status(_('grafting revision %s\n') % ctx.rev()) | 2836 ui.status(_('grafting revision %s\n') % ctx.rev()) |
2837 if opts.get('dry_run'): | 2837 if opts.get('dry_run'): |
2838 continue | 2838 continue |
2839 | 2839 |
2840 source = ctx.extra().get('source') | |
2841 if not source: | |
2842 source = ctx.hex() | |
2843 extra = {'source': source} | |
2844 user = ctx.user() | |
2845 if opts.get('user'): | |
2846 user = opts['user'] | |
2847 date = ctx.date() | |
2848 if opts.get('date'): | |
2849 date = opts['date'] | |
2850 message = ctx.description() | |
2851 if opts.get('log'): | |
2852 message += '\n(grafted from %s)' % ctx.hex() | |
2853 | |
2840 # we don't merge the first commit when continuing | 2854 # we don't merge the first commit when continuing |
2841 if not cont: | 2855 if not cont: |
2842 # perform the graft merge with p1(rev) as 'ancestor' | 2856 # perform the graft merge with p1(rev) as 'ancestor' |
2843 try: | 2857 try: |
2844 # ui.forcemerge is an internal variable, do not document | 2858 # ui.forcemerge is an internal variable, do not document |
2863 repo.dirstate.write() | 2877 repo.dirstate.write() |
2864 # fix up dirstate for copies and renames | 2878 # fix up dirstate for copies and renames |
2865 cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) | 2879 cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) |
2866 | 2880 |
2867 # commit | 2881 # commit |
2868 source = ctx.extra().get('source') | |
2869 if not source: | |
2870 source = ctx.hex() | |
2871 extra = {'source': source} | |
2872 user = ctx.user() | |
2873 if opts.get('user'): | |
2874 user = opts['user'] | |
2875 date = ctx.date() | |
2876 if opts.get('date'): | |
2877 date = opts['date'] | |
2878 message = ctx.description() | |
2879 if opts.get('log'): | |
2880 message += '\n(grafted from %s)' % ctx.hex() | |
2881 node = repo.commit(text=message, user=user, | 2882 node = repo.commit(text=message, user=user, |
2882 date=date, extra=extra, editor=editor) | 2883 date=date, extra=extra, editor=editor) |
2883 if node is None: | 2884 if node is None: |
2884 ui.status(_('graft for revision %s is empty\n') % ctx.rev()) | 2885 ui.status(_('graft for revision %s is empty\n') % ctx.rev()) |
2885 finally: | 2886 finally: |