py3: redefine "troublecategories" in evolve as a dict
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 17 Jul 2019 12:47:37 -0700
changeset 4762 75bc0a51809a
parent 4761 2c3fd1bb2752
child 4774 12a88b988875
child 4776 d93fef4b98df
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.
hgext3rd/evolve/evolvecmd.py
--- 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)