201
202
revprops -- Properties for new revision
202
203
:param local: Perform a local only commit.
204
:param recursive: If set to 'down', commit in any subtrees that have
205
pending changes of any sort during this commit.
204
207
mutter('preparing to commit')
215
218
self.work_tree = working_tree
216
219
self.branch = self.work_tree.branch
220
if getattr(self.work_tree, 'requires_rich_root', lambda: False)():
221
if not self.branch.repository.supports_rich_root():
222
raise errors.RootNotRich()
217
223
if message_callback is None:
218
224
if message is not None:
219
225
if isinstance(message, str):
230
236
self.rev_id = None
231
237
self.specific_files = specific_files
232
238
self.allow_pointless = allow_pointless
239
self.recursive = recursive
240
self.revprops = revprops
241
self.message_callback = message_callback
242
self.timestamp = timestamp
243
self.timezone = timezone
244
self.committer = committer
245
self.specific_files = specific_files
247
self.verbose = verbose
234
250
if reporter is None and self.reporter is None:
235
251
self.reporter = NullCommitReporter()
239
255
self.work_tree.lock_write()
240
256
self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
257
self.basis_tree = self.work_tree.basis_tree()
258
self.basis_tree.lock_read()
242
260
# Cannot commit with conflicts present.
243
261
if len(self.work_tree.conflicts())>0:
273
291
self.config = self.branch.get_config()
275
293
self.work_inv = self.work_tree.inventory
276
self.basis_tree = self.work_tree.basis_tree()
277
294
self.basis_inv = self.basis_tree.inventory
278
295
if specific_files is not None:
279
296
# Ensure specified files are versioned
280
297
# (We don't actually need the ids here)
281
tree.find_ids_across_trees(specific_files,
298
# XXX: Dont we have filter_unversioned to do this more
300
tree.find_ids_across_trees(specific_files,
282
301
[self.basis_tree, self.work_tree])
283
302
# one to finish, one for rev and inventory, and one for each
284
303
# inventory entry, and the same for the new inventory.
293
312
raise NotImplementedError('selected-file commit of merges is not supported yet: files %r',
294
313
self.specific_files)
296
self.builder = self.branch.get_commit_builder(self.parents,
315
self.builder = self.branch.get_commit_builder(self.parents,
297
316
self.config, timestamp, timezone, committer, revprops, rev_id)
299
318
self._remove_deleted()
393
412
and (this.parent_id == other.parent_id)
394
413
and (this.kind == other.kind)
395
414
and (this.executable == other.executable)
415
and (this.reference_revision == other.reference_revision)
397
417
if not ie_equal_no_revision(new_root_ie, basis_root_ie):
588
609
file_id = new_ie.file_id
590
611
kind = self.work_tree.kind(file_id)
612
if kind == 'tree-reference' and self.recursive == 'down':
613
# nested tree: commit in it
614
sub_tree = WorkingTree.open(self.work_tree.abspath(path))
615
# FIXME: be more comprehensive here:
616
# this works when both trees are in --trees repository,
617
# but when both are bound to a different repository,
618
# it fails; a better way of approaching this is to
619
# finally implement the explicit-caches approach design
620
# a while back - RBC 20070306.
621
if (sub_tree.branch.repository.bzrdir.root_transport.base
623
self.work_tree.branch.repository.bzrdir.root_transport.base):
624
sub_tree.branch.repository = \
625
self.work_tree.branch.repository
627
sub_tree.commit(message=None, revprops=self.revprops,
628
recursive=self.recursive,
629
message_callback=self.message_callback,
630
timestamp=self.timestamp, timezone=self.timezone,
631
committer=self.committer,
632
allow_pointless=self.allow_pointless,
633
strict=self.strict, verbose=self.verbose,
634
local=self.local, reporter=self.reporter)
635
except errors.PointlessCommit:
591
637
if kind != new_ie.kind:
592
638
new_ie = inventory.make_entry(kind, new_ie.name,
593
639
new_ie.parent_id, file_id)