sureshvv / reviewboard

Automatically exported from code.google.com/p/reviewboard
0 stars 0 forks source link

svn copy causes problems #522

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a new file using "svn copy"
2. create the diff and upload it
3. view the diff

What is the expected output? 
the view off the diff

What do you see instead?
he patch to 'newFile.pl' didn't apply cleanly. The temporary files
have been left in '/tmp/reviewboard.HioriF' for debugging purposes.
`patch` returned: patching file /tmp/reviewboard.HioriF/tmpZSh4CR Hunk
#1 FAILED at 1. Hunk #2 FAILED at 14. 2 out of 2 hunks FAILED --
saving rejects to file /tmp/reviewboard.HioriF/tmpZSh4CR-new.rej

Traceback (most recent call last):
    File "/home/mkobele/reviewboard/diffviewer/views.py", line 82, in
view_diff
files = get_diff_files(diffset, None, interdiffset, highlighting)
    File "/home/mkobele/reviewboard/diffviewer/diffutils.py", line
594, in get_diff_files
    enable_syntax_highlighting)
    File "/home/mkobele/reviewboard/diffviewer/diffutils.py", line
513, in generate_files
    lambda: get_chunks(filediff.diffset,
            File "/home/mkobele/reviewboard/djblets/util/misc.py",
line 49, in cache_memoize
            data = lookup_callable()
            File "/home/mkobele/reviewboard/diffviewer/diffutils.py",
line 516, in <lambda>
            enable_syntax_highlighting))
    File "/home/mkobele/reviewboard/diffviewer/diffutils.py", line
317, in get_chunks
new = get_patched_file(old, filediff)
    File "/home/mkobele/reviewboard/diffviewer/diffutils.py", line
233, in get_patched_file
return patch(filediff.diff, buffer, filediff.dest_file)
    File "/home/mkobele/reviewboard/diffviewer/diffutils.py", line
119, in patch
(filename, tempdir, patch_output))
    Exception: The patch to 'newFile.pl' didn't apply cleanly. The
temporary files have been left in '/tmp/reviewboard.HioriF' for
debugging purposes.
    `patch` returned: patching file /tmp/reviewboard.HioriF/tmpZSh4CR
    Hunk #1 FAILED at 1.
    Hunk #2 FAILED at 14.
    2 out of 2 hunks FAILED -- saving rejects to file /tmp/
reviewboard.HioriF/tmpZSh4CR-new.rej

Please provide any additional information below.
The problem might be that the diff header looks like this:

Index: newFile.pl
===================================================================
--- newFile.pl  (revision 0)
+++ newFile.pl  (working copy)
@@ -1,8 +1,8 @@
 #!/usr/bin/perl
 #
[...]

If it was a brand new file (svn add as opposed to svn copy)
the header would like this:

Index: newFile.pl
===================================================================
--- newFile.pl  (revision 0)
+++ newFile.pl  (revision 0)
@@ -0,0 +1,202 @@
 #!/usr/bin/perl
 #
[...] 

Original issue reported on code.google.com by mkoeb...@gmail.com on 20 Jun 2008 at 2:59

GoogleCodeExporter commented 9 years ago
Try to use the post-review tool to generate/upload the diff and see if that 
fixes
your problem.

Original comment by chip...@gmail.com on 20 Jun 2008 at 9:22

GoogleCodeExporter commented 9 years ago
I will try that.
But that would be merely a workaround and not a fix for this issue.

I hope the core developers of review-board can have a look at it and at least 
avoid
that exception as seen above.

Thanks.

Original comment by mkoeb...@gmail.com on 23 Jun 2008 at 12:14

GoogleCodeExporter commented 9 years ago
We can't do much, though. SVN diffs that do copies or renames provide broken
information and we can't know it's broken. The best we can do is display an 
inline
error for that file, or just drop it. Neither are great solutions. This is why
post-review must be used for these cases, as we can generate our own fixed diff.

Original comment by chip...@gmail.com on 4 Aug 2008 at 8:59

GoogleCodeExporter commented 9 years ago
With SVN, it's very hard (if not impossible) to tell the difference between a 
file
that has a broken copy and a file which is uploaded from the web UI with the 
wrong
base diff path. We may want to come up with a generic error to show in this 
case.

Either way, we ought to check the diff for problems when it gets uploaded 
instead of
when it's viewed.

Original comment by trowb...@gmail.com on 6 Oct 2008 at 8:03

GoogleCodeExporter commented 9 years ago
Speaking of which, I'm going to merge this into bug 583.

Original comment by trowb...@gmail.com on 24 Mar 2009 at 5:33

GoogleCodeExporter commented 9 years ago
does this mean that "svn copy" will not be fixed?
bug 583 talks about validation, will reviewboard then simply reject diffs 
containing
files created by a svn copy?

Original comment by mkoeb...@gmail.com on 25 Mar 2009 at 1:28

GoogleCodeExporter commented 9 years ago
There's no way for us to "fix" this. "svn diff" is what's broken, we can merely 
work
around it.

Original comment by trowb...@gmail.com on 25 Mar 2009 at 8:54