Mercurial > evolve
changeset 5067:e07f6af3cfec
obshistory: make a {flag value: description} dict for _markerseffects()
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 11 Jan 2020 20:06:26 +0700 |
parents | 8dc865544aa1 |
children | 715c85f250e0 |
files | hgext3rd/evolve/obshistory.py |
diffstat | 1 files changed, 13 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- 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