T
T
thewizardplusplus2016-04-28 01:00:52
git
thewizardplusplus, 2016-04-28 01:00:52

What tool can be used to view a ready-made diff file?

I have a script that generates diff the way I need it (commits are selected for comparison in a certain way, the required settings are set). I would like to view the result of the script's work not in the console, but in some GUI.
That is, I need a tool that takes a ready -made diff file as input and simply displays it. The main requirement is to separate diff by files and display separately for each file. It is desirable to have diff syntax highlighting (so that the deleted lines differ from the added ones by color, and not just by the sign at the beginning). It is also very important to be able to copy text from the viewer, at least line by line.
I thought there were many similar tools. However, after sorting through almost all the utilities from the list issued on my platform by the commandgit difftool --tool-help, could find the required mode only in the Kompare program ( cat data.diff | kompare -).
Unfortunately, Kompare does not support copying text, you can only watch. And as its developer writes, this functionality will not appear - this requires rewriting the entire display in general.
Is there any other alternative for this task? Once again I emphasize that I do not need a diff generator, I only need a viewer.
Platform: Linux (Kubuntu). But cross-platform is better so that you can run it at least on Windows.
Usage
example Let's say we have the following diff file named data.diff:

diff --unified -r foo-#1/bar/bar.md foo-#2/bar/bar.md
--- foo-#1/bar/bar.md	2016-04-30 00:04:13.176644057 +0300
+++ foo-#2/bar/bar.md	2016-04-30 00:03:51.864644969 +0300
@@ -1,7 +1,9 @@
 # Bar
 
 * bar record **#1**;
-* bar record **#2**;
+* bar record **#2**:
+	* bar record **#2.1**;
+	* bar record **#2.2**;
 * bar record **#3**;
 * bar record **#4**;
 * bar record **#5**;
diff --unified -r foo-#1/baz/baz.md foo-#2/baz/baz.md
--- foo-#1/baz/baz.md	2016-04-30 00:04:07.152644315 +0300
+++ foo-#2/baz/baz.md	2016-04-30 00:03:48.048645132 +0300
@@ -3,6 +3,10 @@
 * baz record **#1**;
 * baz record **#2**;
 * baz record **#3**;
-* baz record **#4**;
+* baz record **#4**:
+	* baz record **#4.1**;
+	* baz record **#4.2**;
+	* baz record **#4.3**;
+	* baz record **#4.4**;
 * baz record **#5**;
 * baz record **#6**.

Run Kompare:
cat data.diff | kompare -
816c26570f984a9f8084e8d06f3fdfd0.png
Now run Midnight Commander (mc):
cd8bf39531854ce69bf361b726d7ba94.png
I run it in the directory where it is data.diff, and then in the left tab I went inside the diff file as if in a directory (pay attention to the path in the left tab: data.diff/patchfs://foo-#1/bar).
Now let's open the virtual file of changes only for the file foo-#1/bar/bar:
fdef77609452476dac92aaba528c28a8.png
Thus, we see that the programs divide the diff file into pieces corresponding to different files, display a tree of these files and allow you to switch between them, viewing the changes for each of them individually.
Once again, I will explain why the above options do not suit me:
  • Kompare does not allow you to copy text, you can only watch. Doesn't fit at all.
  • mc, in principle, is suitable for everyone, but this is a console application. I would be much more comfortable using a GUI application.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
jcmvbkbc, 2016-04-29
@thewizardplusplus

In mc, you can go to .diff as in the directory with patches

V
Vladimir Olohtonov, 2016-04-28
@sgjurano

meld?

R
rettpop, 2016-04-28
@rettpop

> vim <src file>
after opening, you execute:
or you can immediately from the command line:
Haven't tested it on Windows, but I'm assuming it should work the same way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question