def test_automatic_merge_with_two_identifiers_saying_that_there_are_changes_in_both_branches_next_to_each_other( self): # Given helper_ToWriteIntoMergeConflictTempFile.data = TestMergeConflictDetector_ConflitFileTestData.automatic_merge_with_two_changed_in_both_next_to_each_other # When mergeConflictDetector = MergeConflictDetector.MergeConflictDetector( "releasearchipelago", "somebranch") # Then expectedConflictData = { 'ourCode': [ """ if (!CreateTransferTimer()) return false; @@ -48,6 +43,8 @@ } DebugLoggerFlags::SetAllDebugFlags(false); //Reset all debug flags to prevent any output """ ], 'theirCode': [''], 'file': ['COMPONENTS/CLI/Source/Commands/General/XModemFileReceiver.cpp'], 'line': [47] } self.assertEqual(expectedConflictData, mergeConflictDetector.ConflictData)
def test_multiple_conflicts_in_the_same_file(self): # Given helper_ToWriteIntoMergeConflictTempFile.data = TestMergeConflictDetector_ConflitFileTestData.multiple_conflicts_in_the_same_file # When mergeConflictDetector = MergeConflictDetector.MergeConflictDetector( "releasearchipelago", "somebranch") # Then expectedConflictData = { 'ourCode': [ """ *.deppedy-doo-dah""", """-some line that was taken away\n+some line that replaced the line that was taken away""" ], 'theirCode': [ """+*.what a wonderful day""", """-some line that was taken away\n+a line which also wished to replace that other line""" ], 'file': [ """/somewhere/some/amazing/file""", """/somewhere/some/amazing/file""" ], 'line': [7, 23] } self.assertEqual(expectedConflictData, mergeConflictDetector.ConflictData)
def test_no_conflicts_with_multiple_automatic_merges(self): # Given helper_ToWriteIntoMergeConflictTempFile.data = TestMergeConflictDetector_ConflitFileTestData.no_conflict_multiple_merges # When mergeConflictDetector = MergeConflictDetector.MergeConflictDetector( "releasearchipelago", "somebranch") # Then expectedConflictData = { 'ourCode': [], 'theirCode': [], 'file': [], 'line': [] } self.assertEqual(expectedConflictData, mergeConflictDetector.ConflictData)
def test_automatic_merge_with_identifier_saying_that_there_are_changes_in_both_branches( self): # Given helper_ToWriteIntoMergeConflictTempFile.data = TestMergeConflictDetector_ConflitFileTestData.automatic_merge_with_changed_in_both # When mergeConflictDetector = MergeConflictDetector.MergeConflictDetector( "releasearchipelago", "somebranch") # Then expectedConflictData = { 'ourCode': [], 'theirCode': [], 'file': [], 'line': [] } self.assertEqual(expectedConflictData, mergeConflictDetector.ConflictData)
def test_single_conflict(self): # Given helper_ToWriteIntoMergeConflictTempFile.data = TestMergeConflictDetector_ConflitFileTestData.single_conflict # When mergeConflictDetector = MergeConflictDetector.MergeConflictDetector( "releasearchipelago", "somebranch") # Then expectedConflictData = { 'ourCode': [""" *.deppedy-doo-dah"""], 'theirCode': ["""+*.what a wonderful day"""], 'file': [""".gitignore"""], 'line': [ 7 ] # git gives 4 in-between the @...@ but that is actually 3 lines above the conflict } self.assertEqual(expectedConflictData, mergeConflictDetector.ConflictData)
def __getConflictData(self, archipelagoName, branchName): mergeConflictDetector = MergeConflictDetector.MergeConflictDetector(archipelagoName, branchName) self._conflictData = mergeConflictDetector.ConflictData