Is it possible to link to a gerrit change-id?

3,320 views
Skip to first unread message

Jason Axelson

unread,
Mar 17, 2012, 1:36:45 AM3/17/12
to Repo and Gerrit Discussion
My use-case is that I am trying to setup gitblit to link to a gerrit
change id by parsing it out of the commit message.

Here's the gitblit referece:
http://gitblit.com/properties.html

The reference uses a url like: http://somehost/changeid/$2 but
visiting /changeid on my gerrit server just gives me a 404.

As far as I can tell this is impossible, it looks like you need to
make a query on the ChangeListService to get back the change number in
this Gerrit instance.

So is it possible to link to a gerrit change-id?

Jason

Shawn Pearce

unread,
Mar 17, 2012, 2:54:55 AM3/17/12
to Jason Axelson, Repo and Gerrit Discussion
On Fri, Mar 16, 2012 at 22:36, Jason Axelson <jaxe...@referentia.com> wrote:
> My use-case is that I am trying to setup gitblit to link to a gerrit
> change id by parsing it out of the commit message.
>
> Here's the gitblit referece:
> http://gitblit.com/properties.html
>
> The reference uses a url like: http://somehost/changeid/$2 but
> visiting /changeid on my gerrit server just gives me a 404.

"/#/q/$2,n,z" or "/r/$2" might work.

Edwin Kempin

unread,
Mar 17, 2012, 2:56:11 AM3/17/12
to Jason Axelson, Repo and Gerrit Discussion


2012/3/17 Jason Axelson <jaxe...@referentia.com>
Yes, it is possible. You can make a query using the Change-Id. If there is only one change with this Change-Id it will open automatically. The query parameters can be configured in the URL so that you can link to it, e.g.:
https://gerrit-review.googlesource.com/#/q/I506324d1c34274ba0c7bfb11d4bf5e26afbf6cf5,n,z
 

Jason

--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

Thomas Broyer

unread,
Mar 17, 2012, 8:21:05 AM3/17/12
to repo-d...@googlegroups.com, Jason Axelson


On Saturday, March 17, 2012 7:54:55 AM UTC+1, Shawn Pearce wrote:
On Fri, Mar 16, 2012 at 22:36, Jason Axelson wrote:
> My use-case is that I am trying to setup gitblit to link to a gerrit
> change id by parsing it out of the commit message.
>
> Here's the gitblit referece:
> http://gitblit.com/properties.html
>
> The reference uses a url like: http://somehost/changeid/$2 but
> visiting /changeid on my gerrit server just gives me a 404.

"/#/q/$2,n,z" or "/r/$2" might work.

(er, well, except using a comma instead of the slash after the 'q': #q,$2,n,z)

Jason Axelson

unread,
Mar 19, 2012, 5:26:02 PM3/19/12
to Thomas Broyer, repo-d...@googlegroups.com
Thanks!

Both of these work:
/r/$2
/#/q/$2,n,z

I've decided to go with "/r/$2" since it's simplest and is easier to
migrate off of because it doesn't rely on having client-side
javascript.

On Sat, Mar 17, 2012 at 2:21 AM, Thomas Broyer <t.br...@gmail.com> wrote:
> <snip>


> BTW, that's what's in the examples
> at http://gerrit-documentation.googlecode.com/svn/Documentation/2.3/config-gerrit.html#_a_id_commentlink_a_section_commentlink
> (er, well, except using a comma instead of the slash after the 'q':
> #q,$2,n,z)

Thanks for pointing that out. I did look fairly extensively at the
documentation but I didn't think to look at the section about
configuring gerrit itself. Maybe some sort of specific gerrit url
documentation would be possible to add?

Jason

Reply all
Reply to author
Forward
0 new messages