Mercurial > public > mercurial-scm > hg
comparison mercurial/configitems.py @ 41558:901ebc81ffb3
config: extract diff-related coreconfigitem()s to a helper method
We already have 'annotate' and 'diff' that use the same set of options, and I
want to add more in a followup commit, so I'm attempting to reduce maintenance
burden and duplication by making it possible to register all of them at once.
Differential Revision: https://phab.mercurial-scm.org/D5832
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Thu, 31 Jan 2019 14:27:25 -0800 |
parents | b5642239fb32 |
children | 66399f2e92aa |
comparison
equal
deleted
inserted
replaced
41557:3a01ce246ece | 41558:901ebc81ffb3 |
---|---|
111 f.dynamicdefault = dynamicdefault | 111 f.dynamicdefault = dynamicdefault |
112 return f | 112 return f |
113 | 113 |
114 coreconfigitem = getitemregister(coreitems) | 114 coreconfigitem = getitemregister(coreitems) |
115 | 115 |
116 def _registerdiffopts(section, configprefix=''): | |
117 coreconfigitem(section, configprefix + 'nodates', | |
118 default=False, | |
119 ) | |
120 coreconfigitem(section, configprefix + 'showfunc', | |
121 default=False, | |
122 ) | |
123 coreconfigitem(section, configprefix + 'unified', | |
124 default=None, | |
125 ) | |
126 coreconfigitem(section, configprefix + 'git', | |
127 default=False, | |
128 ) | |
129 coreconfigitem(section, configprefix + 'ignorews', | |
130 default=False, | |
131 ) | |
132 coreconfigitem(section, configprefix + 'ignorewsamount', | |
133 default=False, | |
134 ) | |
135 coreconfigitem(section, configprefix + 'ignoreblanklines', | |
136 default=False, | |
137 ) | |
138 coreconfigitem(section, configprefix + 'ignorewseol', | |
139 default=False, | |
140 ) | |
141 coreconfigitem(section, configprefix + 'nobinary', | |
142 default=False, | |
143 ) | |
144 coreconfigitem(section, configprefix + 'noprefix', | |
145 default=False, | |
146 ) | |
147 coreconfigitem(section, configprefix + 'word-diff', | |
148 default=False, | |
149 ) | |
150 | |
116 coreconfigitem('alias', '.*', | 151 coreconfigitem('alias', '.*', |
117 default=dynamicdefault, | 152 default=dynamicdefault, |
118 generic=True, | 153 generic=True, |
119 ) | 154 ) |
120 coreconfigitem('annotate', 'nodates', | |
121 default=False, | |
122 ) | |
123 coreconfigitem('annotate', 'showfunc', | |
124 default=False, | |
125 ) | |
126 coreconfigitem('annotate', 'unified', | |
127 default=None, | |
128 ) | |
129 coreconfigitem('annotate', 'git', | |
130 default=False, | |
131 ) | |
132 coreconfigitem('annotate', 'ignorews', | |
133 default=False, | |
134 ) | |
135 coreconfigitem('annotate', 'ignorewsamount', | |
136 default=False, | |
137 ) | |
138 coreconfigitem('annotate', 'ignoreblanklines', | |
139 default=False, | |
140 ) | |
141 coreconfigitem('annotate', 'ignorewseol', | |
142 default=False, | |
143 ) | |
144 coreconfigitem('annotate', 'nobinary', | |
145 default=False, | |
146 ) | |
147 coreconfigitem('annotate', 'noprefix', | |
148 default=False, | |
149 ) | |
150 coreconfigitem('annotate', 'word-diff', | |
151 default=False, | |
152 ) | |
153 coreconfigitem('auth', 'cookiefile', | 155 coreconfigitem('auth', 'cookiefile', |
154 default=None, | 156 default=None, |
155 ) | 157 ) |
158 _registerdiffopts(section='annotate') | |
156 # bookmarks.pushing: internal hack for discovery | 159 # bookmarks.pushing: internal hack for discovery |
157 coreconfigitem('bookmarks', 'pushing', | 160 coreconfigitem('bookmarks', 'pushing', |
158 default=list, | 161 default=list, |
159 ) | 162 ) |
160 # bundle.mainreporoot: internal hack for bundlerepo | 163 # bundle.mainreporoot: internal hack for bundlerepo |
402 default=False, | 405 default=False, |
403 ) | 406 ) |
404 coreconfigitem('devel', 'debug.peer-request', | 407 coreconfigitem('devel', 'debug.peer-request', |
405 default=False, | 408 default=False, |
406 ) | 409 ) |
407 coreconfigitem('diff', 'nodates', | 410 _registerdiffopts(section='diff') |
408 default=False, | |
409 ) | |
410 coreconfigitem('diff', 'showfunc', | |
411 default=False, | |
412 ) | |
413 coreconfigitem('diff', 'unified', | |
414 default=None, | |
415 ) | |
416 coreconfigitem('diff', 'git', | |
417 default=False, | |
418 ) | |
419 coreconfigitem('diff', 'ignorews', | |
420 default=False, | |
421 ) | |
422 coreconfigitem('diff', 'ignorewsamount', | |
423 default=False, | |
424 ) | |
425 coreconfigitem('diff', 'ignoreblanklines', | |
426 default=False, | |
427 ) | |
428 coreconfigitem('diff', 'ignorewseol', | |
429 default=False, | |
430 ) | |
431 coreconfigitem('diff', 'nobinary', | |
432 default=False, | |
433 ) | |
434 coreconfigitem('diff', 'noprefix', | |
435 default=False, | |
436 ) | |
437 coreconfigitem('diff', 'word-diff', | |
438 default=False, | |
439 ) | |
440 coreconfigitem('email', 'bcc', | 411 coreconfigitem('email', 'bcc', |
441 default=None, | 412 default=None, |
442 ) | 413 ) |
443 coreconfigitem('email', 'cc', | 414 coreconfigitem('email', 'cc', |
444 default=None, | 415 default=None, |