Rev 3807: Trivial review feedback. in http://people.ubuntu.com/~robertc/baz2.0/commit-iterchanges
Robert Collins
robertc at robertcollins.net
Mon Mar 23 01:48:10 GMT 2009
At http://people.ubuntu.com/~robertc/baz2.0/commit-iterchanges
------------------------------------------------------------
revno: 3807
revision-id: robertc at robertcollins.net-20090323014800-43ge9jejqtozagh3
parent: robertc at robertcollins.net-20090323000154-tz8xscseuh59ox1i
committer: Robert Collins <robertc at robertcollins.net>
branch nick: commit-iterchanges
timestamp: Mon 2009-03-23 12:48:00 +1100
message:
Trivial review feedback.
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2009-03-23 00:01:54 +0000
+++ b/bzrlib/inventory.py 2009-03-23 01:48:00 +0000
@@ -1001,24 +1001,6 @@
child_dirs.append((child_relpath+'/', child_ie))
stack.extend(reversed(child_dirs))
- def make_delta(self, old):
- """Make an inventory delta from two inventories."""
- old_ids = set(old)
- new_ids = set(self)
- adds = new_ids - old_ids
- deletes = old_ids - new_ids
- common = old_ids.intersection(new_ids)
- delta = []
- for file_id in deletes:
- delta.append((old.id2path(file_id), None, file_id, None))
- for file_id in adds:
- delta.append((None, self.id2path(file_id), file_id, self[file_id]))
- for file_id in common:
- if old[file_id] != self[file_id]:
- delta.append((old.id2path(file_id), self.id2path(file_id),
- file_id, self[file_id]))
- return delta
-
def make_entry(self, kind, name, parent_id, file_id=None):
"""Simple thunk to bzrlib.inventory.make_entry."""
return make_entry(kind, name, parent_id, file_id)
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2009-03-23 00:01:54 +0000
+++ b/bzrlib/repository.py 2009-03-23 01:48:00 +0000
@@ -574,7 +574,7 @@
# file_id -> change map, change is fileid, paths, changed, versioneds,
# parents, names, kinds, executables
merged_ids = {}
- # file_id -> revision_id -> inventory entry, for entries in parent
+ # {file_id -> revision_id -> inventory entry, for entries in parent
# trees that are not parents[0]
parent_entries = {}
revtrees = list(self.repository.revision_trees(self.parents))
@@ -584,20 +584,19 @@
else:
basis_inv = self.repository.revision_tree(
_mod_revision.NULL_REVISION).inventory
- if len(self.parents) > 1:
+ if len(self.parents) > 0:
if basis_revision_id != self.parents[0]:
raise Exception(
"arbitrary basis parents not yet supported with merges")
- repo_basis = revtrees[0]
for revtree in revtrees[1:]:
- for change in revtree.inventory.make_delta(basis_inv):
+ for change in revtree.inventory._make_delta(basis_inv):
if change[1] is None:
- # Deleted
+ # Not present in this parent.
continue
if change[2] not in merged_ids:
if change[0] is not None:
merged_ids[change[2]] = [
- repo_basis.inventory[change[2]].revision,
+ basis_inv[change[2]].revision,
change[3].revision]
else:
merged_ids[change[2]] = [change[3].revision]
@@ -608,6 +607,7 @@
else:
merged_ids = {}
# Setup the changes from the tree:
+ # changes maps file_id -> (change, [parent revision_ids])
changes= {}
for change in iter_changes:
# This probably looks up in basis_inv way to much.
@@ -631,7 +631,7 @@
# inv delta change: (file_id, (path_in_source, path_in_target),
# changed_content, versioned, parent, name, kind,
# executable)
- basis_entry = repo_basis.inventory[file_id]
+ basis_entry = basis_inv[file_id]
change = (file_id,
(basis_inv.id2path(file_id), tree.id2path(file_id)),
False, (True, True),
More information about the bazaar-commits
mailing list