TortoiseSVN : Good 'patch file' viewer?
Asked Answered
D

8

22

The default patch file viewer is messy (ie. no side by side diff view etc). I tried setting the path of beyondCompare exe in "Settings->Unified Diff Viewer->custom", but beyond compare also behaves same as default diff tool. Is there a way to atleast allow side by side diff in patch files ? If so, what is the method ? My aim is to allow emailing of changes so that they can be reviewed before I commit them :)

Mishal

Deforest answered 24/5, 2010 at 5:45 Comment(4)
email changes before committing? That sounds tedious, specially when you have 40 files to commit.Titian
Yes, in that scenario it does sound tedious i agree. But usually for small/medium changes we have developers bringing people over to review at their desks, and so at one time only one person is reviewing. Emailing allows any number of peers to review in parallel and also the review can happen at one's own pace. When review is happenning at other's desk, everyone seems to be a little hasty if the change is huge (thats what I feel.. :)Deforest
@mishal153: You might want to try a web-based review tool like ReviewBoard. It will even generate patch files for you if people want to fall back to the old method. It's even free for commercial use.Omeara
A few more options, including one that's a single html file that, duh, runs in a browser, at this question.Inceptive
L
11

I've never found any, but the solution that I usually use is to simply apply the patch file to a pristine checkout of the tree, and then do a "regular" diff (my preferred tool is diffuse) to review the changes in context.

The problem with "raw" patch files is that they only provide a few lines of context before and after the change, which often isn't enough.

If you don't like the patch, simply revert the changes and don't commit!

Labiate answered 24/5, 2010 at 5:55 Comment(3)
ok, yes that sounds do-able. Well I did find a way while I was trying to follow what you said. While doing 'apply patch' it does let us preview the changes in each file of the patch before they are applied. The only issue with patch is that, as you mentioned, it only contains the lines of code which changed, and not the complete "before" and "after" files. So its necessary that the code must be present on the system. Well...thanks.Deforest
well...im gonna mark this as correct since there does not seem to be any other logical posibility to achieve what i originally wanted with just a patch file :) (since it contains too less information).Deforest
The problem is, I came here because my patched is for some reason "rejected", "invalid", and I would like to just replace the old code with this patch. So I need to see it to copy it directly into code, and I can't apply it..Timecard
H
7

Beyond Compare 4 allows you to view patch files created by SVN. The top window in Beyond Compare is a tree structure, allowing you to navigate folders and files by name. Revision numbers are present in the left and right diff windows.

Create the patch

svn diff -r 5922:6116 > CodeReview.patch

Open the patch in Beyond Compare 4

Opening the patch in Beyond Compare 4

Holifield answered 2/2, 2017 at 19:0 Comment(0)
P
5

SVN 1.7 I think was released since this answer was posted, and I landed here because I wanted to show my newly created patch file with syntax coloring, a la view unified diff in TortoiseSvn.

It turns out that Notepad++ automatically syntax colors my file correctly if I give it the filetype of "patch"!

Patches have been around a long time but SVN is now supporting them more fully. See for example the documentation; http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-patch.html

For how to create a patch file, see this nice document that describes various methods including mine, WinMerge; http://docs.moodle.org/dev/How_to_create_a_patch#Creating_a_patch_using_WinMerge

Pneumo answered 8/2, 2012 at 22:12 Comment(0)
I
3

If you have access to a Mac OS X machine, PatchViewer sounds like it might do what you're looking for: http://appledeveloper.com.au/products/patchviewer/

(Disclaimer: I am the author of PatchViewer.)

Ignominious answered 13/2, 2013 at 4:27 Comment(2)
Hey, welcome to Stack Overflow. Thanks for actually disclosing your affiliation. However, the community usually does not appreciate 1-rep users to do nothing here but promote their software and our faq also mention that you are probably wrong here if most/all of your posts are promotional. Please consider answering questions that are unrelated to your application, too.Synagogue
@Synagogue I haven't checked the other answers, but at 2k+ rep, I think user20167021 has earned a comment revision. ;^)Inceptive
P
1

You can view a diff file (a patch generated by diff tool) using Kompare from KDE environment. I used it before on Linux, but today I found how to install it on Windows. Here is an installation instruction from a blog "Kompare - the only valuable diff for M$Windows":

  1. Go to gnuwin32 diffutils, download and install.
  2. Download kdewin installer and launch it.
  3. After installing kde4win - start kompare and in "Diff" section show him where your diff.exe (from gnuwin32 diffutils) is located.
  4. Restart Kompare and it's ready to use!

You can also add an association with .diff file format and now you can view any diff files. For me it works great.

Porphyry answered 4/5, 2012 at 7:43 Comment(0)
D
0

I like to use KDiff3, it's packed with functions, very user friendly and available for all popular platforms. It can also integrate with TortoiseSVN.

Dunnage answered 24/5, 2010 at 6:2 Comment(2)
beyond compare is actually compatible with SVN for normal diff. So thats not a problem. Problem is viewing patch files in normal diff style (2 panes left and right, showing before and after).Deforest
KDiff3 can't view patch files to my knowledge.Aitchbone
S
0

GitExtensions, my favorite Git GUI, also has an option to "View patch file":

enter image description here

Swats answered 1/4, 2022 at 10:55 Comment(0)
O
0

I had the same question as you today. I wanted to review a patch file side by side with some highlight/color cues and a reasonably convenient interface. After some searching, I found this little repo: https://github.com/megatops/PatchViewer.

It's a single HTML filethat lets you load a patch file, and displays it side by side. Just what I was looking for

Ostiole answered 24/8, 2023 at 10:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.