Small patch for qrefresh help

Mathieu Clabaut mathieu.clabaut at gmail.com
Mon Nov 20 16:47:28 CST 2006


On 11/20/06, Thomas Arendsen Hein <thomas at intevation.de> wrote:
> * Mathieu Clabaut <mathieu.clabaut at gmail.com> [20061119 22:11]:
> > The patch is also attaches to overcome mailer whitespace mangling.
> Maybe it is time to consolidate these two options in
> commands.commitopts, look at commands.walkopts for an example
> Can you prepare a patch?

For sure, here it is (and attached) :
# HG changeset patch
# User Mathieu Clabaut <mathieu.clabaut at gmail.com>
# Date 1164062241 -3600
# Node ID 6a4a259037e19714091decd25e35dc43f4426d37
# Parent  55c4ba8473a5a35a23d5c084c315c270c6073f8b
Uniformisation of commit help for -m and -l.
 Addition of the -m and -l options for hg import.
 'hg tag' still lacks the --logfile option which short form conflicts with
 its --local option.

diff -r 55c4ba8473a5 -r 6a4a259037e1 hgext/mq.py
--- a/hgext/mq.py	Mon Nov 20 23:09:50 2006 +0100
+++ b/hgext/mq.py	Mon Nov 20 23:37:21 2006 +0100
@@ -2122,9 +2122,8 @@ cmdtable = {
     'qfold':
         (fold,
          [('e', 'edit', None, _('edit patch header')),
-          ('k', 'keep', None, _('keep folded patch files')),
-          ('m', 'message', '', _('set patch header to <text>')),
-          ('l', 'logfile', '', _('set patch header to contents of <file>'))],
+          ('k', 'keep', None, _('keep folded patch files'))
+          ] + commands.commitopts,
          'hg qfold [-e] [-m <text>] [-l <file] PATCH...'),
     'qguard': (guard, [('l', 'list', None, _('list all patches and guards')),
                        ('n', 'none', None, _('drop all guards'))],
@@ -2146,9 +2145,8 @@ cmdtable = {
     "qnew":
         (new,
          [('e', 'edit', None, _('edit commit message')),
-          ('m', 'message', '', _('use <text> as commit message')),
-          ('l', 'logfile', '', _('read the commit message from <file>')),
-          ('f', 'force', None, _('import uncommitted changes into patch'))],
+          ('f', 'force', None, _('import uncommitted changes into patch'))
+          ] + commands.commitopts,
          'hg qnew [-e] [-m TEXT] [-l FILE] [-f] PATCH'),
     "qnext": (next, [] + seriesopts, 'hg qnext [-s]'),
     "qprev": (prev, [] + seriesopts, 'hg qprev [-s]'),
@@ -2169,12 +2167,11 @@ cmdtable = {
     "^qrefresh":
         (refresh,
          [('e', 'edit', None, _('edit commit message')),
-          ('m', 'message', '', _('change commit message to <text>')),
-          ('l', 'logfile', '', _('change commit message to <file> content')),
           ('g', 'git', None, _('use git extended diff format')),
           ('s', 'short', None, 'refresh only files already in the patch'),
           ('I', 'include', [], _('include names matching the given patterns')),
-          ('X', 'exclude', [], _('exclude names matching the given
patterns'))],
+          ('X', 'exclude', [], _('exclude names matching the given patterns'))
+          ] + commands.commitopts,
          'hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] FILES...'),
     'qrename|qmv':
         (rename, [], 'hg qrename PATCH1 [PATCH2]'),
@@ -2185,12 +2182,10 @@ cmdtable = {
          'hg qrestore [-d] [-u] REV'),
     "qsave":
         (save,
-         [('m', 'message', '', _('use <text> as commit message')),
-          ('l', 'logfile', '', _('read the commit message from <file>')),
-          ('c', 'copy', None, 'copy patch directory'),
+         [('c', 'copy', None, 'copy patch directory'),
           ('n', 'name', '', 'copy directory name'),
           ('e', 'empty', None, 'clear queue status file'),
-          ('f', 'force', None, 'force copy')],
+          ('f', 'force', None, 'force copy')] + commands.commitopts,
          'hg qsave [-m TEXT] [-l FILE] [-c] [-n NAME] [-e] [-f]'),
     "qselect": (select,
                 [('n', 'none', None, _('disable all guards')),
diff -r 55c4ba8473a5 -r 6a4a259037e1 mercurial/commands.py
--- a/mercurial/commands.py	Mon Nov 20 23:09:50 2006 +0100
+++ b/mercurial/commands.py	Mon Nov 20 23:37:21 2006 +0100
@@ -1276,9 +1276,10 @@ def import_(ui, repo, patch1, *patches,
             raise util.Abort(_('no diffs found'))

         try:
-            if opts['message']:
+            cmdline_message = logmessage(opts)
+            if cmdline_message:
                 # pickup the cmdline msg
-                message = opts['message']
+                message = cmdline_message
             elif message:
                 # pickup the patch msg
                 message = message.strip()
@@ -2335,6 +2336,11 @@ walkopts = [
     ('X', 'exclude', [], _('exclude names matching the given patterns')),
 ]

+commitopts = [
+    ('m', 'message', '', _('use <text> as commit message')),
+    ('l', 'logfile', '', _('set commit message to <file> content')),
+]
+
 table = {
     "^add":
         (add,
@@ -2369,12 +2375,10 @@ table = {
         (backout,
          [('', 'merge', None,
            _('merge with old dirstate parent after backout')),
-          ('m', 'message', '', _('use <text> as commit message')),
-          ('l', 'logfile', '', _('read commit message from <file>')),
           ('d', 'date', '', _('record datecode as commit date')),
           ('', 'parent', '', _('parent to choose when backing out merge')),
           ('u', 'user', '', _('record user as committer')),
-         ] + walkopts,
+         ] + walkopts + commitopts,
          _('hg backout [OPTION]... REV')),
     "branch": (branch, [], _('hg branch [NAME]')),
     "branches": (branches, [], _('hg branches')),
@@ -2408,11 +2412,9 @@ table = {
         (commit,
          [('A', 'addremove', None,
            _('mark new/missing files as added/removed before committing')),
-          ('m', 'message', '', _('use <text> as commit message')),
-          ('l', 'logfile', '', _('read the commit message from <file>')),
           ('d', 'date', '', _('record datecode as commit date')),
           ('u', 'user', '', _('record user as commiter')),
-         ] + walkopts,
+         ] + walkopts + commitopts,
          _('hg commit [OPTION]... [FILE]...')),
     "copy|cp":
         (copy,
@@ -2491,10 +2493,9 @@ table = {
          [('p', 'strip', 1,
            _('directory strip option for patch. This has the same\n'
              'meaning as the corresponding patch option')),
-          ('m', 'message', '', _('use <text> as commit message')),
           ('b', 'base', '', _('base path (DEPRECATED)')),
           ('f', 'force', None,
-           _('skip check for outstanding uncommitted changes'))],
+           _('skip check for outstanding uncommitted changes'))] + commitopts,
          _('hg import [-p NUM] [-m MESSAGE] [-f] PATCH...')),
     "incoming|in": (incoming,
          [('M', 'no-merges', None, _('do not show merges')),
@@ -2585,9 +2586,8 @@ table = {
          [('p', 'parent', [], _('parent')),
           ('d', 'date', '', _('date code')),
           ('u', 'user', '', _('user')),
-          ('F', 'files', '', _('file list')),
-          ('m', 'message', '', _('commit message')),
-          ('l', 'logfile', '', _('commit message file'))],
+          ('F', 'files', '', _('file list'))
+          ] + commitopts,
          _('hg debugrawcommit [OPTION]... [FILE]...')),
     "recover": (recover, [], _('hg recover')),
     "^remove|rm":


> P.S.: I sent a copy to mercurial-devel and added a Reply-To. Patches
> should go there in the future.
Ok. I'll remember that.

-mathieu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: consolid-commit-help.diff
Type: text/x-patch
Size: 6813 bytes
Desc: not available
Url : http://www.selenic.com/pipermail/mercurial-devel/attachments/20061120/9f1c87d4/consolid-commit-help-0001.bin


More information about the Mercurial-devel mailing list