本文整理汇总了Python中osc2.wc.project.Project._status方法的典型用法代码示例。如果您正苦于以下问题:Python Project._status方法的具体用法?Python Project._status怎么用?Python Project._status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osc2.wc.project.Project
的用法示例。
在下文中一共展示了Project._status方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_commit5
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_commit5(self):
"""test commit (finish pending transaction (delete))"""
path = self.fixture_file('prj2_commit_resume')
prj = Project(path, finish_pending_transaction=False)
self.assertEqual(prj._status('abc'), 'D')
prj.commit('abc')
self.assertEqual(prj._status('abc'), '?')
示例2: test_update5
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_update5(self):
"""test update (add package)"""
path = self.fixture_file('prj1')
# it is ok to use the simple TL class because we have no
# duplicate keys (for instance a package and a file with the same name)
tl = TL(abort=False)
tl_abort = TL(abort=True)
prj = Project(path, transaction_listener=[tl, tl_abort])
self._not_exists(path, 'foo')
self.assertEqual(prj._status('foo'), '?')
prj.update('foo')
# no abort this time
tl = TL(abort=False)
prj = Project(path, transaction_listener=[tl])
self._not_exists(path, 'foo')
self.assertEqual(prj._status('foo'), '?')
prj.update('foo')
self.assertEqual(prj._status('foo'), ' ')
self._exists(path, 'foo')
self._exists(path, 'foo', 'file')
self._exists(path, '.osc', 'data', 'foo')
# check transaction listener
self.assertEqual(tl._begin, ['prj_update', 'update'])
self.assertEqual(tl._finished, ['update', 'prj_update'])
self.assertEqual(tl._transfer, [('download', 'file')])
keys = list(tl._processed.keys())
keys.sort()
self.assertEqual(keys, ['file', 'foo'])
self.assertEqual(tl._processed['file'], (' ', None))
self.assertEqual(tl._processed['foo'], (' ', None))
示例3: test_commit7
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_commit7(self):
"""test commit (local state: 'A')"""
path = self.fixture_file('prj1')
tl = TL(abort=False)
tl_abort = TL(abort=True)
prj = Project(path, transaction_listener=[tl, tl_abort])
pkg = prj.package('added')
self.assertEqual(pkg.status('foo'), 'A')
self.assertEqual(prj._status('added'), 'A')
prj.commit('added')
# this time no abort
tl = TL(abort=False)
prj = Project(path, transaction_listener=[tl])
pkg = prj.package('added')
self.assertEqual(pkg.status('foo'), 'A')
self.assertEqual(prj._status('added'), 'A')
prj.commit('added')
self.assertEqual(prj._status('added'), ' ')
pkg = prj.package('added')
self.assertEqual(pkg.status('foo'), ' ')
self._exists(path, '.osc', 'data', 'added')
# check transaction listener
self.assertEqual(tl._begin, ['prj_commit', 'commit'])
self.assertEqual(tl._finished, ['commit', 'prj_commit'])
self.assertEqual(tl._transfer, [('upload', 'foo')])
self.assertEqual(set(tl._processed.keys()),
set(['foo', 'added']))
self.assertEqual(tl._processed['foo'], (' ', 'A'))
self.assertEqual(tl._processed['added'], (' ', 'A'))
示例4: test_update1
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_update1(self):
"""test update"""
path = self.fixture_file('prj2')
prj = Project(path)
self.assertEqual(prj._status('foo'), ' ')
prj.update('foo', foo='bar')
self.assertEqual(prj._status('foo'), ' ')
self._not_exists(path, '.osc', '_transaction')
示例5: test18
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test18(self):
"""test remove (also check if the files were removed)"""
path = self.fixture_file('prj2')
prj = Project(path)
self.assertEqual(prj._status('bar'), 'A')
prj.remove('bar')
self.assertEqual(prj._status('bar'), '?')
self._not_exists(path, 'bar')
self._not_exists(path, 'bar', data=True)
示例6: test_update10
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_update10(self):
"""test update (rollback commit transaction)"""
path = self.fixture_file('prj2_update_rollback_commit')
self._exists(path, '.osc', '_transaction')
# the rest is identical to test_update1
prj = Project(path)
self.assertEqual(prj._status('foo'), ' ')
prj.update('foo', foo='bar')
self.assertEqual(prj._status('foo'), ' ')
self._not_exists(path, '.osc', '_transaction')
示例7: test_repair4
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_repair4(self):
"""test repair (wc + pkg data missing)"""
# remove package from _packages in this case
path = self.fixture_file('inv5')
self.assertRaises(WCInconsistentError, Project, path)
Project.repair(path)
self.assertEqual(Project.wc_check(path), ([], '', []))
prj = Project(path)
self.assertEqual(prj._status('missing'), '?')
self.assertEqual(prj._status('added'), 'A')
示例8: test_revert3
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_revert3(self):
"""revert a missing package"""
path = self.fixture_file('prj_revert')
prj = Project(path)
self.assertEqual(prj._status('xxx'), '!')
self._not_exists(path, 'xxx')
prj.revert('xxx')
self.assertEqual(prj._status('xxx'), ' ')
self._exists(path, 'xxx')
self._exists(path, 'xxx', 'dummy')
示例9: test_commit6
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_commit6(self):
"""test commit (package with a conflicted file)"""
path = self.fixture_file('prj3')
prj = Project(path)
pkg = prj.package('conflict')
self.assertEqual(pkg.status('conflict'), 'C')
self.assertEqual(prj._status('conflict'), ' ')
self.assertRaises(FileConflictError, prj.commit, 'conflict')
self.assertEqual(prj._status('conflict'), ' ')
pkg = prj.package('conflict')
self.assertEqual(pkg.status('conflict'), 'C')
示例10: test_revert5
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_revert5(self):
"""revert a deleted package (dir does not exist)"""
path = self.fixture_file('prj_revert')
prj = Project(path)
self.assertEqual(prj._status('del'), 'D')
self._not_exists(path, 'del')
prj.revert('del')
self.assertEqual(prj._status('del'), ' ')
self._exists(path, 'del')
pkg = prj.package('del')
self.assertEqual(pkg.status('file'), ' ')
示例11: test14
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test14(self):
"""do not add deleted package"""
path = self.fixture_file('prj2')
prj = Project(path)
self.assertEqual(prj._status('abc'), 'D')
pkg_dir = self.fixture_file('prj2', 'abc')
shutil.rmtree(pkg_dir)
os.mkdir(pkg_dir)
self.assertEqual(prj._status('abc'), 'D')
self.assertRaises(ValueError, prj.add, 'abc')
self.assertEqual(prj._status('abc'), 'D')
示例12: test6
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test6(self):
"""test _status"""
path = self.fixture_file('prj2')
prj = Project(path)
self.assertEqual(prj._status('foo'), ' ')
self.assertEqual(prj._status('bar'), 'A')
self.assertEqual(prj._status('abc'), 'D')
self.assertEqual(prj._status('xxx'), '!')
# del is not ! because it's also marked for deletion
self.assertEqual(prj._status('del'), 'D')
self.assertEqual(prj._status('asdf'), '?')
示例13: test_commitinfo2
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_commitinfo2(self):
"""test commitinfo (only specified packages)"""
path = self.fixture_file('prj2')
prj = Project(path)
self.assertEqual(prj._status('foo'), ' ')
self.assertEqual(prj._status('foo_modified'), ' ')
cinfo = prj._calculate_commitinfo('foo', 'foo_modified')
self.assertEqual(cinfo.unchanged, ['foo'])
self.assertEqual(cinfo.added, [])
self.assertEqual(cinfo.deleted, [])
self.assertEqual(cinfo.modified, ['foo_modified'])
self.assertEqual(cinfo.conflicted, [])
示例14: test_update8
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_update8(self):
"""test update (package with a conflicted file)"""
path = self.fixture_file('prj3')
prj = Project(path)
pkg = prj.package('conflict')
self.assertEqual(pkg.status('conflict'), 'C')
self.assertEqual(prj._status('conflict'), ' ')
# Note: package conflict would be deleted (if update were possible)
self.assertRaises(FileConflictError, prj.update, 'conflict')
self.assertEqual(prj._status('conflict'), ' ')
pkg = prj.package('conflict')
self.assertEqual(pkg.status('conflict'), 'C')
示例15: test_revert6
# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import _status [as 别名]
def test_revert6(self):
"""revert a package whose storedir was deleted"""
path = self.fixture_file('prj_revert')
prj = Project(path)
self.assertEqual(prj._status('modified_no_storedir'), ' ')
self._not_exists(path, 'modified_no_storedir', '.osc')
prj.revert('modified_no_storedir')
self._exists(path, 'modified_no_storedir', '.osc')
self.assertEqual(prj._status('modified_no_storedir'), ' ')
pkg = prj.package('modified_no_storedir')
self.assertEqual(pkg.status('add'), '?')
self.assertEqual(pkg.status('file'), ' ')