Is there a diff tool that allows saving of the compare markup?
To clarify, I would like to save the actual comparison of the two files that shows the differences to send to someone for review.
EDIT
Lots of good answers here. In my case I already had a copy of Beyond Compare but didn't see the option. Thanks to John Saunders for pointing out the feature. It's "Session...Text Compare Report..." BTW.
My question was not specifically about Beyond Compare, so I am going to accept the answer that currently has the most up votes.
WinMerge is free and allows you to save the differences in various formats. It works well enough for me to not bother looking elsewhere, and I like the price.
There is also a portable version if you can't, or don't want to, install it.
You can do this with the command line diff if you're using Unix, though it sounds like you're not. Cygwin does bring a CLI diff, and Mac OS X ships with it.
$ diff <file> <other file> > mydiff.txt
Beyond Compare does this.
I use the Scintilla Text Editor (SciTE) to open a diff file generated by command line or WinMerge, and then export the RTF, and it preserves color highlighting of differences. I use this method especially when emailing short patches for review in-house, and I use Outlook, for example.
The process I used just now as an example:
# diff -U 1000 a.txt b.txt > diff.txt
# scite diff.txt
### Edit-Copy as RTF
### Paste into Outlook
http://imagebin.ca/img/nBG25am.png
WinMerge provides this functionality through the Tools->Generate Patch menu item. I use the MSYS tools on windows, so that I run GNU diff a lot, but once you get the output, I would use SciTE if you need something like the above.
ExamDiff does a comparison which is shown in a window. It can save a Unix-like formatted version of the differences. Also, the file-to-file comparison version of the program is free!
Related
I have recently switched from Sublime Text to VS Code (WIN10). I prefer VS Code now, as it' so much better, but I have something I can't figure out, and it seems crazy that there isn't a solution.
The VS Code Diff display is no good for actually editing, so I use Beyond Compare for all my diff-ing and merging.
I've searched high and low and can't find anything like a replacement for the ST3 plugin "FileDiffs" (https://packagecontrol.io/packages/FileDiffs).
I already have Beyond Compare set as my diff tool in .gitconfig, and I have the VS Code extensions for diff-ing with remote tools "when using Git" -- but what about when you just have two arbitrary files open in VS code, and I just want to open them in Beyond Compare?? This appears to be impossible in VS Code without using some very inefficient workaround.
(maybe I need to learn how to port a ST3 extension to VS Code...)
Check out PartialDiff: https://github.com/ryu1kn/vscode-partial-diff
Quoted from its docs,
You can compare (diff) text selections within a file, across different files, or to the clipboard.
Compare text in 2 visible editors (i.e. tabs) with one action.
I have a huge file with all the commands I use on and off the commandline. This file is getting harder to open and navigate as its size gets larger. I am looking for a commandline utility that makes this process easier. I found this gem, which does something similar to what I want, but it's terrible with long lines of code with multiple quotation marks.
What does everyone use to keep your code snippets and easily access it from your terminal?
I keep a similar file myself. This example isn't directly useful with your file. However when I find that I need to run a particular command I recently used, without looking it up again, I run a grep on history.
For example:
history | grep "svn co"
You may try Komandi, a multiplatform command snippets manager.
I have several regular expressions to find and replace text in documents in TextMate. I would like to be able to have them run in a batch. I made a macro and it worked, but any tiny modifications to the macro means re-recording the macro. And I can't seem to modify the regex within the TextMate interface. It's read-only for some reason.
Can I make it into a command? Does anyone know how? I tried to read the TextMate help about commands, but it wasn't much help. It seems I need prior knowledge of shell scripts or some sort (which I have none). Any advise in the direction would be great.
Thanx in advance.
First, it's possible to edit macros. Since this is the easiest solution for you, here is how you do it:
Record a new Macro and save it in TheBundleOfYourChoice
Reload Bundles via "Bundles" > "Bundle Editor" > "Reload Bundles"
Open the file "~/Library/Application Support/TextMate/Bundles/TheBundleOfYourChoice.tmbundle/Macros/NameOfYourMacro.tmMacro" in TextMate (you can access any path - including hidden ones - if you press Command-Shift-G while in the "Open File" dialog)
Change the XML-representation of the Macro to your needs
Reload Bundles again
Use updated Macro
This solution may be the easiest for you, because it doesn't require you to learn a scripting language and should be OK for minor changes. However another very reasonable approach is choosing a scripting language of your choice and simply build a command, which runs your regular expressions. You can use perl, python, ruby, bash and so forth. A simple solution should be bash with sed. sed is a small tool, whose only purpose is to process text and should be ideal for you. bash is the default scripting langauge, so should be no problem either. You will figure it out somehow and learn a lot. Give it a try! :)
I do something like "svn diff > /mystuff/current.diff". I want to view this .diff file with syntax highlighting.
jEdit does it, but it's a huge beast and it takes a while to start up. I want something lightweight/native.
Smultron/Fraise, TextWrangler, TextEdit, Dashcode don't seem to highlight .diff files.
FileMerge seems to want to generate diff files, not show you existing ones.
TextMate does the trick, but it's not free. I'd feel happier dropping $50 US if I was going to take advantage of it for anything more than a diff viewer.
Are there any alternatives to jEdit or TextMate that I should consider?
You could try an OSX GUI for vim, like the full-featured MacVim or the lightweight vim-cocoa...
(For a rough feature comparison, you can see this mailing list comment comparing them...)
You might Versions, you can download a free demo version that will work for a limited time. You point it directly at you svn repository and you can compare versions.
http://www.versionsapp.com/
I currently use DiffMerge and it works really well for me. (I'm forced to use StarTeam and it integrates well with it)
Not an editor but you could use GIT or Mercurial and their Mac GUI clients to view the highlighted diffs in any files. The clients are free.
In a terminal, one can also use the command line version of vim (which I believe comes with the Xcode command-line developer tools).
Unfortunately, the command-line version of vim is not set up to do syntax highlighting by default, so there's a little bit of additional magic necessary.
For those not versed in vim, you need to know these three commands in order to view diff files:
vim <file> // open the file in vim
:syntax on // turn on syntax highlighting
:q // exit vim when you're finished
Vim is good at automatically recognizing diff files, so it's usually not necessary, but if for some reason vim doesn't recognize your diff as a diff, you can tell it which syntax to use:
:set syn=diff
If your diff is of source code, you might also occasionally want to toggle back and forth between syntax highlighting of the diff and syntax highlighting of the code; you can also set the syntax to java, c, php, mysql, or sh, among others.
Our QA team wants to focus their testing based on what EXEs and DLLs have actually changed between builds. We have a nice svn change report, but the relationship between source and changed binaries isn't always obvious. The builds we're comparing are always full clean builds, so we can't use file system timestamps. I'm looking for tools to compare windows (and windows CE) PE binaries that will ignore the embedded timestamps and other cruft. Any recommendations for tools or other ways to generate a reliable 'what binaries have really changed' report? Thanks.
clarification: Thanks for the answers so far, but we can't generate the report by doing straightforward byte-for-byte compares or comparing checksums, because all the files appear different every time we build, even if the sources haven't changed, because of timestamps that the compiler inserts. The problem is how to ignore the false positives. The disassemble & compare idea is closest to what we need, I think...
answered! Bindiff is just what I was looking for. Many thanks.
Have you had a look at Bindiff?
I ran into this problem before. My solution was to write a tool which set all the timestamps in an .EXE/.DLL to a known value. I would run it as a post-build step. Then binary diffs would work just fine.
You could perhaps disassemble the binary, and then do a diff on the assembly...
This sounds like your QA team is taking the wrong approach though... It shouldn't matter to them what the code looks like; just that it does what it's supposed to do.
Edit:
Oh! After reading it again, I realized that I misinterpreted your question. I thought they wanted to test the methods that had changed...
In that case, why not get the MD5 hash and compare those? The tiniest change will cause a totally different hash to be generated.
Not sure what kind of binaries (DLLs? PE/WinCE executables only? Other?)Is it possible to embed version information in the binaries, e.g. using a source control tag that updates the version in the source code on commits. Then when the new build is created, the binary would have it's version string updated as well. Instead of having to diff a binary file, you could use the version string and check that for changes.
Look at NDepend.
When I was working on the "home grown" tool for installation verification at my company, we used Beyond Compare as a backend for comparison.
It has great file/folder comparison (binary as well) and scripting capabilities and can output XML reports.
Project dependency graph generator and Dependency-Grapher for C++-Projects both use GraphViz to visualize dependencies. I imagine that you could use either of them as a basis for your needs with special highlighting of the branches in the dependency graph where source files or other leaves have changed.
MD5 hashes or checksums (as suggested above), a simple diff ignoring whitespace and filtering out comment changes, or changlist information from your version control system can signal which files have changed.
gnu binutils specifically strings