On Wed, Jan 11, 2012 at 03:32:57AM -0800, Patrice Bouillet wrote:
> does anybody know if it is possible to diff two different versions of a
> specific merge request? In our project we use the merge request feature
> extensively with many iterations before one will be merged upstream. And as
> the developers squash their work and don't create every time a new commit
> for each iteration (which I like way more), it is quite hard to identify
> the concrete changes and find out if everything is now fitting. I would be
> totally happy if there is a possibility to get all the versions to my local
> repository and compare them on my own. But I currently don't see a way to
> retrieve the different versions. Is there maybe an undocumented feature or
> an extension to the merge request push url?

Patrice,
I didn't notice this question before someone else responded to it,
sorry about that.

As you probably know, a merge request in Gitorious is simply an
invisible branch in the target repository (the repository receiving
the merge request). The current version of a merge request will always
be reflected in the branch `refs/merge-requests/$ID`. Pushing a new
version of a merge request will update this ref, so all the SHAs
pointed to by a merge request will always be available in the target
repository, although not pointed to by a visible ref.

What Gitorious does is to set up an invisible Git repository for each
target repository, and this "tracking repository" will contain a named
ref for each version of a merge request. So if you submit a merge
request which is given the sequence number 133, the target repository
will contain the ref:

  refs/merge-requests/133

and the tracking repository will contain the refs:

  refs/merge-requests/133/1
  refs/merge-requests/133/2

if there are two versions of that merge request; each of these refs
will simply contain a SHA1 pointing to the last commit in that
version. However, the tracking repository is not exposed as refs in
the target repository although the SHA1s should all be there. Since
the current version of a merge request by Git's design should have as
ancestors all commits pointed to by previous versions, pulling down
the SHA1 of each version's HEAD should provide you with the
commits referenced by all the versions of a merge request. What we
don't yet have, though, is an easy way to get hold of these refs.

One thing we could do is to expose the tracking repository through
git, which would let you do something like:

  git ls-remote
  git://gitorious.org/gitorious/mainline-tracking-repo.git

  9bb524c58e350c39ce5e90b1e4c2f7a792f9b9e5      refs/merge-requests/1/1
  2e745c41e3f37fbabe632d0cfa2a8ccfe6bb5724      refs/merge-requests/1/2

And then let you use those SHA1's to do the diff locally. Another
option would be to create endpoints in the web app listing these. What
do you think?

Cheers,
- Marius

-- 
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com

Reply via email to