Page MenuHomePhabricator

Add a link from Phabricator task to a Gerrit search for bug:TXXXXX
Closed, DuplicatePublic

Description

When a patch is send to Gerrit with a header such as Bug: T12345, Gerrit keeps track of the bug tracker and let us search for any change having that bug id. The search query is simply: bug:T12345.

For Phabricator task, maybe we could add a link to the Gerrit search? That will ease finding patches, the URL would be:

https://gerrit.wikimedia.org/r/#/q/bug:T12345

It might be annoying though when no Gerrit change is associated with a task.

Event Timeline

I don't think I understand the use case? If people write bug:T12345 then the patch in Gerrit will be linked from T12345 anyway.
Where to add what exactly?

I thought about a link in the left side bar such as Search Gerrit. Some tasks have lot of patchsets and it is a bit hard to keep track of which are still pending. I then end up manually searching in Gerrit for bug:T12345 when potentially I could just have clicked a link to bring up the search.

Quick'n'dirty'n'unstable user script:

if ((window.location.pathname.split( '/' )[1].charAt(0) == "T") && (document.getElementsByClassName('phui-crumb-name').length > 1)) {
  var taskId = document.getElementsByClassName('phui-crumb-name')[1].innerHTML;
  if ((taskId != null) && (taskId != "")) {
    var place = document.getElementsByClassName("phui-header-header")[0];
    var link = document.createElement('a');
    link.setAttribute('href', "https://gerrit.wikimedia.org/r/#/q/bug:" + taskId);
    link.appendChild(document.createTextNode("[Search for patches in Gerrit]"));
    if(place.nextSibling != null) {
      place.parentNode.insertBefore(link, place.nextSibling);
    }
  }
}

@Aklapper thank you for the js snippet, that is indeed what I had in mind.

Maybe I should fill that as a feature request for pherrit instead.