Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 2426 by ReviewRequest.changeset_is_pending() is unreliable

* NOTE: Do not post confidential information in this bug report. *
*       If you need immediate support, please contact            *
*                             *

What version are you running?

What's the URL of the page containing the problem?
no particular URL. I'm using the Django model ReviewRequest in reviews.models

What steps will reproduce the problem?
When perforce changeset is not empty, it returns correct value (a Boolean) as expected. But when perforce changeset is empty, it receives EmptyChangeSetError but never handles that exception by simply passing the error. In this case, None is returned which causes code like `` if not review_request.changeset_is_pending(): `` to be falsely evaluated to True.

What is the expected output? What do you see instead?
True/False. I got None.

What operating system are you using? What browser?
Centos 5.7

Please provide any additional information below.

[wange@ewang-devc files]$ p4 describe 38484
Change 38484 by wange@wange-buildweb-dev on 2011/12/14 11:56:33 *pending*


        Testing Done:
        Bug Number:
        Reviewed by: <required>
        Review URL:

Affected files ...
[wange@ewang-devc files]$

However, it is really a pending changeset that never gets deleted or submitted to perforce. See Change 38484 by wange@wange-buildweb-dev on 2011/12/14 11:56:33 *pending*

For now, I have to work around this issue by checking the CLN with the perforce server:
152                 try:
153                     p4 = P4()
154                     p4.user = _P4_USER
155                     p4.port = p4_port
156                     p4.connect()
157 p4_record ='describe', review_request.changenum)
158                     if p4_record[0]['status'] == 'pending':
159'Changeset %s is pending in SCM. Skip' % 160 review_request.changenum)
161                         continue
162                 except P4Exception:
163                     pass

Here is my debugging log:

293         def get_pending_changesets(self, userid):
294             return self.client.get_pending_changesets(userid)
296         def get_changeset(self, changesetid):
297  ->         changeset = self.client.get_changeset(changesetid)
298             if changeset:
299                 return self.parse_change_desc(changeset[0], changesetid)
300             else:
301                 return None
(Pdb) changesetid
(Pdb) n
-> if changeset:
(Pdb) n
-> return self.parse_change_desc(changeset[0], changesetid)
(Pdb) self.parse_change_desc(changeset[0], changesetid)
*** EmptyChangeSetError: Changeset 38484 is empty

-> return self.parse_change_desc(changeset[0], changesetid)
(Pdb) n
EmptyChangeSetError: EmptyCha... empty',)
-> changeset = self.repository.get_scmtool().get_changeset(self.changenum)
(Pdb) l
579             request is pending under SCM.
580             """
581             changeset = None
582             if self.changenum:
583                 try:
584 -> changeset = self.repository.get_scmtool().get_changeset(self.changenum)
585                 except (EmptyChangeSetError, NotImplementedError):
586                     pass
588             return changeset and changeset.pending
(Pdb) changeset
(Pdb) n
-> except (EmptyChangeSetError, NotImplementedError):
(Pdb) n
-> pass
(Pdb) n
-> return changeset and changeset.pending
(Pdb) changeset and changeset.pending

You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to