changeset 1728:9b92b71d5dd7

add -w and -p options to diff. this is for issue 126.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Wed, 15 Feb 2006 10:39:47 -0800
parents 681c5c211b92
children ace6d26f78f1
files doc/hg.1.txt mercurial/commands.py
diffstat 2 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hg.1.txt	Wed Feb 15 04:37:47 2006 +0100
+++ b/doc/hg.1.txt	Wed Feb 15 10:39:47 2006 -0800
@@ -223,9 +223,11 @@
     probably with undesirable results.
 
     options:
-    -a, --text           treat all files as text
-    -I, --include <pat>  include names matching the given patterns
-    -X, --exclude <pat>  exclude names matching the given patterns
+    -a, --text              treat all files as text
+    -I, --include <pat>     include names matching the given patterns
+    -p, --show-function     show which function each change is in
+    -X, --exclude <pat>     exclude names matching the given patterns
+    -w, --ignore-all-space  ignore white space when comparing lines
 
 export [-o filespec] [revision] ...::
     Print the changeset header and diffs for one or more revisions.
--- a/mercurial/commands.py	Wed Feb 15 04:37:47 2006 +0100
+++ b/mercurial/commands.py	Wed Feb 15 10:39:47 2006 -0800
@@ -261,7 +261,7 @@
                 mode)
 
 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always,
-           changes=None, text=False):
+           changes=None, text=False, opts={}):
     if not changes:
         changes = repo.changes(node1, node2, files, match=match)
     modified, added, removed, deleted, unknown = changes
@@ -296,8 +296,8 @@
     date1 = util.datestr(change[2])
 
     diffopts = ui.diffopts()
-    showfunc = diffopts['showfunc']
-    ignorews = diffopts['ignorews']
+    showfunc = opts.get('show_function') or diffopts['showfunc']
+    ignorews = opts.get('ignore_all_space') or diffopts['ignorews']
     for f in modified:
         to = None
         if f in mmap:
@@ -1140,7 +1140,7 @@
     fns, matchfn, anypats = matchpats(repo, pats, opts)
 
     dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn,
-           text=opts['text'])
+           text=opts['text'], opts=opts)
 
 def doexport(ui, repo, changeset, seqno, total, revwidth, opts):
     node = repo.lookup(changeset)
@@ -2337,7 +2337,12 @@
          [('r', 'rev', [], _('revision')),
           ('a', 'text', None, _('treat all files as text')),
           ('I', 'include', [], _('include names matching the given patterns')),
-          ('X', 'exclude', [], _('exclude names matching the given patterns'))],
+          ('p', 'show-function', None,
+           _('show which function each change is in')),
+          ('w', 'ignore-all-space', None,
+           _('ignore white space when comparing lines')),
+          ('X', 'exclude', [],
+           _('exclude names matching the given patterns'))],
          _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')),
     "^export":
         (export,