/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_merge.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-07 02:14:30 UTC
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200207021430-m49iq3x4x8xlib6x
Drop python2 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
import contextlib
17
18
import os
18
19
 
19
20
from .. import (
20
21
    branch as _mod_branch,
21
 
    cleanup,
22
22
    conflicts,
23
23
    errors,
24
24
    memorytree,
37
37
from ..errors import UnrelatedBranches, NoCommits
38
38
from ..merge import transform_tree, merge_inner, _PlanMerge
39
39
from ..osutils import basename, pathjoin, file_kind
40
 
from ..sixish import int2byte
41
40
from . import (
42
41
    features,
43
42
    TestCaseWithMemoryTransport,
565
564
        self.plan_merge_vf.fallback_versionedfiles.append(self.vf)
566
565
 
567
566
    def add_version(self, key, parents, text):
568
 
        self.vf.add_lines(key, parents, [int2byte(
569
 
            c) + b'\n' for c in bytearray(text)])
 
567
        self.vf.add_lines(
 
568
            key, parents, [bytes([c]) + b'\n' for c in bytearray(text)])
570
569
 
571
570
    def add_rev(self, prefix, revision_id, parents, text):
572
571
        self.add_version((prefix, revision_id), [(prefix, p) for p in parents],
574
573
 
575
574
    def add_uncommitted_version(self, key, parents, text):
576
575
        self.plan_merge_vf.add_lines(key, parents,
577
 
                                     [int2byte(c) + b'\n' for c in bytearray(text)])
 
576
                                     [bytes([c]) + b'\n' for c in bytearray(text)])
578
577
 
579
578
    def setup_plan_merge(self):
580
579
        self.add_rev(b'root', b'A', [], b'abc')
3179
3178
        :param merge_as: the path in a tree to add the new directory as.
3180
3179
        :returns: the conflicts from 'do_merge'.
3181
3180
        """
3182
 
        with cleanup.ExitStack() as stack:
 
3181
        with contextlib.ExitStack() as stack:
3183
3182
            # Open and lock the various tree and branch objects
3184
3183
            wt, subdir_relpath = WorkingTree.open_containing(merge_as)
3185
3184
            stack.enter_context(wt.lock_write())