本文整理汇总了Python中bzrlib.weave.Weave.get_lines方法的典型用法代码示例。如果您正苦于以下问题:Python Weave.get_lines方法的具体用法?Python Weave.get_lines怎么用?Python Weave.get_lines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bzrlib.weave.Weave
的用法示例。
在下文中一共展示了Weave.get_lines方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runTest
# 需要导入模块: from bzrlib.weave import Weave [as 别名]
# 或者: from bzrlib.weave.Weave import get_lines [as 别名]
def runTest(self):
k = Weave()
k._parents = [frozenset(),
frozenset([0]),
]
k._weave = [('{', 0),
'first line',
('[', 1),
'line to be deleted',
(']', 1),
('{', 1),
'replacement line',
('}', 1),
'last line',
('}', 0),
]
k._sha1s = [sha_string('first lineline to be deletedlast line')
, sha_string('first linereplacement linelast line')]
self.assertEqual(k.get_lines(0),
['first line',
'line to be deleted',
'last line',
])
self.assertEqual(k.get_lines(1),
['first line',
'replacement line',
'last line',
])
示例2: test_multi_line_merge
# 需要导入模块: from bzrlib.weave import Weave [as 别名]
# 或者: from bzrlib.weave.Weave import get_lines [as 别名]
def test_multi_line_merge(self):
rawtexts = [
"""A Book of Verses underneath the Bough,
A Jug of Wine, a Loaf of Bread, -- and Thou
Beside me singing in the Wilderness --
Oh, Wilderness were Paradise enow!""",
"""A Book of Verses underneath the Bough,
A Jug of Wine, a Loaf of Bread, -- and Thou
Beside me singing in the Wilderness --
Oh, Wilderness were Paradise now!""",
"""A Book of poems underneath the tree,
A Jug of Wine, a Loaf of Bread,
and Thou
Beside me singing in the Wilderness --
Oh, Wilderness were Paradise now!
-- O. Khayyam""",
"""A Book of Verses underneath the Bough,
A Jug of Wine, a Loaf of Bread,
and Thou
Beside me singing in the Wilderness --
Oh, Wilderness were Paradise now!""",
]
texts = [[l.strip() for l in t.split('\n')] for t in rawtexts]
k = Weave()
parents = set()
i = 0
for t in texts:
ver = k.add_lines('text%d' % i,
list(parents), t)
parents.add('text%d' % i)
i += 1
self.log("k._weave=" + pformat(k._weave))
for i, t in enumerate(texts):
self.assertEqual(k.get_lines(i), t)
self.check_read_write(k)
示例3: test_allow_reserved_true
# 需要导入模块: from bzrlib.weave import Weave [as 别名]
# 或者: from bzrlib.weave.Weave import get_lines [as 别名]
def test_allow_reserved_true(self):
w = Weave('name', allow_reserved=True)
w.add_lines('name:', [], TEXT_1)
self.assertEqual(TEXT_1, w.get_lines('name:'))