[MERGE][bug #6700] diff on branches without working trees
Aaron Bentley
aaron.bentley at utoronto.ca
Wed Dec 12 14:04:38 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
bb:approve
Ian Clatworthy wrote:
>>> + if relpath != '':
>>> + specific_files.append(relpath)
>> Is it necessary to avoid appending relpath if blank? If relpath is
>> blank, then the user wants a whole-tree diff, and since diff is
>> recursive, '' will induce a whole-tree diff.
>
> I think this statement is required. Consider:
>
> bzr diff tree/foo --old other_branch
>
> In this case, you only want to diff foo, not ['', foo].
I don't understand how you'd get ['', 'foo'] here. Do you mean that the
'' would come from other_branch?
Are you suggesting that diff tree/foo --old other_branch/bar would
produce ['foo', 'bar']? It seems odd to allow files to be specified as
part of the old/new urls.
>> Using branch.basis_tree() rather than tree.basis_tree is a behavior
>> change.
> Ah. Changed now to use tree.basis_tree instead if tree is not None. Is
> that what you expected?
Yes, exactly.
>>> +def _relative_paths_in_tree(tree, paths):
>>> + """Get the relative paths within a working tree.
>>> +
>>> + All paths must be existing paths in the working tree.
>>> + """
>> We have never required this before, and I don't think we should start.
>
> So the code here came from builtins._internal_tree_files() but the
> docstring was wrong. I've replaced the docstring with the one from
> osutils.relpath (and I've left the code as it was).
>
> I do think conversion to working tree relative paths is generally
> required
I agree. I was only reacting to the docstring.
> unless both an old branch and a new branch are explicitly
> given, either via --old/--new or within the revspecs
Even then, I think you could argue that we should relativize the paths
unless no working tree was present.
> + return rev_branch.repository.revision_tree(revision_id)
^^^ technically, you could try WorkingTree.revision_tree before falling
back to Repository.revision_tree. But that would only accelerate diff
- -r -1, which is rarely used.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHX+p20F+nu1YWqI0RAmx2AKCBNwFdjWCXeUswKxHsL8+WkGf9zQCfdlYC
srR6EdFuEnOefXteL5jzxCg=
=fCzv
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list