當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。