Issue #2214 resolved
Anonymous created an issue
** Mercurial version (2.3.2).  TortoiseHg version (2.5.1)
** Command: 
** CWD: C:\Windows\system32
** Encoding: cp1252
** Extensions loaded: reviewboard
** Python version: 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)]
** Windows version: sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1')
** Processor architecture: x64
** Qt-4.8.0 PyQt-4.9.1
Traceback (most recent call last):
File "tortoisehg\hgqt\postreview.pyo", line 50, in run
File "tortoisehg\hgqt\postreview.pyo", line 78, in loadCombos
AttributeError: Api20Client instance has no attribute 'pending_user_requests'

Comments (14)

  1. Lee Wilson

    I had the same error, but in my case it was actually pretty easy to fix. I'm using TortoiseHg 2.6.1, the reviewboard extension from, It turns out that the Google code does have MOST of the changes from the mdelagra repo, but not all. To fix, I did the following:

    1) added self._pending_user_requests = None to Api20Client::__init__

    def __init__(self, httpclient):
        ApiClient.__init__(self, httpclient)
        self._repositories = None
        self._pending_user_requests = None
        self._requestcache = {}

    2) copied the Api20Client::pending_user_requests method directly from the mdelagra code:

    def pending_user_requests(self):
        # Get all the pending request within the last week for a given user
        if not self._pending_user_requests:
            usr = str(self._httpclient._password_mgr.rb_user)
            delta = datetime.timedelta(days=7)
            today =
            sevenDaysAgo = today - delta
            rsp = self._api_request('GET', '/api/review-requests/' +
                                           '?from-user=%s' % usr +
                                           '&status=pending' +
                                           '&max-results=50' +
                                           '&last-updated-from=%s' % sevenDaysAgo)
            self._pending_user_requests = []
            for r in rsp['review_requests']:
                self._pending_user_requests += [Request(r['id'], r['summary'].strip())]
        return self._pending_user_requests

    3) added import datetime to the top.

    It all works great now in tortoisehg.

  2. dsargent

    Lee, we are having the same problem, I tried your solution but as soon as I add self._pending_user_requests = None the plugin will no longer load in TortoiseHg I am running TortoiseHg 2.6.1 and ReviewBoard 1.6.9 I do steps 2 and 3 just fine and the plugin loads, I get the post review option and still get the error message, but as soon as I do step one the plugin does not load.
    Any ideas? I'm not a Python dev, neither is anyone on my team, any help would be appreciated.

  3. dsargent

    Awesome, just found out Python is Space / Tab picky and my editor was throwing in a mix of spaces and tabs. Fixed and now the error no longer appears. One question that my / may not be related. Under the "Update Review" tab we are not getting anything in the "Review ID" drop down. Not sure how that drop down is supposed to work. Anyone have any ideas?

  4. Lee Wilson

    Yes, essentially, that's exactly what I did, too. I only took the minimal set of changes (as specified above) to get it working though as I didn't want to pull in anything from melagra that would break the "official" Google version (since theoretically, that version has already merged any changes from the melagra version). The changes above SHOULD be all that need to be added to the Google version to get things working.

  5. Anders Elfgren

    We're having the same issue and it would be great if it was part of the google code repo, since it's the one that seems to be maintained these days. Would it be possible to create a patch and get it pushed to it?

  6. Colin Caughie

    Many apologies for not responding to this sooner. For some reason I'm not getting email notifications when issues are created or updated.

    Thanks for all your efforts on this. I'd definitely like to include this patch but I can't seem to get it to work. I haven't yet figured out how to debug Tortoise extensions (in particular how to get log output), but from a Wireshark capture it appears that the review-requests command is not getting sent, which presumably means that pending_user_requests() is not being called.

    I'm running TortoiseHg 2.7 - have any of you tried the fix with this version?

    I don't have much time to look at this today but I'll try to investigate further soon.

  7. Colin Caughie

    I figured it out - it was necessary to stringify sevenDaysAgo before passing it to urllib.quote(). I also quoted the username just in case.

    I've applied this and one other patch to the repo on Google Code; together they seem to make it work fairly reliably. Please give it a try and let me know if you have issues.

  8. Log in to comment