Ejemplo n.º 1
0
    def test_new_in_other_floats_to_top(self):
        """Changes at the top of 'other' float to the top.

        Given a changelog in THIS containing::

          NEW-1
          OLD-1

        and a changelog in OTHER containing::

          NEW-2
          OLD-1

        it will merge as::

          NEW-2
          NEW-1
          OLD-1
        """
        base_entries = ['OLD-1']
        this_entries = ['NEW-1', 'OLD-1']
        other_entries = ['NEW-2', 'OLD-1']
        result_entries = changelog_merge.merge_entries(
            base_entries, this_entries, other_entries)
        self.assertEqual(
            ['NEW-2', 'NEW-1', 'OLD-1'], result_entries)
Ejemplo n.º 2
0
 def test_more_complex_conflict(self):
     """Like test_acceptance_bug_723968, but with a more difficult conflict:
     the new entry and the edited entry are adjacent.
     """
     def guess_edits(new, deleted):
         #import pdb; pdb.set_trace()
         return changelog_merge.default_guess_edits(new, deleted,
                 entry_as_str=lambda x: x)
     result_entries = changelog_merge.merge_entries(
         sample2_base_entries, sample2_this_entries, sample2_other_entries,
         guess_edits=guess_edits)
     self.assertEqual([
         'Other entry O1',
         'This entry T1',
         'This entry T2',
         'Base entry B1 edit',
         'Base entry B2',
         ],
         list(result_entries))
Ejemplo n.º 3
0
    def test_acceptance_bug_723968(self):
        """Merging a branch that:

         1. adds a new entry, and
         2. edits an old entry (e.g. to fix a typo or twiddle formatting)

        will:

         1. add the new entry to the top
         2. keep the edit, without duplicating the edited entry or moving it.
        """
        result_entries = changelog_merge.merge_entries(
            sample_base_entries, sample_this_entries, sample_other_entries)
        self.assertEqual([
            'Other entry O1',
            'This entry T1',
            'This entry T2',
            'Base entry B1',
            'Base entry B2 updated',
            'Base entry B3',
            ],
            list(result_entries))