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


Python Project.update方法代码示例

本文整理汇总了Python中osc2.wc.project.Project.update方法的典型用法代码示例。如果您正苦于以下问题:Python Project.update方法的具体用法?Python Project.update怎么用?Python Project.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osc2.wc.project.Project的用法示例。


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

示例1: test_update5

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [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))
开发者ID:scarabeusiv,项目名称:osc2,代码行数:32,代码来源:test_project.py

示例2: test_update3

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [as 别名]
 def test_update3(self):
     """test update (delete package; local state '!')"""
     path = self.fixture_file('prj2')
     self._not_exists(path, 'xxx')
     prj = Project(path)
     prj.update('xxx')
     self.assertEqual(prj._status('xxx'), '?')
     self._not_exists(path, '.osc', 'data', 'xxx')
开发者ID:scarabeusiv,项目名称:osc2,代码行数:10,代码来源:test_project.py

示例3: test_update1

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [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')
开发者ID:scarabeusiv,项目名称:osc2,代码行数:10,代码来源:test_project.py

示例4: _checkout

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [as 别名]
def _checkout(info):
    path = os.path.join(os.getcwd(), info.project)
    if not os.path.exists(path):
        Project.init(path, info.project, info.apiurl)
    packages = []
    if hasattr(info, 'package'):
        packages.append(info.package)
    prj = Project(path, transaction_listener=[MyTransactionListener()])
    prj.update(*packages)
开发者ID:bergmannf,项目名称:osc2,代码行数:11,代码来源:example.py

示例5: test_update10

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [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')
开发者ID:scarabeusiv,项目名称:osc2,代码行数:12,代码来源:test_project.py

示例6: test_update6

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [as 别名]
 def test_update6(self):
     """test update (finish pending add transaction)"""
     path = self.fixture_file('prj1_update_resume')
     self._exists(path, '.osc', '_transaction')
     prj = Project(path, finish_pending_transaction=False)
     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')
     self._not_exists(path, '.osc', '_transaction')
开发者ID:scarabeusiv,项目名称:osc2,代码行数:15,代码来源:test_project.py

示例7: _update

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [as 别名]
def _update(info):
    path = os.getcwd()
    par_path = os.path.join(path, os.pardir)
    expand = ''
    if hasattr(info, 'expand'):
        expand = info.expand
    if hasattr(info, 'package') and not wc_is_project(par_path):
        pkg = Package(path, transaction_listner=[MyTransactionListener()])
        pkg.update(expand=expand)
    elif hasattr(info, 'package') and wc_is_project(par_path):
        prj = Project(par_path, transaction_listener=[MyTransactionListener()])
        prj.update(*[info.package], expand=expand)
    elif wc_is_project(path):
        prj = Project(path, transaction_listener=[MyTransactionListener()])
        prj.update(expand=expand)
开发者ID:bergmannf,项目名称:osc2,代码行数:17,代码来源:example.py

示例8: test_update2

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [as 别名]
 def test_update2(self):
     """test update (delete package; local state 'D')"""
     path = self.fixture_file('prj2')
     self._exists(path, 'abc')
     self._exists(path, 'abc', 'modified')
     self._exists(path, 'abc', 'untracked')
     self._exists(path, 'abc', '.osc')
     self._exists(path, '.osc', 'data', 'abc')
     prj = Project(path)
     self.assertEqual(prj._status('abc'), 'D')
     prj.update('abc')
     self.assertEqual(prj._status('abc'), '?')
     self._exists(path, 'abc')
     self._exists(path, 'abc', 'modified')
     self._exists(path, 'abc', 'untracked')
     self._not_exists(path, 'abc', '.osc')
     self._not_exists(path, '.osc', 'data', 'abc')
开发者ID:scarabeusiv,项目名称:osc2,代码行数:19,代码来源:test_project.py

示例9: test_update4

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [as 别名]
 def test_update4(self):
     """test update (delete package: local state ' ')"""
     path = self.fixture_file('prj2')
     # 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)
     self._exists(path, 'foo')
     self._exists(path, '.osc', 'data', 'foo')
     prj = Project(path, transaction_listener=[tl])
     self.assertEqual(prj._status('foo'), ' ')
     prj.update('foo')
     self.assertEqual(prj._status('foo'), '?')
     self._not_exists(path, 'foo')
     self._not_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, [])
     keys = list(tl._processed.keys())
     keys.sort()
     self.assertEqual(keys, ['file', 'foo'])
     self.assertEqual(tl._processed['file'], (None, ' '))
     self.assertEqual(tl._processed['foo'], (None, ' '))
开发者ID:scarabeusiv,项目名称:osc2,代码行数:25,代码来源:test_project.py

示例10: test_update9

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import update [as 别名]
 def test_update9(self):
     """test update (with project transaction_listener)"""
     path = self.fixture_file('prj2')
     tl = ProjectTL()
     prj = Project(path, transaction_listener=[tl])
     self.assertEqual(prj._status('add'), '?')
     self.assertEqual(prj._status('abc'), 'D')
     self.assertEqual(prj._status('foo'), ' ')
     prj.update('foo', 'abc', 'add')
     # check status after update
     self.assertEqual(prj._status('add'), ' ')
     self.assertEqual(prj._status('foo'), ' ')
     self.assertEqual(prj._status('abc'), '?')
     self._not_exists(path, '.osc', '_transaction')
     # check transaction listener
     keys = list(tl._processed.keys())
     keys.sort()
     self.assertEqual(keys, ['prj_update:abc', 'prj_update:add',
                             'prj_update:foo', 'update:added',
                             'update:dummy', 'update:file', 'update:foo',
                             'update:modified'])
     self.assertEqual(tl._begin, ['prj_update', 'update', 'update',
                                  'update'])
     self.assertEqual(tl._finished, ['update', 'update', 'update',
                                     'prj_update'])
     self.assertEqual(tl._transfer, [('download', 'file'),
                                     ('download', 'added')])
     self.assertEqual(tl._processed['update:file'], (' ', None))
     self.assertEqual(tl._processed['prj_update:add'], (' ', None))
     # file belong to package foo
     self.assertEqual(tl._processed['update:added'], (' ', None))
     self.assertEqual(tl._processed['prj_update:foo'], (' ', ' '))
     # files belong to package abc
     self.assertEqual(tl._processed['update:dummy'], (None, 'D'))
     self.assertEqual(tl._processed['update:foo'], (None, 'D'))
     self.assertEqual(tl._processed['update:modified'], (None, 'D'))
     self.assertEqual(tl._processed['prj_update:abc'], (None, 'D'))
开发者ID:scarabeusiv,项目名称:osc2,代码行数:39,代码来源:test_project.py


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