3216: hg url not created correctly if no trailing / in the repo URL, hg-history call will fail by removing the host from the URL

doth*****@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 30, 2014
What version are you running?
1.7.20

What's the URL of the page containing the problem?
create review request

What steps will reproduce the problem?
1.upload patch
2.fails with 'failing to retrieve ....foo.cpp



So my configured repo URL looks like that:
http://127.0.0.1:8004
this constructs the Request sent to reviewboard:
https://github.com/reviewboard/reviewboard/blob/master/reviewboard/scmtools/hg.py
....
        for rawpath in ["raw-file", "raw", "hg-history"]:
            try:
                base_url = self.path.rstrip('/')<- will remove 127.0.0.1:8004 from the base url

                if rawpath == 'hg-history':
                    base_url = self.path[:self.path.rfind('/')]
-> request will go to 
http://hg-history/fadf21a55c14/FOO/src/foo.cpp

Can be workarounded by configuring the repo with trailing /: 
http://127.0.0.1:8002/
-> either HG-repos without trailing / have to be prohibited in the admin interface, or this code has to become more clever.

however, even the corrected pattern still fails:
http://127.0.0.1:8004/hg-history/fadf21a55c14/FOO/src/foo.cpp

my repo is run by hg version 1.4 ran by  /usr/bin/hg serve --name FOO -d -p 8004
#1 doth*****@gmai***** (Google Code) (Is this you? Claim this profile.)
hg 2.2.2 seems to solve the situation if the URL is composed correctly.
david
#2 david
Fixed in release-1.7.x (802b117).
  • +Fixed