revert: use a flat dispatch table
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 24 Jun 2014 17:44:31 +0100
changeset 22229 3a7b45a0bd20
parent 22228 a3dc2d385490
child 22230 316ba2ddc034
revert: use a flat dispatch table Now that the table is simpler, remove one level of depth from it. This simplifies its usage in the for loop.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Fri Aug 15 18:26:21 2014 -0700
+++ b/mercurial/cmdutil.py	Tue Jun 24 17:44:31 2014 +0100
@@ -2476,12 +2476,12 @@
             #   file state
             #   action
             #   make backup
-            (modified,         (actions['revert'],   False)),
-            (dsmodified,       (actions['revert'],   True)),
-            (dsadded,          (actions['remove'],   True)),
-            (removed,          (actions['add'],      True)),
-            (dsremoved,        (actions['undelete'], True)),
-            (clean,            (None,                False)),
+            (modified,   actions['revert'],   False),
+            (dsmodified, actions['revert'],   True),
+            (dsadded,    actions['remove'],   True),
+            (removed,    actions['add'],      True),
+            (dsremoved,  actions['undelete'], True),
+            (clean,      None,                False),
             )
 
         for abs, (rel, exact) in sorted(names.items()):
@@ -2490,7 +2490,7 @@
             # search the entry in the dispatch table.
             # if the file is in any of these sets, it was touched in the working
             # directory parent and we are sure it needs to be reverted.
-            for table, (xlist, dobackup) in disptable:
+            for table, xlist, dobackup in disptable:
                 if abs not in table:
                     continue
                 if xlist is None: