##// END OF EJS Templates
config: add an experimental option to list all known config...
marmoute -
r48208:b1b31272 default
parent child Browse files
Show More
@@ -2200,6 +2200,21 def _docommit(ui, repo, *pats, **opts):
2200 2200 b'config|showconfig|debugconfig',
2201 2201 [
2202 2202 (b'u', b'untrusted', None, _(b'show untrusted configuration options')),
2203 # This is experimental because we need
2204 # * reasonable behavior around aliases,
2205 # * decide if we display [debug] [experimental] and [devel] section par
2206 # default
2207 # * some way to display "generic" config entry (the one matching
2208 # regexp,
2209 # * proper display of the different value type
2210 # * a better way to handle <DYNAMIC> values (and variable types),
2211 # * maybe some type information ?
2212 (
2213 b'',
2214 b'exp-all-known',
2215 None,
2216 _(b'show all known config option (EXPERIMENTAL)'),
2217 ),
2203 2218 (b'e', b'edit', None, _(b'edit user config')),
2204 2219 (b'l', b'local', None, _(b'edit repository config')),
2205 2220 (b'', b'source', None, _(b'show source of configuration value')),
@@ -2336,8 +2351,10 def config(ui, repo, *values, **opts):
2336 2351 selentries = set(selentries)
2337 2352
2338 2353 matched = False
2354 all_known = opts[b'exp_all_known']
2339 2355 show_source = ui.debugflag or opts.get(b'source')
2340 for section, name, value in ui.walkconfig(untrusted=untrusted):
2356 entries = ui.walkconfig(untrusted=untrusted, all_known=all_known)
2357 for section, name, value in entries:
2341 2358 source = ui.configsource(section, name, untrusted)
2342 2359 value = pycompat.bytestr(value)
2343 2360 defaultvalue = ui.configdefault(section, name)
@@ -948,7 +948,48 class ui(object):
948 948 )
949 949 return items
950 950
951 def walkconfig(self, untrusted=False):
951 def walkconfig(self, untrusted=False, all_known=False):
952 defined = self._walk_config(untrusted)
953 if not all_known:
954 for d in defined:
955 yield d
956 return
957 known = self._walk_known()
958 current_defined = next(defined, None)
959 current_known = next(known, None)
960 while current_defined is not None or current_known is not None:
961 if current_defined is None:
962 yield current_known
963 current_known = next(known, None)
964 elif current_known is None:
965 yield current_defined
966 current_defined = next(defined, None)
967 elif current_known[0:2] == current_defined[0:2]:
968 yield current_defined
969 current_defined = next(defined, None)
970 current_known = next(known, None)
971 elif current_known[0:2] < current_defined[0:2]:
972 yield current_known
973 current_known = next(known, None)
974 else:
975 yield current_defined
976 current_defined = next(defined, None)
977
978 def _walk_known(self):
979 for section, items in sorted(self._knownconfig.items()):
980 for k, i in sorted(items.items()):
981 # We don't have a way to display generic well, so skip them
982 if i.generic:
983 continue
984 if callable(i.default):
985 default = i.default()
986 elif i.default is configitems.dynamicdefault:
987 default = b'<DYNAMIC>'
988 else:
989 default = i.default
990 yield section, i.name, default
991
992 def _walk_config(self, untrusted):
952 993 cfg = self._data(untrusted)
953 994 for section in cfg.sections():
954 995 for name, value in self.configitems(section, untrusted):
@@ -262,7 +262,7 Show all commands + options
262 262 cat: output, rev, decode, include, exclude, template
263 263 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
264 264 commit: addremove, close-branch, amend, secret, edit, force-close-branch, interactive, include, exclude, message, logfile, date, user, subrepos
265 config: untrusted, edit, local, source, shared, non-shared, global, template
265 config: untrusted, exp-all-known, edit, local, source, shared, non-shared, global, template
266 266 continue: dry-run
267 267 copy: forget, after, at-rev, force, include, exclude, dry-run
268 268 debugancestor:
@@ -408,6 +408,32 configs should be read in lexicographica
408 408 $ HGRCPATH=configs hg config section.key
409 409 99
410 410
411 Listing all config options
412 ==========================
413
414 The feature is experimental and behavior may varies. This test exists to make sure the code is run. We grep it to avoid too much variability in its current experimental state.
415
416 $ hg config --exp-all-known | grep commit
417 commands.commit.interactive.git=False
418 commands.commit.interactive.ignoreblanklines=False
419 commands.commit.interactive.ignorews=False
420 commands.commit.interactive.ignorewsamount=False
421 commands.commit.interactive.ignorewseol=False
422 commands.commit.interactive.nobinary=False
423 commands.commit.interactive.nodates=False
424 commands.commit.interactive.noprefix=False
425 commands.commit.interactive.showfunc=False
426 commands.commit.interactive.unified=None
427 commands.commit.interactive.word-diff=False
428 commands.commit.post-status=False
429 convert.git.committeractions=[*'messagedifferent'] (glob)
430 convert.svn.dangerous-set-commit-dates=False
431 experimental.copytrace.sourcecommitlimit=100
432 phases.new-commit=draft
433 ui.allowemptycommit=False
434 ui.commitsubrepos=False
435
436
411 437 Configuration priority
412 438 ======================
413 439
General Comments 0
You need to be logged in to leave comments. Login now