changeset 43650:d212d657ba0e

revset: 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/D7402
author Augie Fackler <augie@google.com>
date Thu, 14 Nov 2019 15:28:08 -0500
parents d649de29f1ff
children aeed2f106213
files mercurial/revset.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Nov 14 15:27:58 2019 -0500
+++ b/mercurial/revset.py	Thu Nov 14 15:28:08 2019 -0500
@@ -673,6 +673,7 @@
     1: added
     2: removed
     """
+    label = {0: 'modified', 1: 'added', 2: 'removed'}[field]
     hasset = matchmod.patkind(pat) == b'set'
 
     mcache = [None]
@@ -691,7 +692,7 @@
         else:
             if not any(m(f) for f in c.files()):
                 return False
-        files = repo.status(c.p1().node(), c.node())[field]
+        files = getattr(repo.status(c.p1().node(), c.node()), label)
         if fname is not None:
             if fname in files:
                 return True