Patchwork D7401: patch: use field names instead of field numbers on scmutil.status

login
register
mail settings
Submitter phabricator
Date Nov. 14, 2019, 9:11 p.m.
Message ID <differential-rev-PHID-DREV-xjq5nhzbyvcigigsii6y-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43204/
State Superseded
Headers show

Comments

phabricator - Nov. 14, 2019, 9:11 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As part of my pytype adventures I want to make scmutil.status no longer a
  subclass of tuple. This is part of that process.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7401

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -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 []