comparison mercurial/patch.py @ 23430:3821be85fd4d

patch: add a new function to initialize diffopts by feature Not all callers are interested in all diffopts -- for example, commands like record (which use diff internally) break when diffopts like noprefix are enabled. This function will allow us to add flags that callers can use to enable only the features they're interested in.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 18 Nov 2014 16:53:22 -0800
parents f35526b999f4
children 10223d2278f4
comparison
equal deleted inserted replaced
23429:f35526b999f4 23430:3821be85fd4d
1557 1557
1558 class GitDiffRequired(Exception): 1558 class GitDiffRequired(Exception):
1559 pass 1559 pass
1560 1560
1561 def diffopts(ui, opts=None, untrusted=False, section='diff'): 1561 def diffopts(ui, opts=None, untrusted=False, section='diff'):
1562 '''return diffopts with all features supported and parsed'''
1563 return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section)
1564
1565 def difffeatureopts(ui, opts=None, untrusted=False, section='diff'):
1566 '''return diffopts with only opted-in features parsed'''
1562 def get(key, name=None, getter=ui.configbool, forceplain=None): 1567 def get(key, name=None, getter=ui.configbool, forceplain=None):
1563 if opts: 1568 if opts:
1564 v = opts.get(key) 1569 v = opts.get(key)
1565 if v: 1570 if v:
1566 return v 1571 return v