Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 35387:9144e898cad5
debugformat: embed raw values in JSON and template output
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 10 Dec 2017 19:41:49 +0900 |
parents | c0b6fa74e007 |
children | a43b2dd95e4f |
comparison
equal
deleted
inserted
replaced
35386:c0b6fa74e007 | 35387:9144e898cad5 |
---|---|
871 maxvariantlength = max(len('format-variant'), maxvariantlength) | 871 maxvariantlength = max(len('format-variant'), maxvariantlength) |
872 | 872 |
873 def makeformatname(name): | 873 def makeformatname(name): |
874 return '%s:' + (' ' * (maxvariantlength - len(name))) | 874 return '%s:' + (' ' * (maxvariantlength - len(name))) |
875 | 875 |
876 def formatvalue(value): | |
877 if util.safehasattr(value, 'startswith'): | |
878 return value | |
879 if value: | |
880 return 'yes' | |
881 else: | |
882 return 'no' | |
883 | |
884 fm = ui.formatter('debugformat', opts) | 876 fm = ui.formatter('debugformat', opts) |
877 if fm.isplain(): | |
878 def formatvalue(value): | |
879 if util.safehasattr(value, 'startswith'): | |
880 return value | |
881 if value: | |
882 return 'yes' | |
883 else: | |
884 return 'no' | |
885 else: | |
886 formatvalue = pycompat.identity | |
887 | |
885 fm.plain('format-variant') | 888 fm.plain('format-variant') |
886 fm.plain(' ' * (maxvariantlength - len('format-variant'))) | 889 fm.plain(' ' * (maxvariantlength - len('format-variant'))) |
887 fm.plain(' repo') | 890 fm.plain(' repo') |
888 if ui.verbose: | 891 if ui.verbose: |
889 fm.plain(' config default') | 892 fm.plain(' config default') |