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


Python Changeset.get_parents方法代码示例

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


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

示例1: test_missing_changesets

# 需要导入模块: from majormajor.changeset import Changeset [as 别名]
# 或者: from majormajor.changeset.Changeset import get_parents [as 别名]
    def test_missing_changesets(self):
        doc = Document(snapshot='')
        doc.HAS_EVENT_LOOP = False
        assert doc.missing_changesets == set([])
        assert doc.pending_new_changesets == []
        
        root = doc.get_root_changeset()
        A = Changeset(doc.get_id(), "dummyuser", [root])
        doc.receive_changeset(A)
        assert doc.missing_changesets == set([])
        assert doc.pending_new_changesets == []

        # Just one Changeset gets put in pending list
        B = Changeset(doc.get_id(), "user1", ["C"])
        B.set_id("B")
        doc.receive_changeset(B)
        assert doc.get_ordered_changesets() == [root, A]
        assert doc.missing_changesets == set(["C"])
        assert doc.pending_new_changesets == [B]

        C = Changeset(doc.get_id(), "user1", [A])
        C.set_id("C")
        doc.receive_changeset(C)
        assert doc.missing_changesets == set([])
        assert doc.pending_new_changesets == []
        assert B.get_parents() == [C]
        assert doc.get_ordered_changesets() == [root, A, C, B]

        # Now a string of changesets put on pending list
        D = Changeset(doc.get_id(), "user1", ["G"])
        D.set_id("D")
        doc.receive_changeset(D)
        assert doc.missing_changesets == set(["G"])
        assert doc.pending_new_changesets == [D]
        assert doc.get_ordered_changesets() == [root, A, C, B]

        E = Changeset(doc.get_id(), "user1", ["D"])
        E.set_id("E")
        doc.receive_changeset(E)
        assert E.get_parents() == [D]
        assert doc.missing_changesets == set(["G"])
        assert doc.pending_new_changesets == [D, E]
        assert doc.get_ordered_changesets() == [root, A, C, B]

        F = Changeset(doc.get_id(), "user1", ["E"])
        F.set_id("F")
        doc.receive_changeset(F)
        assert doc.missing_changesets ==set( ["G"])
        assert doc.pending_new_changesets == [D, E, F]
        assert doc.get_ordered_changesets() == [root, A, C, B]

        G = Changeset(doc.get_id(), "user1", ["C"])
        G.set_id("G")
        doc.receive_changeset(G)
        assert doc.missing_changesets == set([])
        assert doc.pending_new_changesets == []
        assert doc.get_ordered_changesets() == [root, A, C, B, G, D, E, F]
        assert doc.get_ordered_changesets() == doc.tree_to_list()
开发者ID:citizencurator,项目名称:majormajor,代码行数:60,代码来源:test_document_missing_changesets.py

示例2: test_has_needed_dependencies

# 需要导入模块: from majormajor.changeset import Changeset [as 别名]
# 或者: from majormajor.changeset.Changeset import get_parents [as 别名]
    def test_has_needed_dependencies(self):
        doc = self.doc0

        cs1 = Changeset(doc.get_id(), 'user', [doc.get_root_changeset()])
        assert doc.has_needed_dependencies(cs1)

        cs2 = Changeset(doc.get_id(), 'user', [cs1])
        assert not doc.has_needed_dependencies(cs2)

        doc.receive_changeset(cs1)
        assert doc.has_needed_dependencies(cs2)

        cs3 = Changeset(doc.get_id(), 'user', [cs1, cs2])
        assert not doc.has_needed_dependencies(cs3)

        doc.receive_changeset(cs2)
        assert doc.has_needed_dependencies(cs3)

        cs4 = Changeset(doc.get_id(), 'user', [cs3, "555"])
        assert not doc.has_needed_dependencies(cs4)

        doc.receive_changeset(cs3)
        assert not doc.has_needed_dependencies(cs4)

        cs5 = Changeset(doc.get_id(), 'user', [cs1])
        cs5.set_id("555")
        doc.receive_changeset(cs5)
        cs4.relink_changesets(doc.all_known_changesets)
        assert cs5 in cs4.get_parents()
        assert cs4.has_full_dependency_info()
        assert doc.has_needed_dependencies(cs4)
开发者ID:citizencurator,项目名称:majormajor,代码行数:33,代码来源:test_document_helpers.py


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