2585: Reviewboard's Mercurial Support won't work against Google Code

au***@googl***** (Google Code) (Is this you? Claim this profile.)
July 4, 2012
What version are you running?

What's the URL of the page containing the problem?

What steps will reproduce the problem?
1. Use Mercurial on Project Hosting (Google Code)
2. Upload a diff

What is the expected output? What do you see instead?
I expect to be able to review diffs. Instead, I get a (baffling) error that the file doesn't exist in the parent revision.

You're going outside the Mercurial wireprotocol (understandable, since Mercurial lacks a way to fetch raw filecontent via the wireprotocol). I see you've already got a kludge in place for BitBucket (/raw/ instead of hgweb's /raw-file/), so maybe you can just add something similar for project hosting as well? The format you're looking for is http://${project}.googlecode.com/hg-history/${revision}/${filepath}.

I suspect you're broken against our git repositories as well if you do a similar trick against gitweb, although I didn't look. if you replace hg-history with git-history in the URL format I list above, you'll get what you'd expect.
#1 nate.******@gmai***** (Google Code) (Is this you? Claim this profile.)
This patch against 1.6.6 fixes it for us.
  • +
    diff -ru ReviewBoard-1.6.6/reviewboard/scmtools/hg.py ReviewBoard-1.6.6-patched/reviewboard/scmtools/hg.py
    --- ReviewBoard-1.6.6/reviewboard/scmtools/hg.py	2012-04-25 11:30:59.000000000 +0200
    +++ ReviewBoard-1.6.6-patched/reviewboard/scmtools/hg.py	2012-05-15 17:10:00.371707015 +0200
    @@ -180,10 +180,16 @@
             elif rev == PRE_CREATION:
                 rev = ""
    -        for rawpath in ["raw-file", "raw"]:
    +        for rawpath in ["raw-file", "raw", "hg-history"]:
    +                url = self.path.rstrip('/')
    +                if rawpath == "hg-history":
    +                   url = self.path[:self.path.rfind('/')]
                     url = self.FULL_FILE_URL % {
    -                    'url': self.path.rstrip('/'),
    +                    'url': url,
                         'rawpath': rawpath,
                         'revision': rev,
                         'quoted_path': urllib_quote(path.lstrip('/')),
#2 chipx86
Can you post this on http://reviews.reviewboard.org/ ?
  • +PendingReview
  • +Milestone-Release1.6.x
#3 david
Fixed it commit c2c803d.
  • -PendingReview