Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 28999:790c076cd4a2 stable
graphmod: disable graph styling when HGPLAIN is set (issue5212)
Produce stable output for tools to rely on by hardcoding all edge styles to
"|". This ensures that any tool parsing the output of hg log -G still gets the
same behaviour as pre-3.8 releases.
author | Martijn Pieters <mjpieters@fb.com> |
---|---|
date | Wed, 20 Apr 2016 16:33:13 +0100 |
parents | 78759f78a44e |
children | f2aa1c3e7e77 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Apr 20 18:26:29 2016 +0100 +++ b/mercurial/cmdutil.py Wed Apr 20 16:33:13 2016 +0100 @@ -2234,20 +2234,26 @@ formatnode = _graphnodeformatter(ui, displayer) state = graphmod.asciistate() styles = state['styles'] - edgetypes = { - 'parent': graphmod.PARENT, - 'grandparent': graphmod.GRANDPARENT, - 'missing': graphmod.MISSINGPARENT - } - for name, key in edgetypes.items(): - # experimental config: experimental.graphstyle.* - styles[key] = ui.config('experimental', 'graphstyle.%s' % name, - styles[key]) - if not styles[key]: - styles[key] = None - - # experimental config: experimental.graphshorten - state['graphshorten'] = ui.configbool('experimental', 'graphshorten') + + # only set graph styling if HGPLAIN is not set. + if ui.plain('graph'): + # set all edge styles to |, the default pre-3.8 behaviour + styles.update(dict.fromkeys(styles, '|')) + else: + edgetypes = { + 'parent': graphmod.PARENT, + 'grandparent': graphmod.GRANDPARENT, + 'missing': graphmod.MISSINGPARENT + } + for name, key in edgetypes.items(): + # experimental config: experimental.graphstyle.* + styles[key] = ui.config('experimental', 'graphstyle.%s' % name, + styles[key]) + if not styles[key]: + styles[key] = None + + # experimental config: experimental.graphshorten + state['graphshorten'] = ui.configbool('experimental', 'graphshorten') for rev, type, ctx, parents in dag: char = formatnode(repo, ctx)