changeset 4762:75bc0a51809a

py3: redefine "troublecategories" in evolve as a dict We'll want to the keys to be bytes and the values to be unicode on py3. Having it defined as a dict makes that easier (instead of converting between the types with e.g. pycompat.sysbytes()). It was kind of ugly to convert between the forms by stripping '_' from the string anyway.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 17 Jul 2019 12:47:37 -0700
parents 2c3fd1bb2752
children 12a88b988875 d93fef4b98df
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Fri Jul 12 08:11:39 2019 -0700
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Jul 17 12:47:37 2019 -0700
@@ -1622,10 +1622,12 @@
     abortopt = opts['abort']
     shouldupdate = opts['update']
 
-    troublecategories = ['phase_divergent', 'content_divergent', 'orphan']
-    specifiedcategories = [t.replace('_', '')
-                           for t in troublecategories
-                           if opts[t]]
+    troublecategories = {
+        'phasedivergent': 'phase_divergent',
+        'contentdivergent': 'content_divergent',
+        'orphan': 'orphan',
+    }
+    specifiedcategories = [k for k, v in troublecategories.items() if opts[v]]
     if opts['list']:
         ui.pager('evolve')
         listtroubles(ui, repo, specifiedcategories, **opts)