Patchwork [4,of,8,V2] patch.diffopts: allow a setting to be forced in plain mode

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 13, 2014, 11:08 p.m.
Message ID <6a40a01c1b5ce0a4edb9.1415920129@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6713/
State Accepted
Commit 922fcfb02e77c751f67563dcebe71b2a026d220d
Headers show

Comments

Siddharth Agarwal - Nov. 13, 2014, 11:08 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1415864845 28800
#      Wed Nov 12 23:47:25 2014 -0800
# Node ID 6a40a01c1b5ce0a4edb972ca42bfcb2e791e48fe
# Parent  1b945e3178b5781a10121adc9d2687be4b0e86cd
patch.diffopts: allow a setting to be forced in plain mode

Upcoming patches will add an option that will almost certainly break diff
output parsers when enabled. Add support for forcing an option to something in
plain mode, as a fallback. Options passed in via the CLI are not affected,
though -- it is assumed that any script passing the option in explicitly knows
what it is doing.

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1564,6 +1564,8 @@ 
             v = opts.get(key)
             if v:
                 return v
+        if forceplain is not None and ui.plain():
+            return forceplain
         return getter(section, name or key, None, untrusted=untrusted)
 
     return mdiff.diffopts(