Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 2426 by eyuw...@gmail.com: ReviewRequest.changeset_is_pending()
is unreliable
http://code.google.com/p/reviewboard/issues/detail?id=2426
* NOTE: Do not post confidential information in this bug report. *
* If you need immediate support, please contact *
* reviewbo...@googlegroups.com *
What version are you running?
1.6.1
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*
test
test
Testing Done:
Bug Number:
Reviewed by: <required>
Mailto:
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 = p4.run('describe',
review_request.changenum)
158 if p4_record[0]['status'] == 'pending':
159 logging.info('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)
295
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
302
(Pdb) changesetid
38484L
(Pdb) n
/build/toolchain/noarch/reviewboard-1.6.1/ReviewBoard-1.6.1-py2.6.egg/reviewboard/scmtools/perforce.py(298)get_changeset()
-> if changeset:
(Pdb) n
/build/toolchain/noarch/reviewboard-1.6.1/ReviewBoard-1.6.1-py2.6.egg/reviewboard/scmtools/perforce.py(299)get_changeset()
-> return self.parse_change_desc(changeset[0], changesetid)
(Pdb) self.parse_change_desc(changeset[0], changesetid)
*** EmptyChangeSetError: Changeset 38484 is empty
(Pdb)
--Return--
/build/toolchain/noarch/reviewboard-1.6.1/ReviewBoard-1.6.1-py2.6.egg/reviewboard/scmtools/perforce.py(299)get_changeset()->None
-> return self.parse_change_desc(changeset[0], changesetid)
(Pdb) n
EmptyChangeSetError: EmptyCha... empty',)
/build/toolchain/noarch/reviewboard-1.6.1/ReviewBoard-1.6.1-py2.6.egg/reviewboard/reviews/models.py(584)changeset_is_pending()
-> 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
587
588 return changeset and changeset.pending
589
(Pdb) changeset
(Pdb)
(Pdb) n
/build/toolchain/noarch/reviewboard-1.6.1/ReviewBoard-1.6.1-py2.6.egg/reviewboard/reviews/models.py(585)changeset_is_pending()
-> except (EmptyChangeSetError, NotImplementedError):
(Pdb) n
/build/toolchain/noarch/reviewboard-1.6.1/ReviewBoard-1.6.1-py2.6.egg/reviewboard/reviews/models.py(586)changeset_is_pending()
-> pass
(Pdb) n
/build/toolchain/noarch/reviewboard-1.6.1/ReviewBoard-1.6.1-py2.6.egg/reviewboard/reviews/models.py(588)changeset_is_pending()
-> return changeset and changeset.pending
(Pdb) changeset and changeset.pending
(Pdb)
--
You received this message because you are subscribed to the Google Groups
"reviewboard-issues" group.
To post to this group, send email to reviewboard-issues@googlegroups.com.
To unsubscribe from this group, send email to
reviewboard-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/reviewboard-issues?hl=en.