/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_transform.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-07-12 09:58:01 UTC
  • mfrom: (7029.4.9 python3-merge)
  • Revision ID: breezy.the.bot@gmail.com-20180712095801-59ffq76qu4wou2ab
Fix some merge tests on Python 3.

Merged from https://code.launchpad.net/~jelmer/brz/python3-merge/+merge/349097

Show diffs side-by-side

added added

removed removed

Lines of Context:
1742
1742
            self.assertEqual(f.read(), b'y\nb\nc\nd\bz\n')
1743
1743
        # three-way text conflict
1744
1744
        with this.wt.get_file(this.wt.id2path(b'b')) as f:
1745
 
            self.assertEqual(f.read(), conflict_text('b', 'b2'))
 
1745
            self.assertEqual(f.read(), conflict_text(b'b', b'b2'))
1746
1746
        # OTHER wins
1747
1747
        self.assertEqual(this.wt.get_file(this.wt.id2path(b'c')).read(), b'c2')
1748
1748
        # THIS wins
1798
1798
            for link, target in (('e', e_target), ('f', f_target),
1799
1799
                                 ('g', g_target), ('h', h_target)):
1800
1800
                if target is not None:
1801
 
                    tg.tt.new_symlink(link, tg.root, target, link)
 
1801
                    tg.tt.new_symlink(link, tg.root, target, link.encode('ascii'))
1802
1802
 
1803
1803
        for tg in this, base, other:
1804
1804
            tg.tt.apply()
1827
1827
        base = TransformGroup("BASE", root_id)
1828
1828
        this = TransformGroup("THIS", root_id)
1829
1829
        other = TransformGroup("OTHER", root_id)
1830
 
        base_a, this_a, other_a = [t.tt.new_directory('a', t.root, 'a')
1831
 
                                   for t in [base, this, other]]
1832
 
        base_b, this_b, other_b = [t.tt.new_directory('b', t.root, 'b')
1833
 
                                   for t in [base, this, other]]
1834
 
        base.tt.new_directory('c', base_a, 'c')
1835
 
        this.tt.new_directory('c1', this_a, 'c')
1836
 
        other.tt.new_directory('c', other_b, 'c')
1837
 
 
1838
 
        base.tt.new_directory('d', base_a, 'd')
1839
 
        this.tt.new_directory('d1', this_b, 'd')
1840
 
        other.tt.new_directory('d', other_a, 'd')
1841
 
 
1842
 
        base.tt.new_directory('e', base_a, 'e')
1843
 
        this.tt.new_directory('e', this_a, 'e')
1844
 
        other.tt.new_directory('e1', other_b, 'e')
1845
 
 
1846
 
        base.tt.new_directory('f', base_a, 'f')
1847
 
        this.tt.new_directory('f1', this_b, 'f')
1848
 
        other.tt.new_directory('f1', other_b, 'f')
 
1830
        base_a, this_a, other_a = [t.tt.new_directory('a', t.root, b'a')
 
1831
                                   for t in [base, this, other]]
 
1832
        base_b, this_b, other_b = [t.tt.new_directory('b', t.root, b'b')
 
1833
                                   for t in [base, this, other]]
 
1834
        base.tt.new_directory('c', base_a, b'c')
 
1835
        this.tt.new_directory('c1', this_a, b'c')
 
1836
        other.tt.new_directory('c', other_b, b'c')
 
1837
 
 
1838
        base.tt.new_directory('d', base_a, b'd')
 
1839
        this.tt.new_directory('d1', this_b, b'd')
 
1840
        other.tt.new_directory('d', other_a, b'd')
 
1841
 
 
1842
        base.tt.new_directory('e', base_a, b'e')
 
1843
        this.tt.new_directory('e', this_a, b'e')
 
1844
        other.tt.new_directory('e1', other_b, b'e')
 
1845
 
 
1846
        base.tt.new_directory('f', base_a, b'f')
 
1847
        this.tt.new_directory('f1', this_b, b'f')
 
1848
        other.tt.new_directory('f1', other_b, b'f')
1849
1849
 
1850
1850
        for tg in [this, base, other]:
1851
1851
            tg.tt.apply()
1860
1860
        base = TransformGroup("BASE", root_id)
1861
1861
        this = TransformGroup("THIS", root_id)
1862
1862
        other = TransformGroup("OTHER", root_id)
1863
 
        base_a, this_a, other_a = [t.tt.new_directory('a', t.root, 'a')
 
1863
        base_a, this_a, other_a = [t.tt.new_directory('a', t.root, b'a')
1864
1864
                                   for t in [base, this, other]]
1865
 
        base_b, this_b, other_b = [t.tt.new_directory('b', t.root, 'b')
 
1865
        base_b, this_b, other_b = [t.tt.new_directory('b', t.root, b'b')
1866
1866
                                   for t in [base, this, other]]
1867
1867
 
1868
1868
        base.tt.new_file('g', base_a, [b'g'], b'g')
3156
3156
        tree_a = preview.get_preview_tree()
3157
3157
        tree_a.set_parent_ids([base_id])
3158
3158
        self.assertEqual([
3159
 
            ('killed-a', 'a\n'),
3160
 
            ('killed-b', 'b\n'),
3161
 
            ('unchanged', 'c\n'),
3162
 
            ('unchanged', 'd\n'),
3163
 
            ('new-a', 'e\n'),
3164
 
            ('new-b', 'f\n'),
 
3159
            ('killed-a', b'a\n'),
 
3160
            ('killed-b', b'b\n'),
 
3161
            ('unchanged', b'c\n'),
 
3162
            ('unchanged', b'd\n'),
 
3163
            ('new-a', b'e\n'),
 
3164
            ('new-b', b'f\n'),
3165
3165
        ], list(tree_a.plan_file_merge(b'file-id', tree_b)))
3166
3166
 
3167
3167
    def test_plan_file_merge_revision_tree(self):
3179
3179
        tree_a = preview.get_preview_tree()
3180
3180
        tree_a.set_parent_ids([base_id])
3181
3181
        self.assertEqual([
3182
 
            ('killed-a', 'a\n'),
3183
 
            ('killed-b', 'b\n'),
3184
 
            ('unchanged', 'c\n'),
3185
 
            ('unchanged', 'd\n'),
3186
 
            ('new-a', 'e\n'),
3187
 
            ('new-b', 'f\n'),
 
3182
            ('killed-a', b'a\n'),
 
3183
            ('killed-b', b'b\n'),
 
3184
            ('unchanged', b'c\n'),
 
3185
            ('unchanged', b'd\n'),
 
3186
            ('new-a', b'e\n'),
 
3187
            ('new-b', b'f\n'),
3188
3188
        ], list(tree_a.plan_file_merge(b'file-id', tree_b)))
3189
3189
 
3190
3190
    def test_walkdirs(self):