209
209
:param timestamp: if not None, seconds-since-epoch for a
210
210
postdated/predated commit.
212
:param specific_files: If not None, commit only those files. An empty
213
list means 'commit no files'.
212
:param specific_files: If true, commit only those files.
215
214
:param rev_id: If set, use this as the new revision id.
216
215
Useful for test or import commands that need to tightly
265
264
self.master_locked = False
266
265
self.recursive = recursive
267
266
self.rev_id = None
268
# self.specific_files is None to indicate no filter, or any iterable to
269
# indicate a filter - [] means no files at all, as per iter_changes.
270
267
if specific_files is not None:
271
268
self.specific_files = sorted(
272
269
minimum_path_selection(specific_files))
288
285
# the command line parameters, and the repository has fast delta
289
286
# generation. See bug 347649.
290
287
self.use_record_iter_changes = (
288
not self.specific_files and
291
289
not self.exclude and
292
290
not self.branch.repository._format.supports_tree_reference and
293
291
(self.branch.repository._format.fast_deltas or
335
333
self._gather_parents()
336
334
# After a merge, a selected file commit is not supported.
337
335
# See 'bzr help merge' for an explanation as to why.
338
if len(self.parents) > 1 and self.specific_files is not None:
336
if len(self.parents) > 1 and self.specific_files:
339
337
raise errors.CannotCommitSelectedFileMerge(self.specific_files)
340
338
# Excludes are a form of selected file commit.
341
339
if len(self.parents) > 1 and self.exclude:
621
619
"""Update the commit builder with the data about what has changed.
623
621
exclude = self.exclude
624
specific_files = self.specific_files
622
specific_files = self.specific_files or []
625
623
mutter("Selecting files for commit with filter %s", specific_files)
627
625
self._check_strict()
628
626
if self.use_record_iter_changes:
629
iter_changes = self.work_tree.iter_changes(self.basis_tree,
630
specific_files=specific_files)
627
iter_changes = self.work_tree.iter_changes(self.basis_tree)
631
628
iter_changes = self._filter_iter_changes(iter_changes)
632
629
for file_id, path, fs_hash in self.builder.record_iter_changes(
633
630
self.work_tree, self.basis_revid, iter_changes):
805
802
# _update_builder_with_changes.
807
804
content_summary = self.work_tree.path_content_summary(path)
808
kind = content_summary[0]
809
805
# Note that when a filter of specific files is given, we must only
810
806
# skip/record deleted files matching that filter.
811
807
if not specific_files or is_inside_any(specific_files, path):
812
if kind == 'missing':
808
if content_summary[0] == 'missing':
813
809
if not deleted_paths:
814
810
# path won't have been split yet.
815
811
path_segments = splitpath(path)
823
819
# TODO: have the builder do the nested commit just-in-time IF and
824
820
# only if needed.
825
if kind == 'tree-reference':
821
if content_summary[0] == 'tree-reference':
826
822
# enforce repository nested tree policy.
827
823
if (not self.work_tree.supports_tree_reference() or
828
824
# repository does not support it either.
829
825
not self.branch.repository._format.supports_tree_reference):
831
content_summary = (kind, None, None, None)
832
elif self.recursive == 'down':
826
content_summary = ('directory',) + content_summary[1:]
827
kind = content_summary[0]
828
# TODO: specific_files filtering before nested tree processing
829
if kind == 'tree-reference':
830
if self.recursive == 'down':
833
831
nested_revision_id = self._commit_nested_tree(
835
content_summary = (kind, None, None, nested_revision_id)
833
content_summary = content_summary[:3] + (
837
nested_revision_id = self.work_tree.get_reference_revision(file_id)
838
content_summary = (kind, None, None, nested_revision_id)
836
content_summary = content_summary[:3] + (
837
self.work_tree.get_reference_revision(file_id),)
840
839
# Record an entry for this item
841
840
# Note: I don't particularly want to have the existing_ie