Patchwork D1775: dagutil: use named attributes on revlog index entries

login
register
mail settings
Submitter phabricator
Date Dec. 27, 2017, 12:36 a.m.
Message ID <differential-rev-PHID-DREV-lthc2uy7v75yhz2foco6-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26459/
State New
Headers show

Comments

phabricator - Dec. 27, 2017, 12:36 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Continuing the transition away from tuples.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/dagutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dagutil.py b/mercurial/dagutil.py
--- a/mercurial/dagutil.py
+++ b/mercurial/dagutil.py
@@ -131,10 +131,10 @@ 
         return self._heads
 
     def _externalize(self, ix):
-        return self._revlog.index[ix][7]
+        return self._revlog.index[ix].node
     def _externalizeall(self, ixs):
         idx = self._revlog.index
-        return [idx[i][7] for i in ixs]
+        return [idx[i].node for i in ixs]
 
     def _internalize(self, id):
         ix = self._revlog.rev(id)
@@ -165,13 +165,13 @@ 
         rlog = self._revlog
         idx = rlog.index
         revdata = idx[ix]
-        prev = revdata[5]
+        prev = revdata.p1rev
         if prev != nullrev:
-            prev2 = revdata[6]
+            prev2 = revdata.p2rev
             if prev2 == nullrev:
                 return [prev]
             return [prev, prev2]
-        prev2 = revdata[6]
+        prev2 = revdata.p2rev
         if prev2 != nullrev:
             return [prev2]
         return []
@@ -195,10 +195,11 @@ 
             if rev not in seen and rev not in stops:
                 seen.add(rev)
                 revdata = idx[rev]
-                for i in [5, 6]:
-                    prev = revdata[i]
+
+                for prev in (revdata.p1rev, revdata.p2rev):
                     if prev != nullrev:
                         pending.append(prev)
+
         return seen
 
     def headsetofconnecteds(self, ixs):
@@ -209,8 +210,7 @@ 
         headrevs = set(ixs)
         for rev in ixs:
             revdata = idx[rev]
-            for i in [5, 6]:
-                prev = revdata[i]
+            for prev in (revdata.p1rev, revdata.p2rev):
                 if prev != nullrev:
                     headrevs.discard(prev)
         assert headrevs
@@ -263,7 +263,7 @@ 
         while rev >= walkto:
             data = idx[rev]
             isroot = True
-            for prev in [data[5], data[6]]: # parent revs
+            for prev in [data.p1rev, data.p2rev]: # parent revs
                 if prev != nullrev:
                     cs.setdefault(prev, []).append(rev)
                     isroot = False