comparison mercurial/logcmdutil.py @ 43796:faa8a59f4a06

graphlog: change state dict to attr struct This should help static analysis.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 21 Nov 2019 22:43:01 +0900
parents 064c9a4ced4a
children 29adf0a087a1
comparison
equal deleted inserted replaced
43795:b5f183eedd98 43796:faa8a59f4a06
1010 1010
1011 def displaygraph(ui, repo, dag, displayer, edgefn, getcopies=None, props=None): 1011 def displaygraph(ui, repo, dag, displayer, edgefn, getcopies=None, props=None):
1012 props = props or {} 1012 props = props or {}
1013 formatnode = _graphnodeformatter(ui, displayer) 1013 formatnode = _graphnodeformatter(ui, displayer)
1014 state = graphmod.asciistate() 1014 state = graphmod.asciistate()
1015 styles = state[b'styles'] 1015 styles = state.styles
1016 1016
1017 # only set graph styling if HGPLAIN is not set. 1017 # only set graph styling if HGPLAIN is not set.
1018 if ui.plain(b'graph'): 1018 if ui.plain(b'graph'):
1019 # set all edge styles to |, the default pre-3.8 behaviour 1019 # set all edge styles to |, the default pre-3.8 behaviour
1020 styles.update(dict.fromkeys(styles, b'|')) 1020 styles.update(dict.fromkeys(styles, b'|'))
1031 ) 1031 )
1032 if not styles[key]: 1032 if not styles[key]:
1033 styles[key] = None 1033 styles[key] = None
1034 1034
1035 # experimental config: experimental.graphshorten 1035 # experimental config: experimental.graphshorten
1036 state[b'graphshorten'] = ui.configbool(b'experimental', b'graphshorten') 1036 state.graphshorten = ui.configbool(b'experimental', b'graphshorten')
1037 1037
1038 for rev, type, ctx, parents in dag: 1038 for rev, type, ctx, parents in dag:
1039 char = formatnode(repo, ctx) 1039 char = formatnode(repo, ctx)
1040 copies = getcopies(ctx) if getcopies else None 1040 copies = getcopies(ctx) if getcopies else None
1041 edges = edgefn(type, char, state, rev, parents) 1041 edges = edgefn(type, char, state, rev, parents)