本文整理汇总了Python中git.IndexFile.update方法的典型用法代码示例。如果您正苦于以下问题:Python IndexFile.update方法的具体用法?Python IndexFile.update怎么用?Python IndexFile.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git.IndexFile
的用法示例。
在下文中一共展示了IndexFile.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_index_file_base
# 需要导入模块: from git import IndexFile [as 别名]
# 或者: from git.IndexFile import update [as 别名]
def test_index_file_base(self):
# read from file
index = IndexFile(self.rorepo, fixture_path("index"))
assert index.entries
assert index.version > 0
# test entry
entry = next(iter(index.entries.values()))
for attr in ("path", "ctime", "mtime", "dev", "inode", "mode", "uid",
"gid", "size", "binsha", "hexsha", "stage"):
getattr(entry, attr)
# END for each method
# test update
entries = index.entries
assert isinstance(index.update(), IndexFile)
assert entries is not index.entries
# test stage
index_merge = IndexFile(self.rorepo, fixture_path("index_merge"))
self.assertEqual(len(index_merge.entries), 106)
assert len(list(e for e in index_merge.entries.values() if e.stage != 0))
# write the data - it must match the original
tmpfile = tempfile.mktemp()
index_merge.write(tmpfile)
with open(tmpfile, 'rb') as fp:
self.assertEqual(fp.read(), fixture("index_merge"))
os.remove(tmpfile)