[MERGE][bug #6700] diff on branches without working trees

Ian Clatworthy ian.clatworthy at internode.on.net
Tue Nov 20 03:12:06 GMT 2007


Aaron Bentley wrote:

> I'm not really comfortable with the way you're mixing branches and files
> in the same argument set.  To me, it seems like if we don't name the
> file as part of the branch (e.g.
> http://bazaar-vcs.org/bzr/bzr.dev/Makefile), we should have some way of
> delimiting files from branches.  Ideally, whatever syntax we use here
> should also apply to other commands like status, merge and revert, and
> this one doesn't.
> 
> One of the reasons why I've never tackled this is that diff is a window
> into everything that's wrong with our argument handling:
> 1. No generic way of specifying multiple branches, and associating
> multiple files with each branch
> 
> 2. Trees and branches are too disconnected; Time and time again, I find
> myself needing a branch-and-tree pair.  This was especially true with
> Nested Trees.
> 
> I just find all the issues a bit overwhelming, so I never start.  You'll
> see what I mean as you get into the review.  Don't take it personally--
> it's just really hard to support all the functionality we want.

The argument handling issue is key to this, I agree. It was one of the
reasons I blocked on it for so long months ago. Thanks for the review
and feedback. Promise not to take it personally.

I'm happy to propose or listen to various syntax options. It gets easier
if we're happy to drop compatibility with existing usage where:

* "bzr diff file1 dir2" filters the diff for just those files
* "bzr diff tree1 tree2" compares two working trees.

One possibility is to use a 'separator symbol' within the argument list
before which are the files and after which are the branches. For
example, if '--' were selected as the separator:

* diff just files: bzr diff file1 dir1
* diff trees: bzr diff -- tree1 tree2
* diff files across trees: bzr diff file dir1 -- tree1 tree2

Another option is to mark trees using a prefix like @, e.g.

* diff just files: bzr diff file1 dir1
* diff trees: bzr diff @tree1 @tree2
* diff files across trees: bzr diff file dir1 @tree1 @tree2

The prefix approach means things can be more freely mixed but stuffs up
file completion for example. For that reason, I prefer the separator
approach. I think it would work ok for several other commands (status,
revert) that already take a file list. Not so sure about commands that
take a branch currently and want a file mask though. Perhaps we could
follow the same pattern for them but assume branches, not files, if --
is not found ,say.

Do you have any preference or other suggestions? I'm not fixed on -- as
the separate BTW, '::' or '+' or '@' or whatever would work as well I think.

> It would also be nice to support diffing arbitrary files within multiple
> trees.

My expectation is that diffing a renamed file across two trees ought to
work (hmm - we ought to clearly document whether the old name or new
name ought to be given in that case). Do you have something in mind
separate to that that is best handled by bzr vs normal diff tools?

Ian C.




More information about the bazaar mailing list