Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to visualize or format a diff / patch file? [closed]

I have a patch file (unified diff), like the output from svn diff, git diff, or diff -u .... I want to review it, but the unified diff format - especially with many files & changes - is hard on my eyes.

How can I get a nicely-formatted diff view from the patch file? I don't have the files themselves, only the diff, so I can't use all the regular diff tools.

So far my 2 best tactics are:

  1. Load the diff in gvim and get some syntax highlighting
  2. Paste the diff into a Trac wiki in a #!diff-formatted section and click "preview" - this creates an awesome diff view:
{{{ #!diff <unified diff here> }}}

Are there desktop tools that can do this? Is there a way to persuade kdiff3 / diffmerge / p4merge / etc. to visualize the patch file? Something that replicates Trac's visualization would be great as well.

EDIT: bonus points for Windows support as well, preferably with an installer or a pain-free installation.

like image 344
orip Avatar asked Feb 25 '10 21:02

orip


People also ask

How do I view a PATCH file?

The best way to open an PATCH file is to simply double-click it and let the default assoisated application open the file. If you are unable to open the file this way, it may be because you do not have the correct application associated with the extension to view or edit the PATCH file.

How do I open a diff patch?

A DIFF file is a difference file, also called a PATCH file. Open one with Kompare, Mercurial, or a text editor like Notepad++.

How do I edit a diff file?

Take a copy of the diff you want to edit, and edit it without changing any offsets or counts (the lines that begin “@@”). Then run rediff, telling it the name of the original diff file and the name of the one you have edited, and it will output the edited diff file but withcorrected offsets and counts.

How can I see my git patch?

Git Cola includes an "Apply Patches" dialog that can be launched from the Actions menu, or via the git cola am sub-command. You can open patches in this dialog and display the contents with diff syntax highlighting. This feature is available in master by cloning the repo and will be in the upcoming v3.


2 Answers

Try using kompare - http://www.caffeinated.me.uk/kompare/. It should do the job.

EDIT: Also, check out the list of file comparison tools here: http://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools - have a look at the column "Patch preview" in one of the tables.

like image 192
pako Avatar answered Oct 11 '22 23:10

pako


Have a look at idiff

like image 32
pixelbeat Avatar answered Oct 11 '22 23:10

pixelbeat