/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

Merge commit builder changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
                           ConflictsInTree,
69
69
                           StrictCommitFailed
70
70
                           )
71
 
from bzrlib.osutils import (kind_marker, isdir,isfile, is_inside_any,
 
71
from bzrlib.osutils import (get_user_encoding,
 
72
                            kind_marker, isdir,isfile, is_inside_any,
72
73
                            is_inside_or_parent_of_any,
73
74
                            minimum_path_selection,
74
75
                            quotefn, sha_file, split_lines,
76
77
                            )
77
78
from bzrlib.testament import Testament
78
79
from bzrlib.trace import mutter, note, warning, is_quiet
79
 
from bzrlib.xml5 import serializer_v5
80
80
from bzrlib.inventory import InventoryEntry, make_entry
81
81
from bzrlib import symbol_versioning
82
82
from bzrlib.symbol_versioning import (deprecated_passed,
250
250
        if message_callback is None:
251
251
            if message is not None:
252
252
                if isinstance(message, str):
253
 
                    message = message.decode(bzrlib.user_encoding)
 
253
                    message = message.decode(get_user_encoding())
254
254
                message_callback = lambda x: message
255
255
            else:
256
256
                raise BzrError("The message or message_callback keyword"
283
283
        self.committer = committer
284
284
        self.strict = strict
285
285
        self.verbose = verbose
286
 
        # accumulates an inventory delta to the basis entry, so we can make
287
 
        # just the necessary updates to the workingtree's cached basis.
288
 
        self._basis_delta = []
289
286
 
290
287
        self.work_tree.lock_write()
291
288
        self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
355
352
                self.config, timestamp, timezone, committer, revprops, rev_id)
356
353
            
357
354
            try:
 
355
                self.builder.recording_deletes()
358
356
                # find the location being committed to
359
357
                if self.bound_branch:
360
358
                    master_location = self.master_branch.base
409
407
            # Make the working tree up to date with the branch
410
408
            self._set_progress_stage("Updating the working tree")
411
409
            self.work_tree.update_basis_by_delta(self.rev_id,
412
 
                 self._basis_delta)
 
410
                 self.builder.basis_delta)
413
411
            self.reporter.completed(new_revno, self.rev_id)
414
412
            self._process_post_hooks(old_revno, new_revno)
415
413
        finally:
428
426
        # A merge with no effect on files
429
427
        if len(self.parents) > 1:
430
428
            return
431
 
        # TODO: we could simplify this by using self._basis_delta.
 
429
        # TODO: we could simplify this by using self.builder.basis_delta.
432
430
 
433
431
        # The initial commit adds a root directory, but this in itself is not
434
432
        # a worthwhile commit.
690
688
                # required after that changes.
691
689
                if len(self.parents) > 1:
692
690
                    ie.revision = None
693
 
                delta, version_recorded = self.builder.record_entry_contents(
 
691
                _, version_recorded, _ = self.builder.record_entry_contents(
694
692
                    ie, self.parent_invs, path, self.basis_tree, None)
695
693
                if version_recorded:
696
694
                    self.any_entries_changed = True
697
 
                if delta: self._basis_delta.append(delta)
698
695
 
699
696
    def _report_and_accumulate_deletes(self):
700
697
        # XXX: Could the list of deleted paths and ids be instead taken from
708
705
            deleted.sort()
709
706
            # XXX: this is not quite directory-order sorting
710
707
            for path, file_id in deleted:
711
 
                self._basis_delta.append((path, None, file_id, None))
 
708
                self.builder.record_delete(path, file_id)
712
709
                self.reporter.deleted(path)
713
710
 
714
711
    def _populate_from_inventory(self):
843
840
        else:
844
841
            ie = existing_ie.copy()
845
842
            ie.revision = None
846
 
        delta, version_recorded = self.builder.record_entry_contents(ie,
847
 
            self.parent_invs, path, self.work_tree, content_summary)
848
 
        if delta:
849
 
            self._basis_delta.append(delta)
 
843
        # For carried over entries we don't care about the fs hash - the repo
 
844
        # isn't generating a sha, so we're not saving computation time.
 
845
        _, version_recorded, fs_hash = self.builder.record_entry_contents(
 
846
            ie, self.parent_invs, path, self.work_tree, content_summary)
850
847
        if version_recorded:
851
848
            self.any_entries_changed = True
852
849
        if report_changes:
853
850
            self._report_change(ie, path)
 
851
        if fs_hash:
 
852
            self.work_tree._observed_sha1(ie.file_id, path, fs_hash)
854
853
        return ie
855
854
 
856
855
    def _report_change(self, ie, path):