3933: Review post from Clearcase fails if the file versions are same

What version are you running?
ReviewBoard-2.0.6, RBTool-0.6.2

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

What steps will reproduce the problem?
1. Post a review with same versions: rbt post file1.c@@/main/2:file1.c@@/main/2
2. rbt post throws error (see snapshot at the end)

What is the expected output? What do you see instead?
Review should be posted with empty diff. I understand that it does not make sense to explicitly post reviews with same versions. But there would be cases when:
1. Posting a diff with labels and both labels are on same version of the file
2. Posting a diff from a branch (brtype option) and the branch has only version 0 so empty diff.

What operating system are you using? What browser?
ReviewBoard server is on RHEL 6.5
RBT is on RHEL 6.5

Please provide any additional information below.
Looks like the server is unable to parse the diff file (which probably would be empty as the versions are same)

Traceback from server logs:

2015-07-29 07:13:39,847 - ERROR - None - user1- /api/review-requests/218/diffs/ - Error uploading new diff: u'origFile'
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/webapi/resources/diff.py", line 292, in create
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/reviews/forms.py", line 116, in create
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/diffviewer/forms.py", line 69, in create
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/diffviewer/managers.py", line 156, in create_from_upload
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/diffviewer/managers.py", line 182, in create_from_data
    check_existence=(not parent_diff_file_contents)))
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/diffviewer/managers.py", line 275, in _process_files
    for f in parser.parse():
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/diffviewer/parser.py", line 55, in parse
    next_linenum, new_file = self.parse_change_header(i)
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/diffviewer/parser.py", line 97, in parse_change_header
    linenum = self.parse_diff_header(linenum, info)
  File "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.6-py2.6.egg/reviewboard/scmtools/clearcase.py", line 356, in parse_diff_header
    currentFilename = info['origFile']
KeyError: u'origFile'

Traceback from rbt:

[user1@rbserver include]$ rbt post -d file1.c@@/main/2:file1.c@@/main/2
>>> RBTools 0.6.2
>>> Python 2.6.6 (r266:84292, Sep  4 2013, 07:46:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
>>> Running on Linux-2.6.32-431.el6.x86_64-x86_64-with-redhat-6.5-Santiago
>>> Home = /home/user1
>>> Current directory = /cm_data/myvob/folder1
>>> Checking for a ClearCase repository...
>>> Running: cleartool pwv -short
>>> Running: diff --version
>>> Running: cleartool lsview -full -properties -cview
>>> Running: cleartool describe -short vob:.
>>> Running: cleartool pwv -root
>>> repository info: Path: /cm_data/myvob, Base path: /cm_data/myvob, Supports changesets: False
>>> Making HTTP GET request to http://rbserver/api/
>>> Running: diff -uN file1.c@@/main/2 file1.c@@/main/2
>>> Running: cleartool describe -fmt %On file1.c@@/main/2
>>> Running: cleartool describe -fmt %On file1.c@@/main/2
>>> Making HTTP GET request to http://rbserver/api/review-requests/
>>> Making HTTP POST request to http://rbserver/api/review-requests/
>>> Making HTTP GET request to http://rbserver/api/review-requests/218/diffs/
>>> Making HTTP POST request to http://rbserver/api/review-requests/218/diffs/
>>> Got API Error 105 (HTTP code 400): One or more fields had errors
>>> Error data: {u'fields': {u'path': [u"u'origFile'"]}, u'stat': u'fail', u'err': {u'msg': u'One or more fields had errors', u'code': 105}}
Traceback (most recent call last):
  File "/usr/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.6.2', 'console_scripts', 'rbt')()
  File "/usr/lib/python2.6/site-packages/RBTools-0.6.2-py2.6.egg/rbtools/commands/main.py", line 134, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/usr/lib/python2.6/site-packages/RBTools-0.6.2-py2.6.egg/rbtools/commands/__init__.py", line 416, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/usr/lib/python2.6/site-packages/RBTools-0.6.2-py2.6.egg/rbtools/commands/post.py", line 784, in main
  File "/usr/lib/python2.6/site-packages/RBTools-0.6.2-py2.6.egg/rbtools/commands/post.py", line 551, in post_request
    raise CommandError(u'\n'.join(error_msg))
rbtools.commands.CommandError: Error uploading diff

One or more fields had errors (HTTP 400, API Error 105)

    path: u'origFile'

Your review request still exists, but the diff is not attached.


[user1@rbserver include]$
#1 david
  • -reviewboard
  • +SCM:ClearCase
#2 david

Could you attach the output of rbt diff file1.c@@/main/2:file1.c@@/main/2?

  • -New
#3 viney

Here is the rbt diff output:

[user1@rbserver include]# rbt diff file1.c@@/main/2:file1.c@@/main/2
==== ae9c24a9.d4d511e1.93db.00:01:84:00:fa:5e ae9c24a9.d4d511e1.93db.00:01:84:00:fa:5e ====
File file1.c@@/main/2 in your changeset is unmodified

[user1@rbserver include]#

#4 david

Thank you!

  • -NeedInfo