comparison mercurial/debugcommands.py @ 35338:bd326f3e0e14

debugformat: update label depending on value difference The new label highlight areas where the repo format differs from current config or default. This should help people spot area where a repository mismatch with the expected state.
author Boris Feld <boris.feld@octobus.net>
date Thu, 07 Dec 2017 16:12:32 +0100
parents cfb403b92f43
children 740d40ec15c3
comparison
equal deleted inserted replaced
35337:cfb403b92f43 35338:bd326f3e0e14
889 fm.startitem() 889 fm.startitem()
890 for fv in upgrade.allformatvariant: 890 for fv in upgrade.allformatvariant:
891 repovalue = fv.fromrepo(repo) 891 repovalue = fv.fromrepo(repo)
892 configvalue = fv.fromconfig(repo) 892 configvalue = fv.fromconfig(repo)
893 893
894 if repovalue != configvalue:
895 namelabel = 'formatvariant.name.mismatchconfig'
896 repolabel = 'formatvariant.repo.mismatchconfig'
897 elif repovalue != fv.default:
898 namelabel = 'formatvariant.name.mismatchdefault'
899 repolabel = 'formatvariant.repo.mismatchdefault'
900 else:
901 namelabel = 'formatvariant.name.uptodate'
902 repolabel = 'formatvariant.repo.uptodate'
903
894 fm.write('name', makeformatname(fv.name), fv.name, 904 fm.write('name', makeformatname(fv.name), fv.name,
895 label='formatvariant.name') 905 label=namelabel)
896 fm.write('repo', ' %3s', formatvalue(repovalue), 906 fm.write('repo', ' %3s', formatvalue(repovalue),
897 label='formatvariant.repo') 907 label=repolabel)
908 if fv.default != configvalue:
909 configlabel = 'formatvariant.config.special'
910 else:
911 configlabel = 'formatvariant.config.default'
898 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue), 912 fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
899 label='formatvariant.config') 913 label=configlabel)
900 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default), 914 fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
901 label='formatvariant.default') 915 label='formatvariant.default')
902 fm.plain('\n') 916 fm.plain('\n')
903 917
904 @command('debugfsinfo', [], _('[PATH]'), norepo=True) 918 @command('debugfsinfo', [], _('[PATH]'), norepo=True)