filelog: stop proxying deltaparent() (API)
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 24 Sep 2018 13:35:50 -0700
changeset 39881 a269fa55467e
parent 39880 d909c44d29e1
child 39882 f8eb71f9e3bd
filelog: stop proxying deltaparent() (API) deltaparent() obtains the revision number of the base revision a delta in storage is stored against. It is highly revlog-centric and may not apply to other storage backends. As a result, it doesn't belong on the generic file storage interface. This method/proxy is no longer used in core. The last consumer was probably changegroup code and went away with the transition to emitrevisions(). Differential Revision: https://phab.mercurial-scm.org/D4751
mercurial/filelog.py
mercurial/repository.py
mercurial/testing/storage.py
tests/simplestorerepo.py
--- a/mercurial/filelog.py	Mon Sep 24 12:49:17 2018 -0700
+++ b/mercurial/filelog.py	Mon Sep 24 13:35:50 2018 -0700
@@ -67,9 +67,6 @@
     def children(self, node):
         return self._revlog.children(node)
 
-    def deltaparent(self, rev):
-        return self._revlog.deltaparent(rev)
-
     def iscensored(self, rev):
         return self._revlog.iscensored(rev)
 
--- a/mercurial/repository.py	Mon Sep 24 12:49:17 2018 -0700
+++ b/mercurial/repository.py	Mon Sep 24 13:35:50 2018 -0700
@@ -533,9 +533,6 @@
         Returns a list of nodes.
         """
 
-    def deltaparent(rev):
-        """"Return the revision that is a suitable parent to delta against."""
-
 class ifiledata(interfaceutil.Interface):
     """Storage interface for data storage of a specific file.
 
--- a/mercurial/testing/storage.py	Mon Sep 24 12:49:17 2018 -0700
+++ b/mercurial/testing/storage.py	Mon Sep 24 13:35:50 2018 -0700
@@ -122,15 +122,6 @@
         with self.assertRaises(error.LookupError):
             f.children(b'\x01' * 20)
 
-        self.assertEqual(f.deltaparent(nullrev), nullrev)
-
-        for i in range(-5, 5):
-            if i == nullrev:
-                continue
-
-            with self.assertRaises(IndexError):
-                f.deltaparent(i)
-
     def testsinglerevision(self):
         f = self._makefilefn()
         with self._maketransactionfn() as tr:
@@ -200,8 +191,6 @@
 
         self.assertEqual(f.children(node), [])
 
-        self.assertEqual(f.deltaparent(0), nullrev)
-
     def testmultiplerevisions(self):
         fulltext0 = b'x' * 1024
         fulltext1 = fulltext0 + b'y'
@@ -313,10 +302,6 @@
         self.assertEqual(f.children(node1), [node2])
         self.assertEqual(f.children(node2), [])
 
-        self.assertEqual(f.deltaparent(0), nullrev)
-        self.assertEqual(f.deltaparent(1), 0)
-        self.assertEqual(f.deltaparent(2), 1)
-
     def testmultipleheads(self):
         f = self._makefilefn()
 
--- a/tests/simplestorerepo.py	Mon Sep 24 12:49:17 2018 -0700
+++ b/tests/simplestorerepo.py	Mon Sep 24 13:35:50 2018 -0700
@@ -233,12 +233,6 @@
 
         return self._indexbyrev[rev][b'flags']
 
-    def deltaparent(self, rev):
-        validaterev(rev)
-
-        p1node = self.parents(self.node(rev))[0]
-        return self.rev(p1node)
-
     def _candelta(self, baserev, rev):
         validaterev(baserev)
         validaterev(rev)