Get the diff between two remote revisions
Matthieu Moy
Matthieu.Moy at imag.fr
Thu Apr 6 13:04:16 BST 2006
Hi,
This is a question that I've asked multiple times here, but I didn't
get a satisfactory answer.
The simple case: How can I get the diff between, say, revision 42 and
44 in branch http://site.com/path/to/branch? Do I have to create a
local mirror for that?
The general case: Instead of two revisions of the same branch, how can
I get the diff between two arbitrary revisions? For example, revision
42 in /home/me/branch and revision 12 in http://site.com/branch?
I need the simple case to implement a remote branch explorer in DVC [1]:
display a buffer with the list of revisions (roughly, $(bzr log)), and
the user can type '=' on any revision to get the diff between this
revision and the previous one.
In the past, I had proposed to add a revision spec for that, which
would allow something like
bzr diff -r revision:42:/home/me/branch..revision:12:http://site.com/branch
and I even had a draft implementation for that. The advantages were:
* a single string can identify any revision. For DVC, it would make
the code very simple, and it allows shell scripts to do things like
"bzr ... -r ${REVISION}" with REVISION being a string obtained in
various ways.
* It is easily regexp-matchable. For DVC + Gnus [2], I was thinking
about making revision:N:BRANCH clickable (as we do already for
A/c--b--v for GNU Arch).
My implementation was not satisfactory for at least one reason : It
needed to fetch the remote revisions locally, which means that you
couldn't run "bzr diff -r revision:1:/path/..revision:2:/otherpath/"
from outside a branch, and that it would fetch unrelated revisions in
the local branch otherwise. I suppose the work on checkouts allows
something much better, since bzr diff ran in a checkout is already
able to work with a remote branch. (note: the "branch:" revision
specifier still fetches the revisions, but this is arguably a good
thing in this case)
Conceptually, some people didn't like having a notion of branch in a
revision identifier. But first, if we accept this argument, then
"branch:" specifier should be removed, and then, I don't accept this
argument. When I give the location of the file, I don't give only the
filename, I usually include the directory. And I think directories are
containers for files as well as branches are containers for revisions.
Among the other proposed solutions, were:
bzr diff --branch /path/to/branch -r 42 \
--branch http://site.com/branch -r 12
and
bzr diff /path/to/branch,revision=42 \
http://site.com/branch,revision=12
or something like this.
It would be nice if a decision could be taken on this point. If I get
time, I'll work on an implementation.
Thanks,
--
Matthieu
[1] Emacs interface for various RCS including bzr
[2] Mailer/Newsreader for Emacs
More information about the bazaar
mailing list