Patchwork [7,of,8] ui: add diff.showfunc to progressive mode

login
register
mail settings
Submitter Mathias De Maré
Date March 28, 2015, 10:51 a.m.
Message ID <cf580680a070606cb8bf.1427539867@waste.org>
Download mbox | patch
Permalink /patch/8328/
State Changes Requested
Headers show

Comments

Mathias De Maré - March 28, 2015, 10:51 a.m.
# HG changeset patch
# User Mathias De Maré <mathias.demare@gmail.com>
# Date 1427230051 -3600
#      Tue Mar 24 21:47:31 2015 +0100
# Node ID cf580680a070606cb8bfed0fd1afffbfecdcbf7c
# Parent  c5c5e11ea7b6c669b22eee5c94f98e9c11dc01df
ui: add diff.showfunc to progressive mode
Matt Mackall - March 31, 2015, 11:50 a.m.
On Sat, 2015-03-28 at 05:51 -0500, Mathias De Maré wrote:
> # HG changeset patch
> # User Mathias De Maré <mathias.demare@gmail.com>
> # Date 1427230051 -3600
> #      Tue Mar 24 21:47:31 2015 +0100
> # Node ID cf580680a070606cb8bfed0fd1afffbfecdcbf7c
> # Parent  c5c5e11ea7b6c669b22eee5c94f98e9c11dc01df
> ui: add diff.showfunc to progressive mode

As far as I can tell, this seems to be pretty low on the zeitgeist wish
list, perhaps because it doesn't work particularly well with languages
with nested definitions (aka just about everything except C). 

Just about all of these are going to create pressure for --no-foo
options that we haven't needed yet, which will be a bit sad. Color's
already got one, but most of the rest don't.
Pierre-Yves David - March 31, 2015, 6:37 p.m.
On 03/31/2015 04:50 AM, Matt Mackall wrote:
> On Sat, 2015-03-28 at 05:51 -0500, Mathias De Maré wrote:
>> # HG changeset patch
>> # User Mathias De Maré <mathias.demare@gmail.com>
>> # Date 1427230051 -3600
>> #      Tue Mar 24 21:47:31 2015 +0100
>> # Node ID cf580680a070606cb8bfed0fd1afffbfecdcbf7c
>> # Parent  c5c5e11ea7b6c669b22eee5c94f98e9c11dc01df
>> ui: add diff.showfunc to progressive mode
>
> As far as I can tell, this seems to be pretty low on the zeitgeist wish
> list, perhaps because it doesn't work particularly well with languages
> with nested definitions (aka just about everything except C).

 From a reviewer perspective, I've been spending my life hadding 
"showfunc=true" into people config.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -482,6 +482,8 @@ 
 
         if not self.hasconfig('diff', 'git'):
             self.setconfig('diff', 'git', 'True')
+        if not self.hasconfig('diff', 'showfunc'):
+            self.setconfig('diff', 'showfunc', 'True')
         if not self.hasconfig('ui', 'statuscopies'):
             self.setconfig('ui', 'statuscopies', 'True')
         if not self.hasconfig('extensions', 'color'):
diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t
--- a/tests/test-diff-unified.t
+++ b/tests/test-diff-unified.t
@@ -332,5 +332,18 @@ 
   +    int e = 3;
   +    return a + b + c + e;
    }
+  $ hg diff --config ui.progressive=True --git
+  diff --git a/f1 b/f1
+  --- a/f1
+  +++ b/f1
+  @@ -2,6 +2,6 @@ int main() {
+       int a = 0;
+       int b = 1;
+       int c = 2;
+  -    int d = 3;
+  -    return a + b + c + d;
+  +    int e = 3;
+  +    return a + b + c + e;
+   }
 
   $ cd ..