[MERGE] Refactor diffing
Robert Collins
robertc at robertcollins.net
Fri Nov 23 23:47:16 GMT 2007
On Fri, 2007-11-23 at 18:19 -0500, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Robert Collins wrote:
> > So, this patch goes a long way towards fixing the bug, but its not fixed
> > yet :).
>
> Hey, if I can run diff against PreviewTree, which has no inventory, how
> can you say diff uses inventory?
Well, 'the diff code does not use inventory', but 'bzr diff triggers
inventory creation', which is what that bug talks about is still
true :).
> > def id2path(self, file_id):
> > "Convert a file-id to a path."
>
> > That should do it and pass the interface tests.
>
> Thanks.
>
> Unfortunately, Dirstate.inventory is also used by DirState.kind and
> DirState.get_file_lines.
def kind(self, file_id,
_kind_map=dirstate.DirState._minikind_to_kind):
"Get the kind of a file-id."
entry = self._get_entry(file_id=file_id)
if entry == (None, None):
raise errors.NoSuchId(tree=self, file_id=file_id)
parent_index = self._get_parent_index()
# you will need to ens
return _kind_map[entry[1][parent_index][0]]
def get_file_lines(self, file_id):
"""Get the contents of file_id."""
entry = self._get_entry(file_id=file_id)
if entry == (None, None):
raise errors.NoSuchId(tree=self, file_id=file_id)
parent_index = self._get_parent_index()
tree_entry = entry[1][parent_index]
assert tree_entry[0] == 'f', "Not a regular file %s" % file_id
return self._get_weave(file_id).get_lines(tree_entry[4])
Cheers,
Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20071124/bdf6c240/attachment.pgp
More information about the bazaar
mailing list