6
7
from bzrlib.add import smart_add_tree
7
8
from bzrlib.branch import ScratchBranch, Branch
8
9
from bzrlib.builtins import merge
9
10
from bzrlib.errors import (NotBranchError, NotVersionedError,
10
11
WorkingTreeNotRevision, BzrCommandError, NoDiff3)
11
from bzrlib.fetch import Fetcher
12
12
from bzrlib.inventory import RootEntry
13
13
import bzrlib.inventory as inventory
14
14
from bzrlib.merge import Merge3Merger, Diff3Merger, WeaveMerger
41
40
def add_file(self, id, parent, name, contents, executable):
43
parent_id = tt.get_trans_id(parent)
42
parent_id = tt.trans_id_file_id(parent)
44
43
tt.new_file(name, parent_id, contents, id, executable)
45
44
for tt in (self.this_tt, self.base_tt, self.other_tt):
54
53
wt.commit('branch commit')
55
54
assert len(wt.branch.revision_history()) == 2
56
Fetcher(self.this.branch, self.other.branch,
57
self.other.branch.last_revision())
55
self.this.branch.fetch(self.other.branch)
58
56
other_basis = self.other.branch.basis_tree()
59
57
merger = merge_type(self.this, self.this, self.base, other_basis)
60
58
return merger.cooked_conflicts
70
68
def add_symlink(self, id, parent, name, contents):
71
69
for tt in self.list_transforms():
72
parent_id = tt.get_trans_id(parent)
70
parent_id = tt.trans_id_file_id(parent)
73
71
tt.new_symlink(name, parent_id, contents, id)
75
73
def remove_file(self, file_id, base=False, this=False, other=False):
76
74
for option, tt in self.selected_transforms(this, base, other):
78
trans_id = tt.get_trans_id(file_id)
76
trans_id = tt.trans_id_file_id(file_id)
79
77
tt.cancel_creation(trans_id)
80
78
tt.cancel_versioning(trans_id)
81
79
tt.set_executability(None, trans_id)
83
81
def add_dir(self, file_id, parent, name):
84
82
for tt in self.list_transforms():
85
parent_id = tt.get_trans_id(parent)
83
parent_id = tt.trans_id_file_id(parent)
86
84
tt.new_directory(name, parent_id, file_id)
88
86
def change_name(self, id, base=None, this=None, other=None):
90
88
(other, self.other_tt)):
93
trans_id = tt.get_trans_id(id)
91
trans_id = tt.trans_id_file_id(id)
94
92
parent_id = tt.final_parent(trans_id)
95
93
tt.adjust_path(val, parent_id, trans_id)
97
95
def change_parent(self, file_id, base=None, this=None, other=None):
98
96
for parent, tt in self.selected_transforms(this, base, other):
99
trans_id = tt.get_trans_id(file_id)
100
parent_id = tt.get_trans_id(parent)
97
trans_id = tt.trans_id_file_id(file_id)
98
parent_id = tt.trans_id_file_id(parent)
101
99
tt.adjust_path(tt.final_name(trans_id), parent_id, trans_id)
103
101
def change_contents(self, file_id, base=None, this=None, other=None):
104
102
for contents, tt in self.selected_transforms(this, base, other):
105
trans_id = tt.get_trans_id(file_id)
103
trans_id = tt.trans_id_file_id(file_id)
106
104
tt.cancel_creation(trans_id)
107
105
tt.create_file(contents, trans_id)
109
107
def change_target(self, id, base=None, this=None, other=None):
110
108
for target, tt in self.selected_transforms(this, base, other):
111
trans_id = tt.get_trans_id(id)
109
trans_id = tt.trans_id_file_id(id)
112
110
tt.cancel_creation(trans_id)
113
111
tt.create_symlink(target, trans_id)
115
113
def change_perms(self, id, base=None, this=None, other=None):
116
114
for executability, tt in self.selected_transforms(this, base, other):
117
trans_id = tt.get_trans_id(id)
115
trans_id = tt.trans_id_file_id(id)
118
116
tt.set_executability(None, trans_id)
119
117
tt.set_executability(executability, trans_id)