# HG changeset patch # User David Schleimer # Date 1354654458 28800 # Node ID f8aee8033ab2fe7c8a7ae6d8a692d2aa2569e07a # Parent c8326ffdcb4f86877b4e71ac7df213365305cd6d 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. diff -r c8326ffdcb4f -r f8aee8033ab2 mercurial/commands.py --- a/mercurial/commands.py Thu Dec 06 16:42:15 2012 -0600 +++ b/mercurial/commands.py Tue Dec 04 12:54:18 2012 -0800 @@ -2837,6 +2837,20 @@ if opts.get('dry_run'): continue + source = ctx.extra().get('source') + if not source: + source = ctx.hex() + extra = {'source': source} + user = ctx.user() + if opts.get('user'): + user = opts['user'] + date = ctx.date() + if opts.get('date'): + date = opts['date'] + message = ctx.description() + if opts.get('log'): + message += '\n(grafted from %s)' % ctx.hex() + # we don't merge the first commit when continuing if not cont: # perform the graft merge with p1(rev) as 'ancestor' @@ -2865,19 +2879,6 @@ cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) # commit - source = ctx.extra().get('source') - if not source: - source = ctx.hex() - extra = {'source': source} - user = ctx.user() - if opts.get('user'): - user = opts['user'] - date = ctx.date() - if opts.get('date'): - date = opts['date'] - message = ctx.description() - if opts.get('log'): - message += '\n(grafted from %s)' % ctx.hex() node = repo.commit(text=message, user=user, date=date, extra=extra, editor=editor) if node is None: