diff tests/test-remotefilelog-datapack.py @ 40556:10c10da14c5d

remotefilelog: bump pack file formats to version 2 Drop support for format 0 and 1 packs. Version 2 will be different in that it'll use zlib compression instead of lz4, as the latter isn't really suitable for core. If I can make it work, I'll make compression engines pluggable, but the logic for handling these files is spread out enough it's a little tricky to get that right. Test changes are only due to pack files being renamed. The contents of the packs are the same. Differential Revision: https://phab.mercurial-scm.org/D4943
author Augie Fackler <augie@google.com>
date Wed, 03 Oct 2018 23:25:31 -0400
parents 3a333a582d7b
children 2888d12b80a6
line wrap: on
line diff
--- a/tests/test-remotefilelog-datapack.py	Wed Oct 03 23:47:43 2018 -0400
+++ b/tests/test-remotefilelog-datapack.py	Wed Oct 03 23:25:31 2018 -0400
@@ -49,15 +49,14 @@
     def getFakeHash(self):
         return ''.join(chr(random.randint(0, 255)) for _ in range(20))
 
-    def createPack(self, revisions=None, packdir=None, version=0):
+    def createPack(self, revisions=None, packdir=None):
         if revisions is None:
             revisions = [("filename", self.getFakeHash(), nullid, "content")]
 
         if packdir is None:
             packdir = self.makeTempDir()
 
-        packer = datapack.mutabledatapack(
-            uimod.ui(), packdir, version=version)
+        packer = datapack.mutabledatapack(uimod.ui(), packdir, version=2)
 
         for args in revisions:
             filename, node, base, content = args[0:4]
@@ -175,7 +174,7 @@
                     'Z': 'random_string',
                     '_': '\0' * i}
             revisions.append((filename, node, nullid, content, meta))
-        pack = self.createPack(revisions, version=1)
+        pack = self.createPack(revisions)
         for name, node, x, content, origmeta in revisions:
             parsedmeta = pack.getmeta(name, node)
             # flag == 0 should be optimized out
@@ -183,18 +182,6 @@
                 del origmeta[constants.METAKEYFLAG]
             self.assertEquals(parsedmeta, origmeta)
 
-    def testPackMetadataThrows(self):
-        filename = '1'
-        content = '2'
-        node = self.getHash(content)
-        meta = {constants.METAKEYFLAG: 3}
-        revisions = [(filename, node, nullid, content, meta)]
-        try:
-            self.createPack(revisions, version=0)
-            self.assertTrue(False, "should throw if metadata is not supported")
-        except RuntimeError:
-            pass
-
     def testGetMissing(self):
         """Test the getmissing() api.
         """