[MERGE] Refactor diffing
Robert Collins
robertc at robertcollins.net
Wed Nov 21 20:39:21 GMT 2007
On Wed, 2007-11-21 at 15:34 -0500, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Robert Collins wrote:
> > I think this is fine as it stands. However I have a proposal about the
> > hooking in of diff that I'd like you to consider.
> >
> > The use case is to make it possible for external plugins to do things
> > like 'diff gpg keys only'
> >
> > So I'd like to suggest that you need to classes:
>
> Took me ages to figure out you meant "two classes".
oops
> > TreeDiffer - a command object
> > - show_diff
> > - from_trees_options
> > - has a new select_diff(file_id, old_path, new_path, old_label,
> > new_label) method which returns a Differ instance to use.
> >
> > Diff(object):
> > """"Base class for diff operations between files."""
> >
> > - has a single public diff method() which returns a result
> > unchanged/changed/could-not-handle
>
> It's an interesting goal, but this approach doesn't seem fully-formed to me:
> - - How does select_diff decide which Differ to use?
for differ in self._differs:
result = differ.diff(file_id, ...)
if result != CANNOT_DIFF:
break
> - - What happens if select_diff picks a Differ that returns
> could-not-handle? How do we get to the next candidate differ? It
> seems simpler to just run call Differ.diff until we find a differ than
> can handle it.
yah, in actual fact I changed my mind half way through my mail; which
must have added confusion - select_diff was a LBYL which I decided
against in the latter part of the mail.
> - - How would you handle kind changes?
KindChangedDiff coming after BinaryDiff.
-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/20071122/8f010ac6/attachment.pgp
More information about the bazaar
mailing list