本文整理汇总了Python中git.Diff._index_from_raw_format方法的典型用法代码示例。如果您正苦于以下问题:Python Diff._index_from_raw_format方法的具体用法?Python Diff._index_from_raw_format怎么用?Python Diff._index_from_raw_format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git.Diff
的用法示例。
在下文中一共展示了Diff._index_from_raw_format方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_diff_with_rename
# 需要导入模块: from git import Diff [as 别名]
# 或者: from git.Diff import _index_from_raw_format [as 别名]
def test_diff_with_rename(self):
output = StringProcessAdapter(fixture('diff_rename'))
diffs = Diff._index_from_patch_format(self.rorepo, output.stdout)
self._assert_diff_format(diffs)
assert_equal(1, len(diffs))
diff = diffs[0]
assert_true(diff.renamed_file)
assert_true(diff.renamed)
assert_equal(diff.rename_from, u'Jérôme')
assert_equal(diff.rename_to, u'müller')
assert_equal(diff.raw_rename_from, b'J\xc3\xa9r\xc3\xb4me')
assert_equal(diff.raw_rename_to, b'm\xc3\xbcller')
assert isinstance(str(diff), str)
output = StringProcessAdapter(fixture('diff_rename_raw'))
diffs = Diff._index_from_raw_format(self.rorepo, output.stdout)
assert len(diffs) == 1
diff = diffs[0]
assert diff.renamed_file
assert diff.renamed
assert diff.rename_from == 'this'
assert diff.rename_to == 'that'
assert len(list(diffs.iter_change_type('R'))) == 1
示例2: test_diff_with_rename
# 需要导入模块: from git import Diff [as 别名]
# 或者: from git.Diff import _index_from_raw_format [as 别名]
def test_diff_with_rename(self):
output = StringProcessAdapter(fixture('diff_rename'))
diffs = Diff._index_from_patch_format(self.rorepo, output)
self._assert_diff_format(diffs)
assert_equal(1, len(diffs))
diff = diffs[0]
assert_true(diff.renamed_file)
assert_true(diff.renamed)
assert_equal(diff.rename_from, u'Jérôme')
assert_equal(diff.rename_to, u'müller')
assert_equal(diff.raw_rename_from, b'J\xc3\xa9r\xc3\xb4me')
assert_equal(diff.raw_rename_to, b'm\xc3\xbcller')
assert isinstance(str(diff), str)
output = StringProcessAdapter(fixture('diff_rename_raw'))
diffs = Diff._index_from_raw_format(self.rorepo, output)
self.assertEqual(len(diffs), 1)
diff = diffs[0]
self.assertIsNotNone(diff.renamed_file)
self.assertIsNotNone(diff.renamed)
self.assertEqual(diff.rename_from, 'this')
self.assertEqual(diff.rename_to, 'that')
self.assertEqual(diff.change_type, 'R')
self.assertEqual(diff.score, 100)
self.assertEqual(len(list(diffs.iter_change_type('R'))), 1)
示例3: test_diff_with_change_in_type
# 需要导入模块: from git import Diff [as 别名]
# 或者: from git.Diff import _index_from_raw_format [as 别名]
def test_diff_with_change_in_type(self):
output = StringProcessAdapter(fixture('diff_change_in_type'))
diffs = Diff._index_from_patch_format(self.rorepo, output)
self._assert_diff_format(diffs)
assert_equal(2, len(diffs))
diff = diffs[0]
self.assertIsNotNone(diff.deleted_file)
assert_equal(diff.a_path, 'this')
assert_equal(diff.b_path, 'this')
assert isinstance(str(diff), str)
diff = diffs[1]
assert_equal(diff.a_path, None)
assert_equal(diff.b_path, 'this')
self.assertIsNotNone(diff.new_file)
assert isinstance(str(diff), str)
output = StringProcessAdapter(fixture('diff_change_in_type_raw'))
diffs = Diff._index_from_raw_format(self.rorepo, output)
self.assertEqual(len(diffs), 1)
diff = diffs[0]
self.assertEqual(diff.rename_from, None)
self.assertEqual(diff.rename_to, None)
self.assertEqual(diff.change_type, 'T')
self.assertEqual(len(list(diffs.iter_change_type('T'))), 1)
示例4: test_diff_of_modified_files_not_added_to_the_index
# 需要导入模块: from git import Diff [as 别名]
# 或者: from git.Diff import _index_from_raw_format [as 别名]
def test_diff_of_modified_files_not_added_to_the_index(self):
output = StringProcessAdapter(fixture('diff_abbrev-40_full-index_M_raw_no-color'))
diffs = Diff._index_from_raw_format(self.rorepo, output.stdout)
assert len(diffs) == 1, 'one modification'
assert len(list(diffs.iter_change_type('M'))) == 1, 'one modification'
assert diffs[0].change_type == 'M'
assert diffs[0].b_blob is None
示例5: test_diff_index_raw_format
# 需要导入模块: from git import Diff [as 别名]
# 或者: from git.Diff import _index_from_raw_format [as 别名]
def test_diff_index_raw_format(self):
output = StringProcessAdapter(fixture('diff_index_raw'))
res = Diff._index_from_raw_format(None, output.stdout)
assert res[0].deleted_file
assert res[0].b_path == ''
示例6: test_diff_index_raw_format
# 需要导入模块: from git import Diff [as 别名]
# 或者: from git.Diff import _index_from_raw_format [as 别名]
def test_diff_index_raw_format(self):
output = StringProcessAdapter(fixture('diff_index_raw'))
res = Diff._index_from_raw_format(None, output)
self.assertIsNotNone(res[0].deleted_file)
self.assertIsNone(res[0].b_path,)