comparison mercurial/debugcommands.py @ 35346:cfb403b92f43

debugformat: add data about the config when verbose In verbose mode, the command also displays the current configuration choice for the variant and the global Mercurial default for it.
author Boris Feld <boris.feld@octobus.net>
date Thu, 07 Dec 2017 16:05:20 +0100
parents c3e4f196b6e0
children bd326f3e0e14
comparison
equal deleted inserted replaced
35345:c3e4f196b6e0 35346:cfb403b92f43
861 861
862 @command('debugformat', 862 @command('debugformat',
863 [] + cmdutil.formatteropts, 863 [] + cmdutil.formatteropts,
864 _('')) 864 _(''))
865 def debugformat(ui, repo, **opts): 865 def debugformat(ui, repo, **opts):
866 """display format information about the current repository""" 866 """display format information about the current repository
867
868 Use --verbose to get extra information about current config value and
869 Mercurial default."""
867 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant) 870 maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
868 maxvariantlength = max(len('format-variant'), maxvariantlength) 871 maxvariantlength = max(len('format-variant'), maxvariantlength)
869 872
870 def makeformatname(name): 873 def makeformatname(name):
871 return '%s:' + (' ' * (maxvariantlength - len(name))) 874 return '%s:' + (' ' * (maxvariantlength - len(name)))
878 881
879 fm = ui.formatter('debugformat', opts) 882 fm = ui.formatter('debugformat', opts)
880 fm.plain('format-variant') 883 fm.plain('format-variant')
881 fm.plain(' ' * (maxvariantlength - len('format-variant'))) 884 fm.plain(' ' * (maxvariantlength - len('format-variant')))
882 fm.plain(' repo') 885 fm.plain(' repo')
886 if ui.verbose:
887 fm.plain(' config default')
883 fm.plain('\n') 888 fm.plain('\n')
884 fm.startitem() 889 fm.startitem()
885 for fv in upgrade.allformatvariant: 890 for fv in upgrade.allformatvariant:
886 repovalue = fv.fromrepo(repo) 891 repovalue = fv.fromrepo(repo)
892 configvalue = fv.fromconfig(repo)
887 893
888 fm.write('name', makeformatname(fv.name), fv.name, 894 fm.write('name', makeformatname(fv.name), fv.name,
889 label='formatvariant.name') 895 label='formatvariant.name')
890 fm.write('repo', ' %3s', formatvalue(repovalue), 896 fm.write('repo', ' %3s', formatvalue(repovalue),
891 label='formatvariant.repo') 897 label='formatvariant.repo')
898 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
899 label='formatvariant.config')
900 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
901 label='formatvariant.default')
892 fm.plain('\n') 902 fm.plain('\n')
893 903
894 @command('debugfsinfo', [], _('[PATH]'), norepo=True) 904 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
895 def debugfsinfo(ui, path="."): 905 def debugfsinfo(ui, path="."):
896 """show information detected about current filesystem""" 906 """show information detected about current filesystem"""