Bug 1076 - [diff] unified option cannot be set to values other than 0 or 1
Summary: [diff] unified option cannot be set to values other than 0 or 1
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-04 00:12 UTC by L. David Baron
Modified: 2012-05-13 05:03 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description L. David Baron 2008-04-04 00:12 UTC
I'd like to set the default context for diff to something greater than 3, such
that it applies to all commands involving diffs (e.g., export, qrefresh).  At
first glance at the source, it would look like I could do this by adding the
following to my ~/.hgrc :

[diff]
unified = 8

however, this produces the error message:

$ hg export tip
abort: Error in configuration section [diff] parameter 'unified':
Not a boolean: 8

I can, in fact, set it to 0 or 1 to get 0 or 1 lines of context, but I can't set
it to any other value.  This is probably related to the nested get function in
patch.diffopts calling ui.configbool for all the options.
Comment 1 Dirkjan Ochtman 2008-04-04 02:33 UTC
I think you can do this by adding -U8 to your ~/.hgrc's [default] section.

See also issue654.
Comment 2 Dirkjan Ochtman 2008-04-04 03:12 UTC
Okay, so I spoke too soon. While my workaround below might work, this should be
fixed (and get some testcases). I'm currently discussing a fix in IRC with pmezard.
Comment 3 Adrian Buehlmann 2008-04-04 03:26 UTC
I've add this to TipsAndTricks on the wiki
Comment 4 Dirkjan Ochtman 2008-04-04 03:34 UTC
Revert to chatting. Tips & tricks don't actually fix the problem...
Comment 5 Adrian Buehlmann 2008-04-04 05:39 UTC
djc: Yes. It wasn't my intent to mark this as resolved. I could swear I haven't
touched the status field.... Whatever. I totally agree that
my addition to TipsAndTricks does not resolve this issue here. That's why I
specifically wrote on TipsAndTricks that -U8 *only* affects hg diff:
http://www.selenic.com/mercurial/wiki/index.cgi/TipsAndTricks?action=diff&rev2=121&rev1=120
Comment 6 Patrick Mézard 2008-04-04 05:50 UTC
There are 2 problems here:
- cmdtable default value for --unified always override diff.unified
- diff.unified is not correctly parsed
- there are no tests for this

I will take a look at it later today
Comment 7 Patrick Mézard 2008-04-04 14:20 UTC
Fixed in crew-stable and crew by 65029a3aafc2. Thanks !
Comment 8 Dirkjan Ochtman 2008-04-13 06:01 UTC
In main, resolving.
Comment 9 Bugzilla 2012-05-12 08:49 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 08:49 EDT  ---

This bug was previously known as _bug_ 1076 at http://mercurial.selenic.com/bts/issue1076