本文整理匯總了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()
示例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)