Rev 3770: Mega-hack; hook in a nasty iter_changes based on CHKInventory. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Thu Nov 13 04:06:32 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 3770
revision-id: robertc at robertcollins.net-20081113040626-s65f050j1is2nxt7
parent: robertc at robertcollins.net-20081113034955-itzi7mvzhqkml36w
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Thu 2008-11-13 15:06:26 +1100
message:
Mega-hack; hook in a nasty iter_changes based on CHKInventory.
modified:
bzrlib/chk_map.py chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py 2008-11-13 03:20:56 +0000
+++ b/bzrlib/chk_map.py 2008-11-13 04:06:26 +0000
@@ -213,7 +213,6 @@
if check_excluded(path):
continue
node = self._get_node(node)
- excluded_keys.add(node._key)
if type(node) == str:
# a value
yield (tuple(prefix.split('\x00')), None, node)
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2008-11-13 03:49:55 +0000
+++ b/bzrlib/inventory.py 2008-11-13 04:06:26 +0000
@@ -1468,7 +1468,7 @@
try:
ie = self[file_id]
except KeyError:
- raise errors.NoSuchId(tree=None, file_id=file_id)
+ raise errors.NoSuchId(tree=self, file_id=file_id)
yield ie
file_id = ie.parent_id
@@ -1490,39 +1490,56 @@
for key, basis_value, self_value in \
self.id_to_entry.iter_changes(basis.id_to_entry):
file_id = key[0]
- path_in_source = basis.id2path(file_id)
- path_in_target = self.id2path(file_id)
if basis_value is not None:
basis_entry = basis._bytes_to_entry(basis_value)
+ path_in_source = basis.id2path(file_id)
+ basis_parent = basis_entry.parent_id
+ basis_name = basis_entry.name
+ basis_executable = basis_entry.executable
+ else:
+ path_in_source = None
+ basis_parent = None
+ basis_name = None
+ basis_executable = None
if self_value is not None:
self_entry = self._bytes_to_entry(self_value)
+ path_in_target = self.id2path(file_id)
+ self_parent = self_entry.parent_id
+ self_name = self_entry.name
+ self_executable = self_entry.executable
+ else:
+ path_in_target = None
+ self_parent = None
+ self_name = None
+ self_executable = None
if basis_value is None:
# add
kind = (None, self_entry.kind)
versioned = (False, True)
- if self_value is None:
+ elif self_value is None:
# delete
kind = (basis_entry.kind, None)
versioned = (True, False)
else:
kind = (basis_entry.kind, self_entry.kind)
versioned = (True, True)
+ changed_content = False
if kind[0] != kind[1]:
changed_content = True
elif kind[0] == 'file':
if (self_entry.text_size != basis_entry.text_size or
self_entry.text_sha1 != basis_entry.text_sha1):
changed_content = True
- elif kind[1] == 'symlink':
+ elif kind[0] == 'symlink':
if self_entry.symlink_target != basis_entry.symlink_target:
changed_content = True
- elif kind[2] == 'tree-reference':
+ elif kind[0] == 'tree-reference':
if (self_entry.reference_revision !=
basis_entry.reference_revision):
changed_content = True
- parent = (basis_entry.parent_id, self_entry.parent_id)
- name = (basis_entry.name, self_entry.name)
- executable = (basis_entry.executable, self_entry.executable)
+ parent = (basis_parent, self_parent)
+ name = (basis_name, self_name)
+ executable = (basis_executable, self_executable)
yield (file_id, (path_in_source, path_in_target), changed_content,
versioned, parent, name, kind, executable)
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2008-11-13 03:49:55 +0000
+++ b/bzrlib/tree.py 2008-11-13 04:06:26 +0000
@@ -860,6 +860,17 @@
all_unversioned = deque(all_unversioned)
else:
all_unversioned = deque()
+ # XXX: Ugly hack - testing only, really want a separate inter? or
+ # perhaps helpers and split this function up?
+ try:
+ self.source.inventory.id_to_entry
+ self.target.inventory.id_to_entry
+ except:
+ pass
+ else:
+ for result in self.target.inventory.iter_changes(self.source.inventory):
+ yield result
+ return
to_paths = {}
from_entries_by_dir = list(self.source.iter_entries_by_dir(
specific_file_ids=specific_file_ids))
More information about the bazaar-commits
mailing list