# HG changeset patch # User Benoit Boissinot # Date 1150650648 -7200 # Node ID 9dd93deef3c97c28f5faccdeb82500dc44c3aaea # Parent 134227b82a963ea0adc172c1ad169dc0bbfef53f change log message creation when using 'hg import' if found cmdline is used else if found patch header is used else launch hgeditor diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1772,11 +1772,15 @@ def import_(ui, repo, patch1, *patches, elif message or line: message.append(line) - # make sure message isn't empty - if not message: - message = _("imported patch %s\n") % patch + if opts['message']: + # pickup the cmdline msg + message = opts['message'] + elif message: + # pickup the patch msg + message = '\n'.join(message).rstrip() else: - message = '\n'.join(message).rstrip() + # launch the editor + message = None ui.debug(_('message:\n%s\n') % message) if tmpfp: tmpfp.close() @@ -2960,10 +2964,11 @@ table = { [('p', 'strip', 1, _('directory strip option for patch. This has the same\n' 'meaning as the corresponding patch option')), + ('m', 'message', '', _('use as commit message')), ('b', 'base', '', _('base path')), ('f', 'force', None, _('skip check for outstanding uncommitted changes'))], - _('hg import [-p NUM] [-b BASE] [-f] PATCH...')), + _('hg import [-p NUM] [-b BASE] [-m MESSAGE] [-f] PATCH...')), "incoming|in": (incoming, [('M', 'no-merges', None, _('do not show merges')), ('f', 'force', None,