diff

How do I diff utf-16 files with GNU diff?

跟風遠走 提交于 2019-11-30 11:06:47
GNU diff doesn't seem to be smart enough to detect and handle UTF-16 files, which surprises me. Am I missing an obvious command-line option? Is there a good alternative? From the GNU diff documentation: Handling Multibyte and Varying-Width Characters diff, diff3 and sdiff treat each line of input as a string of unibyte characters. This can mishandle multibyte characters in some cases. For example, when asked to ignore spaces, diff does not properly ignore a multibyte space character. Also, diff currently assumes that each byte is one column wide, and this assumption is incorrect in some

git diff algorithm that does not rip functions apart? (language-aware diff)

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 10:44:11
问题 Is it possible to configure git diff to respect indentation and syntax? I am not talking about ignoring indentation and spaces, but rather to use blank lines, indentation levels and possibly brackets, to help matching the old lines to new lines. E.g. git diff often cuts through functions and their docblock, like this: class C { /** + * Goes to the bar. + */ + function bar() { + return 'bar'; + } + + /** * Gets your foo up to date. */ function foo() { When I would prefer class C { + + /** + *

Are there any tools out there to compare the structure of 2 web pages?

。_饼干妹妹 提交于 2019-11-30 10:29:06
I receive HTML pages from our creative team, and then use those to build aspx pages. One challenge I frequently face is getting the HTML I spit out to match theirs exactly. I almost always end up screwing up the nesting of <div> s between my page and the master pages. Does anyone know of a tool that will help in this situation -- something that will compare 2 pages and output the structural differences? I can't use a standard diff tool, because IDs change from what I receive from creative, text replaces lorem ipsum , etc.. You can use HTMLTidy to convert the HTML to well-formed XML so you can

DIFF utility works for 2 files. How to compare more than 2 files at a time?

旧巷老猫 提交于 2019-11-30 10:24:10
问题 So the utility Diff works just like I want for 2 files, but I have a project that requires comparisons with more than 2 files at a time, maybe up to 10 at a time. This requires having all those files side by side to each other as well. My research has not really turned up anything, vimdiff seems to be the best so far with the ability to compare 4 at a time. My question: Is there any utility to compare more than 2 files at a time, or a way to hack diff/vimdiff so it can do multiple comparisons

Using mercurial and beyond compare 3(bc3) as the diff tool?

我的梦境 提交于 2019-11-30 10:17:57
问题 in windows I am able to use winmerge as the external diff tool for hg using mercurial.ini ,etc. Using some options switch that you can find in web(I think it's a japanese website) Anyway, here for example: hg winmerge -r1 -r2 will list file(s) change(s) between rev1 and rev2 in winmerge. I can just click which file to diff but for bc3: hg bcomp -r1 -r2 will make bc3 open a dialog which stated that a temp dir can't be found. The most I can do using bc3 and hg is hg bcomp -r1 -r2 myfile.cpp

How to create a patch for a whole directory to update it?

情到浓时终转凉″ 提交于 2019-11-30 10:14:25
问题 I know there are several threads on this already, but no one has fully explained exactly how to perform the initial diff to create the patch file, then how to apply that patch to the initial directory to update it. In my case, there is a directory of files that anyone can download from the web. I have taken that directory and made changes to it, and want to create a patch file such that others can apply it to the downloaded directory to reproduce exactly what I have in my modified directory.

Fastest way to tell if two files are the same in Unix/Linux?

爱⌒轻易说出口 提交于 2019-11-30 10:04:25
问题 I have a shell script in which I need to check whether two files are the same or not. I do this a for a lot of files, and in my script the diff command seems to be the performance bottleneck. Here's the line: diff -q $dst $new > /dev/null if ($status) then ... Could there be a faster way to compare the files, maybe a custom algorithm instead of the default diff ? 回答1: I believe cmp will stop at the first byte difference: cmp --silent $old $new || echo "files are different" 回答2: I like @Alex

How to efficiently work with gettext PO files when making small edits to large text values

拈花ヽ惹草 提交于 2019-11-30 09:16:19
Looking for tips and/or tools on how to efficiently work with gettext PO files when making small edits to large msgid values. Example: We have lots of multi-sentence/multi-paragraph messages that are stored in our PO message catalog files. If we make a very minor change to a message, perhaps editing a single sentence or even correcting punctuation, we lose our original translation when we run the msgmerge utility. Rather than re-translate long messages (that have already gone through an editorial approval process) from scratch, our translators return to backup copies of their PO files and

Implementing Google's DiffMatchPatch API for Python 2/3

对着背影说爱祢 提交于 2019-11-30 09:10:25
I want to write a simple diff application in Python using Google's Diff Match Patch APIs . I'm quite new to Python, so I want an example of how to use the Diff Match Patch API for semantically comparing two paragraphs of text. I'm not too sure of how to go about using the diff_match_patch.py file and what to import to from it. Help will be much appreciated! Additionally, I've tried using difflib , but I found it ineffective for comparing largely varied sentences. I'm using ubuntu 12.04 x64. Google's diff-match-patch API is the same for all languages that it is implemented in (Java, JavaScript,

Diff algorithms

一曲冷凌霜 提交于 2019-11-30 09:06:32
Can somebody recommend some papers (literature) or code snippets about tree-based diff algorithms for XML (based on the DOM-tree) Thank you very much. Here is one useful paper on the same : http://pdf.aminer.org/000/301/327/x_diff_an_effective_change_detection_algorithm_for_xml_documents.pdf Here is one tool you can experiment with: http://www.cs.hut.fi/~ctl/3dm/ You may find the Java source for the above tool as well which maybe of great use. 来源: https://stackoverflow.com/questions/12533221/diff-algorithms