patch: use field names instead of field numbers on scmutil.status
authorAugie Fackler <augie@google.com>
Thu, 14 Nov 2019 15:27:58 -0500
changeset 43649 d649de29f1ff
parent 43648 4093fc1777c2
child 43650 d212d657ba0e
patch: 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/D7401
mercurial/patch.py
--- a/mercurial/patch.py	Thu Nov 14 15:27:50 2019 -0500
+++ b/mercurial/patch.py	Thu Nov 14 15:27:58 2019 -0500
@@ -2605,7 +2605,14 @@
 
     if not changes:
         changes = ctx1.status(ctx2, match=match)
-    modified, added, removed = changes[:3]
+    if isinstance(changes, list):
+        modified, added, removed = changes[:3]
+    else:
+        modified, added, removed = (
+            changes.modified,
+            changes.added,
+            changes.removed,
+        )
 
     if not modified and not added and not removed:
         return []