[MERGE] Refactor diffing
Aaron Bentley
aaron.bentley at utoronto.ca
Wed Nov 21 20:34:14 GMT 2007
-----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".
> 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?
- - 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.
- - How would you handle kind changes?
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHRJZG0F+nu1YWqI0RAuoDAJ9eSn+nAEHk3/4lE/FP6ABeBqaRBACdEXxo
YQ5jq/gUtNJ/cxIxa1jubdM=
=E+oa
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list