Page MenuHomePhabricator

git-review fails with "The requested URL /changes/ was not found on this server."
Closed, ResolvedPublic

Description

Since the switch to debian git-review on the guest box does not work for me:

vagrant@mediawiki-vagrant:/vagrant/mediawiki$ git review -x 348763
Cannot query patchset information
The following command failed with exit code 104
    "GET https://gerrit.wikimedia.org/changes/?q=348763&o=CURRENT_REVISION"
-----------------------
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /changes/ was not found on this server.</p>
</body></html>

-----------------------

https://gerrit.wikimedia.org/changes/?q=348763&o=CURRENT_REVISION does indeed not work; the correct URL seems to be https://gerrit.wikimedia.org/r/changes/?q=348763&o=CURRENT_REVISION

The git-review on my host machine works from the same directory so it seems like some kind of version incompatibility (cf T158479).

Event Timeline

Tgr created this task.Apr 18 2017, 7:13 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 18 2017, 7:13 PM
awight added a subscriber: awight.Jul 25 2017, 6:36 PM

I have this too, with a virtualbox VM created without vagrant. I'm pinned to "experimental" packages.

git-review version 1.25.0

fwiw, downgrading is a decent workaround:

pip install git-review==1.24

We have since started using polygerrit and this wasn't fixed. Maybe it is some nonstandard configuration used by the WMF gerrit instance?

Hi, which version of git-review are you using? this was fixed in git-review 1.6.

Tgr added a comment.May 25 2018, 4:32 PM

As you can see from the comments, this started happening in 1.25.

Change 435192 had a related patch set uploaded (by Paladox; owner: Paladox):
[mediawiki/vagrant@master] Update git-review to 1.26.0

https://gerrit.wikimedia.org/r/435192

I have the same problem on stat1006.

@CCicalese_WMF hi, did you update to git-review 1.26.0?

No, I see it is running 1.25. Will see about upgrading. Thanks.

Tgr added a comment.Nov 15 2018, 9:49 PM

I get the same error with 1.26 and even 1.27 (also without vagrant). The error message is different (ValueError: No JSON object could be decoded and a stack trace) but the issue is the same: request goes to https://gerrit.wikimedia.org/r/p/changes/?q=469878&o=CURRENT_REVISION and that just gets redirected to https://gerrit.wikimedia.org/r/#/q/status%3Aopen+project%3Achanges

@Tgr i guess that means a new bug has been introduced as /p/ means projects.

Tgr added a comment.Nov 15 2018, 10:10 PM

On a closer look this is a problem with Vagrant. git-review (in 1.27 at least) uses git config --get remote.origin.url to get the base URL; admin pages on gerrit currently use https://gerrit.wikimedia.org/r/<project> but Vagrant uses https://gerrit.wikimedia.org/r/p/<project> instead (which is apparently the legacy URL, it does work for git clone but confuses git-review).

Change 473937 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/vagrant@master] Fix git-review

https://gerrit.wikimedia.org/r/473937

Change 473937 merged by jenkins-bot:
[mediawiki/vagrant@master] Fix git-review

https://gerrit.wikimedia.org/r/473937

Tgr closed this task as Resolved.Nov 17 2018, 12:13 AM
Tgr claimed this task.

I'll call this done. (Thanks for the help @Paladox!)

If you have an older Vagrant, you need to pull and reprovision so you get the newest git-review. More problematically (even if you use git-review on the host machine) you need to manually edit your remote URLs in every repo (edit .git/config, replace /r/p/ with /r/ in all the URLs). Vagrant is not well equipped for applying one-time fixes so I don't think we can do much about that.

hashar added a subscriber: hashar.Nov 19 2018, 3:58 PM

Well done @Tgr , indeed git-review forge the Gerrit API url based on the git remote URL. Thank you to have updated git-review in Vagrant!

Change 435192 abandoned by Paladox:
Update git-review to 1.27.0

https://gerrit.wikimedia.org/r/435192