コード例 #1
0
    def testReadingMutablePack(self):
        """Tests that the data written into a mutabledatapack can be read out
        before it has been finalized."""
        packdir = self.makeTempDir()
        packer = revisionstore.mutabledeltastore(packfilepath=packdir)

        # Add some unused first revision for noise
        packer.add("qwert", self.getFakeHash(), nullid, b"qwertcontent")

        filename = "filename1"
        node = self.getFakeHash()
        base = nullid
        content = b"asdf"
        meta = {constants.METAKEYFLAG: 1, constants.METAKEYSIZE: len(content)}
        packer.add(filename, node, base, content, metadata=meta)

        # Add some unused third revision for noise
        packer.add("zxcv", self.getFakeHash(), nullid, b"zcxvcontent")

        # Test getmissing
        missing = ("", self.getFakeHash())
        value = packer.getmissing([missing, (filename, node)])
        self.assertEqual(value, [missing])

        # Test getmeta
        value = packer.getmeta(filename, node)
        self.assertEqual(value, meta)

        # Test getdelta
        value = packer.getdelta(filename, node)
        self.assertEqual(value, (content, filename, base, meta))

        # Test getdeltachain
        value = packer.getdeltachain(filename, node)
        self.assertEqual(value, [(filename, node, filename, base, content)])
コード例 #2
0
    def createPackStore(self, packdir, revisions=None):
        if revisions is None:
            revisions = [("filename", self.getFakeHash(), nullid, "content")]

        packer = revisionstore.mutabledeltastore(packfilepath=packdir)

        for filename, node, base, content in revisions:
            packer.add(filename, node, base, content)

        packer.flush()
        return datapackstore(packdir)
コード例 #3
0
    def createPack(self, revisions=None, packdir=None, version=0):
        if revisions is None:
            revisions = [("filename", self.getFakeHash(), nullid, b"content")]

        if packdir is None:
            packdir = self.makeTempDir()

        packer = revisionstore.mutabledeltastore(packfilepath=packdir)

        for args in revisions:
            filename, node, base, content = args[0:4]
            # meta is optional
            meta = None
            if len(args) > 4:
                meta = args[4]
            packer.add(filename, node, base, content, metadata=meta)

        path = packer.flush()
        return self.datapackreader(path)
コード例 #4
0
ファイル: mutablestores.py プロジェクト: simpkins/eden
 def makestore(repo, path):
     shallowutil.mkstickygroupdir(repo.ui, path)
     return revisionstore.mutabledeltastore(
         packfilepath=path, config=repo.ui._uiconfig._rcfg._rcfg)