extdiff: use field names instead of field numbers on scmutil.status
authorAugie Fackler <augie@google.com>
Thu, 14 Nov 2019 15:24:22 -0500
changeset 43638 7415cd486696
parent 43637 7edc07fb890c
child 43639 52a73fb498a4
extdiff: use field names instead of field numbers on scmutil.status As part of my pytype adventures I want to make scmutil.status no longer a subclass of tuple. This is part of that process. Differential Revision: https://phab.mercurial-scm.org/D7390
hgext/extdiff.py
--- a/hgext/extdiff.py	Wed Nov 13 20:32:24 2019 -0500
+++ b/hgext/extdiff.py	Thu Nov 14 15:24:22 2019 -0500
@@ -401,13 +401,14 @@
         if node2 is None:
             raise error.Abort(_(b'--patch requires two revisions'))
     else:
-        mod_a, add_a, rem_a = map(
-            set, repo.status(node1a, node2, matcher, listsubrepos=subrepos)[:3]
-        )
+        st = repo.status(node1a, node2, matcher, listsubrepos=subrepos)
+        mod_a, add_a, rem_a = set(st.modified), set(st.added), set(st.removed)
         if do3way:
-            mod_b, add_b, rem_b = map(
-                set,
-                repo.status(node1b, node2, matcher, listsubrepos=subrepos)[:3],
+            stb = repo.status(node1b, node2, matcher, listsubrepos=subrepos)
+            mod_b, add_b, rem_b = (
+                set(stb.modified),
+                set(stb.added),
+                set(stb.removed),
             )
         else:
             mod_b, add_b, rem_b = set(), set(), set()