2917: Invalid diffs generated by post-review for local GIT to remote SVN

lstill.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Aug. 12, 2013
What version are you running?
RBTools 0.4.3

What steps will reproduce the problem?
1. Setup a remote SVN repository with content
2. Setup a local GIT repository
3. Setup RB tools appropriately
4. Fetch remote SVN files to a local GIT repository
5. Update and locally commit to GIT the file changes
6. Enter command: post-review

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

Expected:
The review is posted with the diff successfully (and the format of the diff is incorrect.)

Actual:
>>> Uploading diff, size: 59226
>>> HTTP POSTing to <path>: {'basedir': '<base>'}
>>> Got API Error 219 (HTTP code 400): The specified diff file is empty
>>> Error data: {u'stat': u'fail', u'err': {u'msg': u'The specified diff file is empty', u'code': 219}}

On lines beginning with ---; the review number has a new line in it (that isn't being stripped), forcing the ) to be on a new line
On lines beginning with @@; there is invalid content after the second @@.

What operating system are you using?
Windows 7; Using Cygwin for GIT and post-review

Please provide any additional information below.

A review is created but the patch isn't uploaded. For some reason in git.py when it is trying to retrieve the revision number, the result is coming back as a non-integer:

rev = '3759\n\x1b[?1034h'

The attached patch for git.py masks the review number problem (it doesn't fix the root cause) and attempts to fix the @@ problem.
298a299,300
>         matchResult = re.search('[0-9]+', rev)
>         rev = matchResult.group(0)
342a345,346
>             elif line.startswith("@@"):
>                 diff_data += line[0:(line.rfind("@@") + 2)].strip() + "\n"
#1 lstill.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Expected:
The review is posted with the diff successfully (and the format of the diff is correct.)

- Fixed Typo.
#2 gernhar********@gmai***** (Google Code) (Is this you? Claim this profile.)
Same problem here with RB 1.7.5 and RBTools 0.5. And the alternative "rbt post" just gives me:

CRITICAL:root:Error creating review request: The repository path specified is not in the list of known repositories (HTTP 400, API Error 206)
#3 gernhar********@gmai***** (Google Code) (Is this you? Claim this profile.)
Okay, apparently it's not exactly the same problem for me. I switched back to 0.4.3 and applied your patch/workaround but then got errors about files not being in the repository. After taking a look at the output of "post-review --output-diff" it became evident that "git svn find-rev" produced an error if its output didn't go to the terminal:

git svn find-rev master | tee
Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and LINES environment variables didn't work. The resize program didn't work. at /usr/lib/perl5/Term/ReadKey.pm line 362.
12477

12477 is the correct SVN revision so after changing the regex in your patch to '([0-9]+)$' I can upload reviews again.
david
#4 david
This code has changed quite a bit, and the two parts that you mention now use different methods to parse the diff lines and find the revisions. I'm going to guess that this is fixed, since the new code seems to be making fewer assumptions.
  • +Fixed