changeset 99:2dfb2c4c6612

Enable whitespace options
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Thu, 16 Jan 2014 15:19:42 -0500
parents 55cf805769eb
children 8f8467e38202
files crecord/__init__.py crecord/crecord_core.py
diffstat 2 files changed, 12 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/crecord/__init__.py
+++ b/crecord/__init__.py
@@ -9,10 +9,17 @@
 
 '''text-gui based change selection during commit or qrefresh'''
 from mercurial.i18n import _
-from mercurial import commands, extensions, util
+from mercurial import commands, extensions, cmdutil, util
+
+cmdtable = {}
+command = cmdutil.command(cmdtable)
 
 from crecord_core import dorecord
 
+@command("crecord",
+         # same options as commit + white space diff options
+         commands.table['^commit|ci'][1][:] + commands.diffwsopts,
+          _('hg crecord [OPTION]... [FILE]...'))
 def crecord(ui, repo, *pats, **opts):
     '''interactively select changes to commit
 
@@ -94,18 +101,6 @@
 
     dorecord(ui, repo, refreshmq, *pats, **opts)
 
-
-cmdtable = {
-    "crecord":
-        (crecord,
-
-         # add commit options
-         commands.table['^commit|ci'][1],
-
-         _('hg crecord [OPTION]... [FILE]...')),
-}
-
-
 def extsetup():
     try:
         keyword = extensions.find('keyword')
--- a/crecord/crecord_core.py
+++ b/crecord/crecord_core.py
@@ -47,7 +47,10 @@
                                '(use hg commit instead)'))
 
         changes = repo.status(match=match)[:3]
-        diffopts = mdiff.diffopts(git=True, nodates=True)
+        diffopts = opts.copy()
+        diffopts['nodates'] = True
+        diffopts['git'] = True
+        diffopts = patch.diffopts(ui, opts=diffopts)
         chunks = patch.diff(repo, changes=changes, opts=diffopts)
         fp = cStringIO.StringIO()
         fp.write(''.join(chunks))