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


Python object_store.DiskObjectStore类代码示例

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


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

示例1: test_add_thin_pack_empty

    def test_add_thin_pack_empty(self):
        o = DiskObjectStore(self.store_dir)

        f = BytesIO()
        entries = build_pack(f, [], store=o)
        self.assertEquals([], entries)
        o.add_thin_pack(f.read, None)
开发者ID:agilescm,项目名称:dulwich,代码行数:7,代码来源:test_object_store.py

示例2: _init_maybe_bare

 def _init_maybe_bare(cls, path, bare):
     for d in BASE_DIRECTORIES:
         os.mkdir(os.path.join(path, *d))
     DiskObjectStore.init(os.path.join(path, OBJECTDIR))
     ret = cls(path)
     ret.refs.set_symbolic_ref(b"HEAD", b"refs/heads/master")
     ret._init_files(bare)
     return ret
开发者ID:TDC-bob,项目名称:dulwich-py3k,代码行数:8,代码来源:repo.py

示例3: create

 def create(worktree: Path, store: Path):
     List.wrap(BASE_DIRECTORIES)\
         .smap(store.joinpath) %\
         __.mkdir(parents=True, exist_ok=True)
     DiskObjectStore.init(str(store / OBJECTDIR))
     repo = DulwichRepo(store, worktree)
     repo.refs.set_symbolic_ref(b'HEAD', _master_ref.encode())
     return repo
开发者ID:tek,项目名称:proteome,代码行数:8,代码来源:repo.py

示例4: _init_maybe_bare

 def _init_maybe_bare(cls, path, bare):
     for d in BASE_DIRECTORIES:
         os.mkdir(os.path.join(path, *d))
     DiskObjectStore.init(os.path.join(path, OBJECTDIR))
     ret = cls(path)
     ret.refs.set_symbolic_ref(b'HEAD', DEFAULT_REF)
     ret._init_files(bare)
     return ret
开发者ID:akbargumbira,项目名称:qgis_resources_sharing,代码行数:8,代码来源:repo.py

示例5: test_add_pack

 def test_add_pack(self):
     o = DiskObjectStore(self.store_dir)
     f, commit, abort = o.add_pack()
     try:
         b = make_object(Blob, data=b"more yummy data")
         write_pack_objects(f, [(b, None)])
     except BaseException:
         abort()
         raise
     else:
         commit()
开发者ID:paddie,项目名称:dulwich,代码行数:11,代码来源:test_object_store.py

示例6: _init_maybe_bare

 def _init_maybe_bare(cls, path, bare):
     if not isinstance(path, bytes):
         path_bytes = path.encode(sys.getfilesystemencoding())
     else:
         path_bytes = path
     for d in BASE_DIRECTORIES:
         os.mkdir(os.path.join(path_bytes, *d))
     DiskObjectStore.init(os.path.join(path_bytes, OBJECTDIR))
     ret = cls(path)
     ret.refs.set_symbolic_ref(b'HEAD', b"refs/heads/master")
     ret._init_files(bare)
     return ret
开发者ID:mmonaco,项目名称:dulwich,代码行数:12,代码来源:repo.py

示例7: init_bare

    def init_bare(cls, path, mkdir=True):
        for d in BASE_DIRECTORIES:
            os.mkdir(os.path.join(path, *d))
        DiskObjectStore.init(os.path.join(path, OBJECTDIR))
        ret = cls(path)
        ret.refs.set_symbolic_ref("HEAD", "refs/heads/master")
        ret._put_named_file('description', "Unnamed repository")
        ret._put_named_file('config', """[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
""")
        ret._put_named_file(os.path.join('info', 'excludes'), '')
        return ret
开发者ID:whilp,项目名称:dulwich,代码行数:15,代码来源:repo.py

示例8: setUp

 def setUp(self):
     TestCase.setUp(self)
     self.store_dir = tempfile.mkdtemp()
     if not isinstance(self.store_dir, bytes):
         self.store_dir = self.store_dir.encode(sys.getfilesystemencoding())
     self.addCleanup(shutil.rmtree, self.store_dir)
     self.store = DiskObjectStore.init(self.store_dir)
开发者ID:mmahmedgithub,项目名称:dulwich,代码行数:7,代码来源:test_object_store.py

示例9: test_add_alternate_path

 def test_add_alternate_path(self):
     store = DiskObjectStore(self.store_dir)
     self.assertEquals([], store._read_alternate_paths())
     store.add_alternate_path("/foo/path")
     self.assertEquals(["/foo/path"], store._read_alternate_paths())
     store.add_alternate_path("/bar/path")
     self.assertEquals(
         ["/foo/path", "/bar/path"],
         store._read_alternate_paths())
