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