diff

Any decent text diff/merge engine for .NET? [closed]

浪尽此生 提交于 2019-11-26 09:54:38
Requirements: free, preferably open-source implemented in one of the .NET managed langs Google found these: A Generic, Reusable Diff Algorithm on codeproject An O(ND) Difference Algorithm for C# Diff/Merge/Patch Library for C#/.NET by Joshua Tauberer EDIT: No apps please, only libraries. Cheeso You can grab the COM component that uses Google's Diff/Patch/Match . It works from .NET. Update, 2010 Oct 17 : The Google Diff/Patch/Merge code has been ported to C#. The COM component still works, but if you're coming from .NET, you'll wanna use the .NET port directly. Anheledir I think the "Generic -

Recursive diff of two python dictionaries (keys and values)

老子叫甜甜 提交于 2019-11-26 09:41:08
问题 So I have a python dictionary, call it d1 , and a version of that dictionary at a later point in time, call it d2 . I want to find all the changes between d1 and d2 . In other words, everything that was added, removed or changed. The tricky bit is that the values can be ints, strings, lists, or dicts, so it needs to be recursive. This is what I have so far: def dd(d1, d2, ctx=\"\"): print \"Changes in \" + ctx for k in d1: if k not in d2: print k + \" removed from d2\" for k in d2: if k not

Is there a Java library that can “diff” two Objects?

我怕爱的太早我们不能终老 提交于 2019-11-26 09:18:09
问题 Is there a Java utility library that is analogous to the Unix program diff, but for Objects? I\'m looking for something that can compare two objects of the same type and generate a data structure that represents the differences between them (and can recursively compare differences in instance variables). I\'m not looking for a Java implementation of a text diff. I\'m also not looking for help with how to use reflection to do this. The application I\'m maintaining has a fragile implementation

Text difference algorithm

和自甴很熟 提交于 2019-11-26 08:58:17
问题 I need an algorithm that can compare two text files and highlight their difference and ( even better!) can compute their difference in a meaningful way (like two similar files should have a similarity score higher than two dissimilar files, with the word \"similar\" defined in the normal terms). It sounds easy to implement, but it\'s not. The implementation can be in c# or python. Thanks. 回答1: In Python, there is difflib, as also others have suggested. difflib offers the SequenceMatcher class

Can I use git diff on untracked files?

情到浓时终转凉″ 提交于 2019-11-26 08:57:57
问题 Is it possible to ask git diff to include untracked files in its diff output? Or is my best bet to git add the new files I\'ve created and the existing files I have edited, and use git diff --cached ? 回答1: With recent git versions you can git add -N the file (or --intent-to-add ), which adds a zero-length blob to the index at that location. The upshot is that your "untracked" file now becomes a modification to add all the content to this zero-length file, and that shows up in the "git diff"

Filter git diff by type of change

独自空忆成欢 提交于 2019-11-26 08:46:43
问题 Is there a way to limit git diff to changed files? I\'d like to see the differences between two commits, but exclude paths that don\'t exist in one or the other (additions/deletions). The following Perl one-liner illustrates most of what I want: git diff master.. | perl -lnwe \'print unless /^(new|deleted) file/../^diff/ and not /^diff/\' But that leaves diff --git a/path b/path lines for the files that were new or deleted. Plus it\'d be much nicer if I didn\'t have to parse (also fails if

Coloring white space in git-diff's output

纵然是瞬间 提交于 2019-11-26 08:45:50
问题 Regarding code formatting I\'m kind of purist :). I very often remove unnecessary white spaces (lines with only ws, ws at the end of lines etc). I even have set vim to show that kind of lines colored to red. My problem is that using git-diff I often see something like this: - else{ + else{ Even if I have git-diff colored I can\'t see difference (in that particular situation I removed 1 ws at the end of line). Is there any way to tell git-diff to show that ws colored to red? (for example those

Coloured Git diff to HTML

泪湿孤枕 提交于 2019-11-26 08:45:45
问题 I enjoy using git diff --color-words to clearly see the words that have changed in a file: However I want to share that diff with someone without git or a colour terminal for that matter. So does anyone know of a tool or trick that can convert colour escaped terminal output into HTML? 回答1: wget "http://www.pixelbeat.org/scripts/ansi2html.sh" -O /tmp/ansi2html.sh chmod +x /tmp/ansi2html.sh git diff --color-words --no-index orig.txt edited.txt | \ /tmp/ansi2html.sh > 2beshared.html What I

Given two directory trees, how can I find out which files differ?

老子叫甜甜 提交于 2019-11-26 08:38:32
问题 If I want find the differences between two directory trees, I usually just execute: diff -r dir1/ dir2/ This outputs exactly what the differences are between corresponding files. I\'m interested in just getting a list of corresponding files whose content differs. I assumed that this would simply be a matter of passing a command line option to diff , but I couldn\'t find anything on the man page. Any suggestions? 回答1: You said Linux, so you luck out (at least it should be available, not sure

Calculate text diffs in PHP [duplicate]

淺唱寂寞╮ 提交于 2019-11-26 08:24:25
问题 This question already has an answer here: Highlight the difference between two strings in PHP 12 answers Are there any libraries (3rd party or built-in) in PHP to calculate text diffs? 回答1: What sort of diffs? File diffs? There is array_diff() which acts on arrays. Then there is also xdiff, which "enables you to create and apply patch files containing differences between different revisions of files.". The latter acts on files or strings. Edit: I should add xdiff doesn't appear to be out in a