Rev 2931: (robertc) Minor tweaks to commit to reduce the dependence on inventories. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Oct 24 02:05:22 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2931
revision-id: pqm at pqm.ubuntu.com-20071024010521-24bf7muf0r4r5bp9
parent: pqm at pqm.ubuntu.com-20071023230126-g4h0l6g1dz8e3d57
parent: robertc at robertcollins.net-20071024001931-d080vqc683qdsvvp
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-10-24 02:05:21 +0100
message:
(robertc) Minor tweaks to commit to reduce the dependence on inventories. (Robert Collins)
modified:
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
------------------------------------------------------------
revno: 2921.4.7
merged: robertc at robertcollins.net-20071024001931-d080vqc683qdsvvp
parent: robertc at robertcollins.net-20071023071720-43qn6f048dvn95ew
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit
timestamp: Wed 2007-10-24 10:19:31 +1000
message:
Correct the check_pointless change to pass all tests.
------------------------------------------------------------
revno: 2921.4.6
merged: robertc at robertcollins.net-20071023071720-43qn6f048dvn95ew
parent: robertc at robertcollins.net-20071022224454-mq7ff0qe7evdupb0
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit
timestamp: Tue 2007-10-23 17:17:20 +1000
message:
Typos found by Rob Weir.
------------------------------------------------------------
revno: 2921.4.5
merged: robertc at robertcollins.net-20071022224454-mq7ff0qe7evdupb0
parent: robertc at robertcollins.net-20071022214256-r19wm0qutqjezc21
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit
timestamp: Tue 2007-10-23 08:44:54 +1000
message:
Remove an unnecessary assertion.
------------------------------------------------------------
revno: 2921.4.4
merged: robertc at robertcollins.net-20071022214256-r19wm0qutqjezc21
parent: robertc at robertcollins.net-20071022213824-guihq55zholcyqgj
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit
timestamp: Tue 2007-10-23 07:42:56 +1000
message:
Minor import cleanup in commit.py.
------------------------------------------------------------
revno: 2921.4.3
merged: robertc at robertcollins.net-20071022213824-guihq55zholcyqgj
parent: robertc at robertcollins.net-20071022212902-tpiqbukqzen5lsg4
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit
timestamp: Tue 2007-10-23 07:38:24 +1000
message:
Remove more basis inventory usage.
------------------------------------------------------------
revno: 2921.4.2
merged: robertc at robertcollins.net-20071022212902-tpiqbukqzen5lsg4
parent: robertc at robertcollins.net-20071022212521-wac62k68k3quy6om
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit
timestamp: Tue 2007-10-23 07:29:02 +1000
message:
Remove unneeded shortcut in commit's check_pointless logic.
------------------------------------------------------------
revno: 2921.4.1
merged: robertc at robertcollins.net-20071022212521-wac62k68k3quy6om
parent: pqm at pqm.ubuntu.com-20071019201226-6z006xotgfe7zmu8
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit
timestamp: Tue 2007-10-23 07:25:21 +1000
message:
During commit check for the first commit by NULL_REVISION rather than a completely empty basis tree, removing one use of the basis inventory.
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py 2007-10-15 05:02:05 +0000
+++ b/bzrlib/commit.py 2007-10-24 00:19:31 +0000
@@ -16,7 +16,7 @@
# The newly committed revision is going to have a shape corresponding
-# to that of the working inventory. Files that are not in the
+# to that of the working tree. Files that are not in the
# working tree and that were in the predecessor are reported as
# removed --- this can include files that were either removed from the
# inventory or deleted in the working tree. If they were only
@@ -25,7 +25,7 @@
# We then consider the remaining entries, which will be in the new
# version. Directory entries are simply copied across. File entries
# must be checked to see if a new version of the file should be
-# recorded. For each parent revision inventory, we check to see what
+# recorded. For each parent revision tree, we check to see what
# version of the file was present. If the file was present in at
# least one tree, and if it was the same version in all the trees,
# then we can just refer to that version. Otherwise, a new version
@@ -59,7 +59,7 @@
from bzrlib import (
debug,
errors,
- inventory,
+ revision,
tree,
)
from bzrlib.branch import Branch
@@ -75,7 +75,7 @@
from bzrlib.testament import Testament
from bzrlib.trace import mutter, note, warning, is_quiet
from bzrlib.xml5 import serializer_v5
-from bzrlib.inventory import Inventory, InventoryEntry
+from bzrlib.inventory import InventoryEntry, make_entry
from bzrlib import symbol_versioning
from bzrlib.symbol_versioning import (deprecated_passed,
deprecated_function,
@@ -269,6 +269,7 @@
self.work_tree.lock_write()
self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
+ self.basis_revid = self.work_tree.last_revision()
self.basis_tree = self.work_tree.basis_tree()
self.basis_tree.lock_read()
try:
@@ -414,18 +415,17 @@
return
# TODO: we could simplify this by using self._basis_delta.
- # The inital commit adds a root directory, but this in itself is not
- # a worthwhile commit.
- if len(self.basis_inv) == 0 and len(self.builder.new_inventory) == 1:
+ # The initial commit adds a root directory, but this in itself is not
+ # a worthwhile commit.
+ if (self.basis_revid == revision.NULL_REVISION and
+ len(self.builder.new_inventory) == 1):
raise PointlessCommit()
- # Shortcut, if the number of entries changes, then we obviously have
- # a change
- if len(self.builder.new_inventory) != len(self.basis_inv):
- return
# If length == 1, then we only have the root entry. Which means
# that there is no real difference (only the root could be different)
- if len(self.builder.new_inventory) != 1 and (self.any_entries_changed
- or self.any_entries_deleted):
+ # unless deletes occured, in which case the length is irrelevant.
+ if (self.any_entries_deleted or
+ (len(self.builder.new_inventory) != 1 and
+ self.any_entries_changed)):
return
raise PointlessCommit()
@@ -686,7 +686,7 @@
set(self.builder.new_inventory._byid.keys())
if deleted_ids:
self.any_entries_deleted = True
- deleted = [(self.basis_inv.id2path(file_id), file_id)
+ deleted = [(self.basis_tree.id2path(file_id), file_id)
for file_id in deleted_ids]
deleted.sort()
# XXX: this is not quite directory-order sorting
@@ -704,9 +704,9 @@
report_changes = self.reporter.is_verbose()
deleted_ids = []
deleted_paths = set()
+ # XXX: Note that entries may have the wrong kind because the entry does
+ # not reflect the status on disk.
work_inv = self.work_tree.inventory
- assert work_inv.root is not None
- # XXX: Note that entries may have the wrong kind.
entries = work_inv.iter_entries_by_dir(
specific_file_ids=self.specific_file_ids, yield_parents=True)
for path, existing_ie in entries:
@@ -794,7 +794,7 @@
# mutter('check %s {%s}', path, file_id)
# mutter('%s selected for commit', path)
if definitely_changed or existing_ie is None:
- ie = inventory.make_entry(kind, name, parent_id, file_id)
+ ie = make_entry(kind, name, parent_id, file_id)
else:
ie = existing_ie.copy()
ie.revision = None
More information about the bazaar-commits
mailing list