开发者ID:Mistobaan,项目名称:dulwich,代码行数:9,代码来源:test_object_store.py

示例10: test_add_alternate_path

 def test_add_alternate_path(self):
     store = DiskObjectStore(self.store_dir)
     self.assertEqual([], list(store._read_alternate_paths()))
     store.add_alternate_path(b'/foo/path')
     self.assertEqual([b'/foo/path'], list(store._read_alternate_paths()))
     store.add_alternate_path(b'/bar/path')
     self.assertEqual(
         [b'/foo/path', b'/bar/path'],
         list(store._read_alternate_paths()))
开发者ID:mmahmedgithub,项目名称:dulwich,代码行数:9,代码来源:test_object_store.py

示例11: __init__

 def __init__(self, root):
     if os.path.isdir(os.path.join(root, ".git", OBJECTDIR)):
         self.bare = False
         self._controldir = os.path.join(root, ".git")
     elif (os.path.isdir(os.path.join(root, OBJECTDIR)) and
           os.path.isdir(os.path.join(root, REFSDIR))):
         self.bare = True
         self._controldir = root
     else:
         raise NotGitRepository(root)
     self.path = root
     self.refs = DiskRefsContainer(self.controldir())
     self.object_store = DiskObjectStore(
         os.path.join(self.controldir(), OBJECTDIR))
开发者ID:asenchi,项目名称:dulwich,代码行数:14,代码来源:repo.py

示例12: test_alternates

 def test_alternates(self):
     alternate_dir = tempfile.mkdtemp()
     self.addCleanup(shutil.rmtree, alternate_dir)
     alternate_store = DiskObjectStore(alternate_dir)
     b2 = make_object(Blob, data="yummy data")
     alternate_store.add_object(b2)
     store = DiskObjectStore(self.store_dir)
     self.assertRaises(KeyError, store.__getitem__, b2.id)
     store.add_alternate_path(alternate_dir)
     self.assertEquals(b2, store[b2.id])
开发者ID:Mistobaan,项目名称:dulwich,代码行数:10,代码来源:test_object_store.py

示例13: test_add_thin_pack

    def test_add_thin_pack(self):
        o = DiskObjectStore(self.store_dir)
        blob = make_object(Blob, data='yummy data')
        o.add_object(blob)

        f = BytesIO()
        entries = build_pack(f, [
          (REF_DELTA, (blob.id, 'more yummy data')),
          ], store=o)
        pack = o.add_thin_pack(f.read, None)
        try:
            packed_blob_sha = sha_to_hex(entries[0][3])
            pack.check_length_and_checksum()
            self.assertEqual(sorted([blob.id, packed_blob_sha]), list(pack))
            self.assertTrue(o.contains_packed(packed_blob_sha))
            self.assertTrue(o.contains_packed(blob.id))
            self.assertEqual((Blob.type_num, 'more yummy data'),
                             o.get_raw(packed_blob_sha))
        finally:
            o.close()
            pack.close()
开发者ID:KrissN,项目名称:dulwich,代码行数:21,代码来源:test_object_store.py

示例14: test_rel_alternative_path

 def test_rel_alternative_path(self):
     alternate_dir = tempfile.mkdtemp()
     self.addCleanup(shutil.rmtree, alternate_dir)
     alternate_store = DiskObjectStore(alternate_dir)
     b2 = make_object(Blob, data="yummy data")
     alternate_store.add_object(b2)
     store = DiskObjectStore(self.store_dir)
     self.assertRaises(KeyError, store.__getitem__, b2.id)
     store.add_alternate_path(os.path.relpath(alternate_dir, self.store_dir))
     self.assertEqual(list(alternate_store), list(store.alternates[0]))
     self.assertIn(b2.id, store)
     self.assertEqual(b2, store[b2.id])
开发者ID:AaronO,项目名称:dulwich,代码行数:12,代码来源:test_object_store.py

示例15: test_alternates

 def test_alternates(self):
     alternate_dir = tempfile.mkdtemp()
     if not isinstance(alternate_dir, bytes):
         alternate_dir = alternate_dir.encode(sys.getfilesystemencoding())
     self.addCleanup(shutil.rmtree, alternate_dir)
     alternate_store = DiskObjectStore(alternate_dir)
     b2 = make_object(Blob, data=b"yummy data")
     alternate_store.add_object(b2)
     store = DiskObjectStore(self.store_dir)
     self.assertRaises(KeyError, store.__getitem__, b2.id)
     store.add_alternate_path(alternate_dir)
     self.assertIn(b2.id, store)
     self.assertEqual(b2, store[b2.id])
开发者ID:mmahmedgithub,项目名称:dulwich,代码行数:13,代码来源:test_object_store.py


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