1873: Post-commit review does not work with code committed to git repository (master branch)

sigu****@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 20, 2014
What version are you running?
1.5

What's the URL of the page containing the problem?
http://localhost/reviews/r/10/diff/#index_header

What steps will reproduce the problem?
1. Setup a git repository within the admin tool
2. Commit changes to your git repository
3. Use post-review to send a (post-commit) review request for changes already committed, using --revision-range=hash:hash
4. Look at the diff in reviewboard

What is the expected output? What do you see instead?
Expected was a nice diff of my commits for the range specified. What I get is:

The patch to 'filename.py' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.4yHsSV' for debugging purposes. `patch` returned: patching file /tmp/reviewboard.4yHsSV/tmp6zizmb Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Skipping patch. 1 out of 1 hunk ignored -- saving rejects to file /tmp/reviewboard.4yHsSV/tmp6zizmb-new.rej

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/reviewboard/diffviewer/views.py", line 153, in view_diff
    interdiffset, highlighting, True)
  File "/usr/local/lib/python2.6/dist-packages/reviewboard/diffviewer/diffutils.py", line 1063, in get_diff_files
    large_data=True)
  File "/usr/local/lib/python2.6/dist-packages/djblets/util/misc.py", line 166, in cache_memoize
    data = lookup_callable()
  File "/usr/local/lib/python2.6/dist-packages/reviewboard/diffviewer/diffutils.py", line 1062, in <lambda>
    enable_syntax_highlighting)),
  File "/usr/local/lib/python2.6/dist-packages/reviewboard/diffviewer/diffutils.py", line 549, in get_chunks
    new = get_patched_file(old, filediff)
  File "/usr/local/lib/python2.6/dist-packages/reviewboard/diffviewer/diffutils.py", line 374, in get_patched_file
    return patch(filediff.diff, buffer, filediff.dest_file)
  File "/usr/local/lib/python2.6/dist-packages/reviewboard/diffviewer/diffutils.py", line 242, in patch
    (filename, tempdir, patch_output))
Exception: The patch to 'filename.py' didn't apply cleanly. The temporary files have been left in '/tmp/reviewboard.4yHsSV' for debugging purposes.
`patch` returned: patching file /tmp/reviewboard.4yHsSV/tmp6zizmb
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file /tmp/reviewboard.4yHsSV/tmp6zizmb-new.rej


What operating system are you using? What browser?
Ubuntu 10.10, Chromium 6.0.472.63 (59945).


Please provide any additional information below.

It looks like patch is confused as the code to review is already commited, and it asks to reverse the change introduced by the patch.

I guess reviewboard does not work with code already in repository. At least for the master branch with git.

I am not sure if this is a defect or a documentation issue. I do not think it is clear from the documentation that this is not a supported use case. I would really hope that it would be supported to do it our way, as quite a few organizations want all code to be committed as early as possible to the central repository.
david
#1 david
  • +Component-RBTools
chipx86
#2 chipx86
The use case should work.

Is this a local git clone on the Review Board server, or a remotely accessed repository using gitweb, cgit, etc.?
  • +NeedInfo
#3 Anthony*******@gmai***** (Google Code) (Is this you? Claim this profile.)
I am experiencing this same problem.  I see the patch does not apply cleanly error for a modified file that has been committed to master.  Files that are newly added in the same commit that's being posted for review show up fine in the diff viewer.

For my case, I am using a remotely accessed repository via cgit.

I defined the raw URL path and tested it using the path and hash listed in the diff.  It shows up correctly (p.s, important to include plain, and id2)

Both tmp files dumped to the reviewboard temp directory display HTML content from the cgit webserver that says "No repositories found" instead of the expected raw file content.  This is probably the problem.  I am guessing that the raw file URL that gets generated to be accessed is somehow invalid.  

I don't see any info in the reviewboard log that helps.
#4 Anthony*******@gmai***** (Google Code) (Is this you? Claim this profile.)
I forgot to mention, the reject file basically looks like the original content of the file, followed by the new content.
"""
***************
*** 1,4 ****
- require 'support/client'
  require 'support/local_admin'
  require 'support/remote_admin'
  require 'support/remote_connector'
--- 1,4 ----
+ rquire 'support/client'
  require 'support/local_admin'
  require 'support/remote_admin'
  require 'support/remote_connector'
"""

(I intentionally introduced a typo to test posting a review)

Please let me know if I can provide any more info
#5 Anthony*******@gmai***** (Google Code) (Is this you? Claim this profile.)
One more piece of news is that I'm using RB 1.5.1.  I see that the poster indicated 1.5
david
#6 david
My guess is that this is due to an old RB. If anyone is encountering this with 1.6.x, please comment and we can investigate anew.
  • -NeedInfo
    +UnableToReproduce
#7 gen****@gmai***** (Google Code) (Is this you? Claim this profile.)
We have experienced this with 1.6.6 a few times over the past month.  Pretty much the same use-case and output as described in the original post using cgit.  Let me know if I can provide anything else to help.
david
#8 david
  • -UnableToReproduce
    +New
#9 sivaram********@gmai***** (Google Code) (Is this you? Claim this profile.)
I am using 1.6.3 and I am experiencing same issue with reviewboard
david
#10 david
  • -New
    +Fixed