Rev 3778: Delegate basis inventory calculation during commit to the CommitBuilder object. in http://people.ubuntu.com/~robertc/baz2.0/commit-delta
Robert Collins
robertc at robertcollins.net
Mon Oct 13 05:43:35 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/commit-delta
------------------------------------------------------------
revno: 3778
revision-id: robertc at robertcollins.net-20081013044331-ibghe8j4no7uhb55
parent: robertc at robertcollins.net-20081013043229-dn4s7hfg6h6zcobm
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit-delta
timestamp: Mon 2008-10-13 15:43:31 +1100
message:
Delegate basis inventory calculation during commit to the CommitBuilder object.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
=== modified file 'NEWS'
--- a/NEWS 2008-10-13 04:32:29 +0000
+++ b/NEWS 2008-10-13 04:43:31 +0000
@@ -23,6 +23,13 @@
and additionally call ``builder.record_delete`` when a delete
against the basis occurs. (Robert Collins)
+ API CHANGES:
+
+ * The logic in commit now delegates inventory basis calculations to
+ the ``CommitBuilder`` object; this requires that the commit builder
+ in use has been updated to support the new ``recording_deletes`` and
+ ``record_delete`` methods. (Robert Collins)
+
bzr 1.8rc1 2008-10-07
---------------------
=== modified file 'bzrlib/__init__.py'
--- a/bzrlib/__init__.py 2008-10-07 10:00:40 +0000
+++ b/bzrlib/__init__.py 2008-10-13 04:43:31 +0000
@@ -54,7 +54,7 @@
# API compatibility version: bzrlib is currently API compatible with 1.7.
-api_minimum_version = (1, 7, 0)
+api_minimum_version = (1, 9, 0)
def _format_version_tuple(version_info):
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py 2008-10-01 05:40:45 +0000
+++ b/bzrlib/commit.py 2008-10-13 04:43:31 +0000
@@ -283,9 +283,6 @@
self.committer = committer
self.strict = strict
self.verbose = verbose
- # accumulates an inventory delta to the basis entry, so we can make
- # just the necessary updates to the workingtree's cached basis.
- self._basis_delta = []
self.work_tree.lock_write()
self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
@@ -355,6 +352,7 @@
self.config, timestamp, timezone, committer, revprops, rev_id)
try:
+ self.builder.recording_deletes()
# find the location being committed to
if self.bound_branch:
master_location = self.master_branch.base
@@ -409,7 +407,7 @@
# Make the working tree up to date with the branch
self._set_progress_stage("Updating the working tree")
self.work_tree.update_basis_by_delta(self.rev_id,
- self._basis_delta)
+ self.builder.basis_delta)
self.reporter.completed(new_revno, self.rev_id)
self._process_post_hooks(old_revno, new_revno)
finally:
@@ -428,7 +426,7 @@
# A merge with no effect on files
if len(self.parents) > 1:
return
- # TODO: we could simplify this by using self._basis_delta.
+ # TODO: we could simplify this by using self.builder.basis_delta.
# The initial commit adds a root directory, but this in itself is not
# a worthwhile commit.
@@ -690,12 +688,10 @@
# required after that changes.
if len(self.parents) > 1:
ie.revision = None
- delta, version_recorded, _ = self.builder.record_entry_contents(
+ _, version_recorded, _ = self.builder.record_entry_contents(
ie, self.parent_invs, path, self.basis_tree, None)
if version_recorded:
self.any_entries_changed = True
- if delta:
- self._basis_delta.append(delta)
def _report_and_accumulate_deletes(self):
# XXX: Could the list of deleted paths and ids be instead taken from
@@ -709,7 +705,7 @@
deleted.sort()
# XXX: this is not quite directory-order sorting
for path, file_id in deleted:
- self._basis_delta.append((path, None, file_id, None))
+ self.builder.record_delete(path, file_id)
self.reporter.deleted(path)
def _populate_from_inventory(self):
@@ -846,10 +842,8 @@
ie.revision = None
# For carried over entries we don't care about the fs hash - the repo
# isn't generating a sha, so we're not saving computation time.
- delta, version_recorded, fs_hash = self.builder.record_entry_contents(
+ _, version_recorded, fs_hash = self.builder.record_entry_contents(
ie, self.parent_invs, path, self.work_tree, content_summary)
- if delta:
- self._basis_delta.append(delta)
if version_recorded:
self.any_entries_changed = True
if report_changes:
More information about the bazaar-commits
mailing list