~jeanfrancois.roy/bzr/url-safe-escape

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_merge_core.py

  • Committer: Robert Collins
  • Date: 2005-09-27 07:24:40 UTC
  • mfrom: (1185.1.41)
  • Revision ID: robertc@robertcollins.net-20050927072440-1bf4d99c3e1db5b3
pair programming worx... merge integration and weave

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
 
2
import shutil
 
3
import tempfile
2
4
import unittest
3
5
 
4
6
from bzrlib.selftest import TestCaseInTempDir, TestCase
5
7
from bzrlib.branch import ScratchBranch, Branch
6
8
from bzrlib.errors import NotBranchError, NotVersionedError
7
 
 
8
 
 
9
 
import tempfile
10
 
import shutil
11
9
from bzrlib.inventory import InventoryEntry, RootEntry
12
 
from bzrlib.osutils import file_kind
 
10
from bzrlib.osutils import file_kind, rename
13
11
from bzrlib import changeset
14
12
from bzrlib.merge_core import (ApplyMerge3, make_merge_changeset,
15
13
                                BackupBeforeChange, PermissionsMerge)
16
14
from bzrlib.changeset import Inventory, apply_changeset, invert_dict
17
15
 
 
16
 
18
17
class FalseTree(object):
19
18
    def __init__(self, realtree):
20
19
        self._realtree = realtree
100
99
 
101
100
    def change_path(self, id, path):
102
101
        old_path = os.path.join(self.dir, self.inventory[id])
103
 
        os.rename(old_path, self.abs_path(path))
 
102
        rename(old_path, self.abs_path(path))
104
103
        self.inventory[id] = path
105
104
 
106
105
 
240
239
        os.chmod(tree.full_path(id), mode)
241
240
 
242
241
    def merge_changeset(self, merge_factory):
243
 
        conflict_handler = changeset.ExceptionConflictHandler(self.this.dir)
 
242
        conflict_handler = changeset.ExceptionConflictHandler()
244
243
        return make_merge_changeset(self.cset, self.this, self.base,
245
244
                                    self.other, conflict_handler,
246
245
                                    merge_factory)
475
474
        from bzrlib.merge import merge
476
475
        # John starts a branch
477
476
        self.build_tree(("original/", "original/file1", "original/file2"))
478
 
        branch = Branch("original", init=True)
 
477
        branch = Branch.initialize("original")
479
478
        smart_add_branch(branch, ["original"], True, add_reporter_null)
480
479
        branch.commit("start branch.", verbose=False)
481
480
        # Mary branches it.
487
486
        file.close()
488
487
        branch.commit("change file1")
489
488
        # Mary does too
490
 
        mary_branch = Branch("mary")
 
489
        mary_branch = Branch.open("mary")
491
490
        file = open("mary/file2", "wt")
492
491
        file.write("Mary\n")
493
492
        file.close()