I have a script which generates a diff as I need it (in a certain way commits are selected for comparison, specify the required settings). The result of the script I would like to display in the console and in a GUI.
That is, I need a tool that takes as input a ready
diff file and just displays it. The main requirement is to share the diff files and display separately for each file. It is desirable to have syntax highlighting diff (so that the deleted lines were distinguished from the added color, and not only familiar in the beginning). It is also very important to be able to copy text from the viewer, at least line by line.
I thought these tools a lot. However, after going through almost all the utilities from the list issued on my platform command
git difftool --tool-help
, was able to locate only mode in the program Kompare
cat data.diff | kompare -
Unfortunately, Kompare does not support copying text, you can only watch. And writes it to the developer, this functionality does not appear — this requires to rewrite all the display.
Maybe there is some other alternative for this problem? Once again, I don't need a generator diff, you only need the viewer.Platform:
Linux (Kubuntu). But the best cross-platform, so you can run at least on Windows.Example usage
Suppose I have the following diff-file named
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 @@
* record bar **#1**;
-* record bar **#2**;
+* the record bar **#2**:
+ * the record bar **#2.1**;
+ * the record bar **#2.2**;
* record bar **#3**;
* record bar **#4**;
* record bar **#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**.
cat data.diff | kompare -
Now run Midnight Commander (mc):
I launched it in the directory where
, and then in the left tab I went inside a diff file like in directory (note the path in the left tab:
Now open the virtual file changes only the file
Thus we see that the programs share the diff file into pieces corresponding to the different files, display the tree of files and allow you to switch between them, looking at changes for each of them individually.
Again I will explain what I do not fit the above options:
- Kompare does not allow you to copy text, you can only watch. Doesn't fit at all.
- mc, in principle, suitable for all, but it's a console application. I would be much easier to use a GUI app.