# HG changeset patch # User Anton Shestakov # Date 1578747986 -25200 # Node ID e07f6af3cfec57cff295e90d6e68863a43c87b7a # Parent 8dc865544aa14d53143ed843f4cd0aed73b19495 obshistory: make a {flag value: description} dict for _markerseffects() diff -r 8dc865544aa1 -r e07f6af3cfec hgext3rd/evolve/obshistory.py --- a/hgext3rd/evolve/obshistory.py Sat Jan 11 19:49:45 2020 +0700 +++ b/hgext3rd/evolve/obshistory.py Sat Jan 11 20:06:26 2020 +0700 @@ -786,6 +786,16 @@ return {b'users': sorted(users)} +EFFECTMAPPING = util.sortdict([ + (DESCCHANGED, b'description'), + (METACHANGED, b'meta'), + (USERCHANGED, b'user'), + (DATECHANGED, b'date'), + (BRANCHCHANGED, b'branch'), + (PARENTCHANGED, b'parent'), + (DIFFCHANGED, b'content'), +]) + def _markerseffects(markers): """ Return a list of effects as strings based on effect flags in markers @@ -802,21 +812,9 @@ combined |= int(ef) if combined: - # XXX should be a dict - if combined & DESCCHANGED: - effects.append(b'description') - if combined & METACHANGED: - effects.append(b'meta') - if combined & USERCHANGED: - effects.append(b'user') - if combined & DATECHANGED: - effects.append(b'date') - if combined & BRANCHCHANGED: - effects.append(b'branch') - if combined & PARENTCHANGED: - effects.append(b'parent') - if combined & DIFFCHANGED: - effects.append(b'content') + for key, value in EFFECTMAPPING.items(): + if combined & key: + effects.append(value) return effects