当前位置: 首页>>代码示例>>Python>>正文


Python pack.PackStreamCopier类代码示例

本文整理汇总了Python中dulwich.pack.PackStreamCopier的典型用法代码示例。如果您正苦于以下问题:Python PackStreamCopier类的具体用法?Python PackStreamCopier怎么用?Python PackStreamCopier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PackStreamCopier类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_thin_pack

    def add_thin_pack(self, read_all, read_some):
        """Add a new thin pack to this object store.

        Thin packs are packs that contain deltas with parents that exist outside
        the pack. They should never be placed in the object store directly, and
        always indexed and completed as they are copied.

        :param read_all: Read function that blocks until the number of requested
            bytes are read.
        :param read_some: Read function that returns at least one byte, but may
            not return the number of bytes requested.
        :return: A Pack object pointing at the now-completed thin pack in the
            objects/pack directory.
        """
        fd, path = tempfile.mkstemp(dir=self.path, prefix='tmp_pack_')
        f = os.fdopen(fd, 'w+b')

        try:
            indexer = PackIndexer(f, resolve_ext_ref=self.get_raw)
            copier = PackStreamCopier(read_all, read_some, f,
                                      delta_iter=indexer)
            copier.verify()
            return self._complete_thin_pack(f, path, copier, indexer)
        finally:
            f.close()
开发者ID:BrenBarn,项目名称:dreampie,代码行数:25,代码来源:object_store.py

示例2: add_thin_pack

 def add_thin_pack(self, read_all, read_some):
     f = StringIO()
     indexer = PackIndexer(f, resolve_ext_ref=self.get_raw)
     copier = PackStreamCopier(read_all, read_some, f, delta_iter=indexer)
     copier.verify()
     pack_store = PackStore(repository=self.REPO)
     final_pack = Pack.from_thinpack(pack_store, f, indexer, resolve_ext_ref=self.get_raw)
     self._add_known_pack(final_pack)
开发者ID:Reidsy,项目名称:AppengineGit,代码行数:8,代码来源:gae_backend.py

示例3: add_thin_pack

    def add_thin_pack(self, read_all, read_some):
        """Read a thin pack

        Read it from a stream and complete it in a temporary file.
        Then the pack and the corresponding index file are uploaded to Swift.
        """
        fd, path = tempfile.mkstemp(prefix='tmp_pack_')
        f = os.fdopen(fd, 'w+b')
        try:
            indexer = PackIndexer(f, resolve_ext_ref=self.get_raw)
            copier = PackStreamCopier(read_all, read_some, f,
                                      delta_iter=indexer)
            copier.verify()
            return self._complete_thin_pack(f, path, copier, indexer)
        finally:
            f.close()
            os.unlink(path)
开发者ID:PKRoma,项目名称:dulwich,代码行数:17,代码来源:swift.py

示例4: add_thin_pack

    def add_thin_pack(self, read_all, read_some):
        """Add a new thin pack to this object store.

        Thin packs are packs that contain deltas with parents that exist outside
        the pack. Because this object store doesn't support packs, we extract
        and add the individual objects.

        :param read_all: Read function that blocks until the number of requested
            bytes are read.
        :param read_some: Read function that returns at least one byte, but may
            not return the number of bytes requested.
        """
        f, commit = self.add_pack()
        indexer = PackIndexer(f, resolve_ext_ref=self.get_raw)
        copier = PackStreamCopier(read_all, read_some, f, delta_iter=indexer)
        copier.verify()
        self._complete_thin_pack(f, indexer)
        commit()
开发者ID:AaronO,项目名称:dulwich,代码行数:18,代码来源:object_store.py


注:本文中的dulwich.pack.PackStreamCopier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。