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


Python Diff._index_from_raw_format方法代码示例

本文整理汇总了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
开发者ID:Patechoc,项目名称:GitPython,代码行数:27,代码来源:test_diff.py

示例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)
开发者ID:gitpython-developers,项目名称:GitPython,代码行数:29,代码来源:test_diff.py

示例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)
开发者ID:gitpython-developers,项目名称:GitPython,代码行数:28,代码来源:test_diff.py

示例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
开发者ID:gbatye,项目名称:GitPython,代码行数:10,代码来源:test_diff.py

示例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 == ''
开发者ID:MineRobber9000,项目名称:gitoverview,代码行数:7,代码来源:test_diff.py

示例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,)
开发者ID:andy-maier,项目名称:GitPython,代码行数:7,代码来源:test_diff.py


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