110
111
self._gather_kinds(files, kinds)
111
112
self._add(files, ids, kinds)
114
def add_reference(self, sub_tree):
115
"""Add a TreeReference to the tree, pointing at sub_tree"""
116
raise errors.UnsupportedOperation(self.add_reference, self)
118
def _add_reference(self, sub_tree):
119
"""Standard add_reference implementation, for use by subclasses"""
121
sub_tree_path = self.relpath(sub_tree.basedir)
122
except errors.PathNotChild:
123
raise errors.BadReferenceTarget(self, sub_tree,
124
'Target not inside tree.')
125
sub_tree_id = sub_tree.get_root_id()
126
if sub_tree_id == self.get_root_id():
127
raise errors.BadReferenceTarget(self, sub_tree,
128
'Trees have the same root id.')
129
if sub_tree_id in self.inventory:
130
raise errors.BadReferenceTarget(self, sub_tree,
131
'Root id already present in tree')
132
self._add([sub_tree_path], [sub_tree_id], ['tree-reference'])
113
134
def _add(self, files, ids, kinds):
114
"""Helper function for add - updates the inventory."""
135
"""Helper function for add - updates the inventory.
137
:param files: sequence of pathnames, relative to the tree root
138
:param ids: sequence of suggested ids for the files (may be None)
139
:param kinds: sequence of inventory kinds of the files (i.e. may
140
contain "tree-reference")
115
142
raise NotImplementedError(self._add)
117
144
@needs_write_lock
118
def commit(self, message=None, revprops=None, *args, **kwargs):
145
def commit(self, message=None, revprops=None, *args,
119
147
# avoid circular imports
120
148
from bzrlib import commit
121
149
if revprops is None: