594: Problem with post-review script and large Perforce change list number

threebre*********@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Aug. 27, 2008
What's the URL of the page containing the problem?
post-review script - version 0.8

What steps will reproduce the problem?

I ran version 0.8 of the post-review script, supplying a Perforce
changelist number.  The following message was displayed

-bash-3.00$ ./post-review 1008673
You must enter a valid change number

I know from doing a p4 opened command that the change list number I
supplied is correct.

At line 788 post-review will cast changenum variable to an int.  I think
this is failing.

        try:
            changenum = int(changenum)
        except ValueError:
            die("You must enter a valid change number")

        debug("Generating diff for changenum %s" % changenum)

        description = execute('p4 describe -s %d' % changenum).splitlines()
        if '*pending*' in description[0]:
            cl_is_pending = True


What is the expected output? What do you see instead?
see above.

What operating system are you using? What browser?
Solaris


Please provide any additional information below.

Looking at the code further, it seems that changenum is used in the p4
describe command, and there is no need for it to be in integer format.

So the following fix seemed to work.

#
# 1. remove try block
#

#        try:
#            changenum = int(changenum)
#        except ValueError:
#            die("You must enter a valid change number")

        debug("Generating diff for changenum %s" % changenum)

#
# 2. use string format of changenum instead of integer format
#
        description = execute('p4 describe -s %s' % changenum).splitlines()
        if '*pending*' in description[0]:
            cl_is_pending = True

This change seems to do the trick.
#1 nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
This doesn't work for me. It still tries to describe changelist '<num>' (in quotes)
and fails.
#2 nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
I commented out line 1531         #args = ["'%s'" % arg for arg in args] # quote
filenames to match version 0.7 and it works. 

The new code seems to want filenames when in fact we enter changelist numbers. Has
the usage changed?

Nithin.
#3 threebre*********@gmai***** (Google Code) (Is this you? Claim this profile.)
Here is before and after debug output of what I get from implementing my change:

BEFORE
-bash-3.00$ ./post-review 1008673 -d
>>> Repository info 'Path: p4server.com:port, Base path: None, Supports changesets: True'
You must enter a valid change number
-bash-3.00$     

AFTER
-bash-3.00$ ./post-review 1008673 -d
>>> Repository info 'Path: p4serverxxxxxxxxxxxx.com:port, Base path: None, Supports
changesets: True'
>>> Generating diff for changenum 1008673
>>> p4 describe -s 1008673
>>> Processing edit of //depot/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.sql
>>> Writing "//depot/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.sql#1" to
"/tmp/tmpIBNKfE"
>>> p4 print -q "//depot/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.sql#1"
>>> p4 where "//depot/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.sql"
>>> gdiff -urNp "/tmp/tmpIBNKfE"
"/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.sql"
>>> Looking for 'host.xxxxxxxxxxxxxxxxxe.com /' cookie in
/users/xxxxxxx/.post-review-cookies.txt
>>> Loaded valid cookie -- no login required
>>> Attempting to create review request for 1008673
>>> HTTP POSTing to http://reviewboardserverxxxxxx.com/api/json/reviewrequests/new/:
{'repository_path': 'p4serverxxxxxxxxxxxx.com:port', 'changenum': '1008673'}

Our reviewboard server is version 0.7 at the moment, so the post-review script fails
at this point on my system.  I can test further when we get upgraded to 0.8

Hope that helps. Let me know if you require any further information.

Colin
chipx86
#4 chipx86
Pending review at http://reviews.review-board.org/r/515/
  • -Priority-Medium
    +Priority-Critical
    +PendingReview
    +Component-Scripts
    +Milestone-Release1.0
chipx86
#5 chipx86
  • +chipx86
chipx86
#6 chipx86
Fixed in r1455.
  • +Fixed
  • -PendingReview