Page MenuHomePhabricator

Redirect gerrit repo URIs to diffusion callsigns.
ClosedPublic

Authored by mmodell on Nov 16 2015, 10:06 AM.

Details

Maniphest Tasks
T110607: redirect gerrit repo paths to diffusion callsigns
Reviewers
chasemp
demon
Commits
rPHEX34e5e748c6af: Redirect gerrit repo URIs to diffusion callsigns.
Patch without arc
git checkout -b D51 && curl -L https://phabricator.wikimedia.org/D51?download=true | git apply
Summary

Redirect from gerrit project URI path, e.g.:

From:

https://phabricator.wikimedia.org/r/phabricator/extensions/

To:

https://phabricator.wikimedia.org/diffusion/PHEX/

This allows external tools to link to repos without knowing their callsign.

Test Plan

install extension files in /srv/phab/phabricator/src/extensions
Then attempt to visit a url like the one above.

Diff Detail

Repository
rPHEX phabricator-extensions
Branch
GerritProjectRedirect
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 197
Build 249: arc lint + arc unit

Event Timeline

mmodell updated this revision to Diff 161.Nov 16 2015, 10:06 AM
mmodell retitled this revision from to Redirect gerrit repo URIs to diffusion callsigns..
mmodell updated this object.
mmodell edited the test plan for this revision. (Show Details)
mmodell added reviewers: demon, chasemp.
Paladox added a subscriber: Paladox.EditedNov 16 2015, 11:08 AM

What about also allowing the link to look like

https://phabricator.wikimedia.org/r/mediawiki/extensions/

And

https://phabricator.wikimedia.org/mediawiki/extensions/

And so on

Looking at the diff I think this is for the url to look like gerrit. I think for viewing the repos should look like this too redirecting links

demon edited edge metadata.Nov 16 2015, 5:30 PM
In D51#1252, @Paladox wrote:

What about also allowing the link to look like
https://phabricator.wikimedia.org/r/mediawiki/extensions/

Mukunda will have to answer for this one, I wouldn't mind using /r/ for repo paths, but I'll let him answer.

And
https://phabricator.wikimedia.org/mediawiki/extensions/
And so on

No, we don't want to overload the domain root to potentially conflict with future Phabricator applications.

Looking at the diff I think this is for the url to look like gerrit. I think for viewing the repos should look like this too redirecting links

No, the URLs aren't meant to look like Gerrit. They're meant to just exist as URLs with similar foo/bar/baz repo paths so we can redirect old Gitblit/Gerrit URLs to Phabricator properly. They're not meant to be used as links or accessed directly, really, so there's no requirement for them to be pretty or memorable.

demon added a comment.Nov 16 2015, 8:15 PM

Lgtm, can we test it out on iridium? Just wanna see it in action before accepting.

@demon I just set it up on phab-01: https://phab-01.wmflabs.org/r/phabricator/phabricator

(none of the other repos will redirect to a working repo, since the others aren't set up on phab-01, but they should all redirect to the correct callsign url)

demon requested changes to this revision.Nov 17 2015, 8:20 PM
demon edited edge metadata.

Per IRC, we need to make sure we support at least the URL patterns outlined in:

1[gitweb]
2 url = https://git.wikimedia.org
3 type = custom
4 revision = /commit/${project}/${commit}
5 project = /summary/${project}
6 branch = /log/${project}/${branch}
7 filehistory = /blob/${project}/${branch}/${file}
8 linkname = gitblit
9 linkDrafts = false

This revision now requires changes to proceed.Nov 17 2015, 8:20 PM
In D51#1278, @demon wrote:

Per IRC, we need to make sure we support at least the URL patterns outlined in:

1[gitweb]
2 url = https://git.wikimedia.org
3 type = custom
4 revision = /commit/${project}/${commit}
5 project = /summary/${project}
6 branch = /log/${project}/${branch}
7 filehistory = /blob/${project}/${branch}/${file}
8 linkname = gitblit
9 linkDrafts = false

Can those patterns be changed to pass query parameters? it'd be cleaner to parse the urls if project was delimited by something other than a slash, since it has slashes in the project path.

Example:

[gitweb]
    url = https://git.wikimedia.org
    type = custom
    revision = /r/commit/${commit}?project=${project}
    project = /r/${project}
    branch = /r/browse/${branch}?project=${project}
    filehistory = /r/browse/${branch}/${file}?project=${project}
    linkname = gitblit
    linkDrafts = false
demon added a comment.Nov 18 2015, 7:12 PM

Yeah I don't know why not.

demon accepted this revision.Nov 23 2015, 11:02 PM
demon edited edge metadata.

Per discussion earlier, this is fine as is. We'll implement the other requirements as patches on top of this instead of waiting.

This revision is now accepted and ready to land.Nov 23 2015, 11:02 PM
mmodell closed this revision.Nov 23 2015, 11:49 PM

It hasn't merged yet.