本文整理汇总了Python中dulwich.object_store.DiskObjectStore.add_alternate_path方法的典型用法代码示例。如果您正苦于以下问题:Python DiskObjectStore.add_alternate_path方法的具体用法?Python DiskObjectStore.add_alternate_path怎么用?Python DiskObjectStore.add_alternate_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dulwich.object_store.DiskObjectStore
的用法示例。
在下文中一共展示了DiskObjectStore.add_alternate_path方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_alternate_path
# 需要导入模块: from dulwich.object_store import DiskObjectStore [as 别名]
# 或者: from dulwich.object_store.DiskObjectStore import add_alternate_path [as 别名]
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())
示例2: test_add_alternate_path
# 需要导入模块: from dulwich.object_store import DiskObjectStore [as 别名]
# 或者: from dulwich.object_store.DiskObjectStore import add_alternate_path [as 别名]
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()))
示例3: test_alternates
# 需要导入模块: from dulwich.object_store import DiskObjectStore [as 别名]
# 或者: from dulwich.object_store.DiskObjectStore import add_alternate_path [as 别名]
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])
示例4: test_rel_alternative_path
# 需要导入模块: from dulwich.object_store import DiskObjectStore [as 别名]
# 或者: from dulwich.object_store.DiskObjectStore import add_alternate_path [as 别名]
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])
示例5: test_alternates
# 需要导入模块: from dulwich.object_store import DiskObjectStore [as 别名]
# 或者: from dulwich.object_store.DiskObjectStore import add_alternate_path [as 别名]
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])