diff

Only include files that match a given pattern in a recursive diff

时光怂恿深爱的人放手 提交于 2019-12-03 06:57:46
问题 How can you perform a recursive diff of the files in two directories (a and b): $ diff -r a b but only look at files whose name matches a given pattern. For example, using the same syntax available in the find command, this would look like: $ diff -r a b -name "*crazy*" which would show diffs between files with the same name and path in a and b, which have "crazy" in their name. Effectively, I'm looking for the opposite of the --exclude option which is available in diff. 回答1: Perhaps this is

How to display word differences using c#?

橙三吉。 提交于 2019-12-03 06:40:02
问题 I would like to show differences between two blocks of text. Rather than comparing lines of text or individual characters, I would like to just compare words separated by specified characters ('\n', ' ', '\t' for example). My main reasoning for this is that the block of text that I'll be comparing generally doesn't have many line breaks in it and letter comparisons can be hard to follow. I've come across the following O(ND) logic in C# for comparing lines and characters, but I'm sort of at a

How to configure Beyond Compare 3 for Eclipse conflict resolution?

喜你入骨 提交于 2019-12-03 06:31:23
What is the correct parameters to get Beyond Compare 3 working with Eclipse/Subclipse conflict resolution? In Preferences > Team > SVN > Diff/Merge there's the option to specify an external program to resolve conflicts. The default parameters are: "${yours}" "${theirs}" "${base}" "${merged}" And it suggests TortoiseMerge settings of this: /theirs:"${theirs}" /base:"${base}" /mine:"${yours}" /merged:"${merged}" But what is the appropriate config for Beyond Compare? Looks like this is correct: "${theirs}" "${yours}" "${base}" "${merged}" Based on this forum post: http://www.scootersoftware.com

How to programmatically merge text files with potential conflicts (ala git or svn, etc)?

我与影子孤独终老i 提交于 2019-12-03 06:15:32
As part of a larger project, I want the ability to take two bodies of text and hand them to a merge algorithm which returns either an auto-merged result (in cases where the changes are not conflicting) or throws an error and (potentially) produces a single text document with the conflicting changes highlighted. Basically, I just want a programmatic way to do what every source control system on the planet does internally, but I'm having a hard time finding it. There are tons of visual GUIs for doing this sort of thing that dominate my search results, but none of them seem to make easily

Manually merge two files using diff

徘徊边缘 提交于 2019-12-03 06:12:05
I'd like to merge two files by doing the following: Output the diff of the two files into a temp file and Manually select the lines I want to copy/save. The problem here is that diff -u only gives me a file lines of context, while I want to output the entire file in a unified format. Is there any way diff can do this? "I want to output the entire file in a unified format. Is there any way diff can do this?" Yes. diff -U 9999999 file1.txt file2.txt > diff.txt This should work, provided your files are less than 10 million lines long. One option that might fit the bill for you, sdiff : side-by

How can I perform a diff that ignores all comments?

 ̄綄美尐妖づ 提交于 2019-12-03 06:07:50
I have a large codebase that was forked from the original project and I'm trying to track down all the differences from the original. A lot of the file edits consist of commented out debugging code and other miscellaneous comments. The GUI diff/merge tool called Meld under Ubuntu can ignore comments, but only single line comments. Is there any other convenient way of finding only the non-comment diffs, either using a GUI tool or linux command line tools? In case it makes a difference, the code is a mixture of PHP and Javascript, so I'm primarily interested in ignoring // , /* */ and # . To use

Diff tool for Mac without saving text to files [closed]

江枫思渺然 提交于 2019-12-03 06:00:51
I use meld on Linux and I am able to compare two pieces of text without having to save them in files. Is there something similar for Mac and Windows? NotePad++ with the Compare plugin on Windows: http://sourceforge.net/projects/npp-compare/ TextWrangler for OS X does a nice diff of either files on disk or documents being edited. That would allow you to make two empty docs, paste your text into each of them and run the diff. The meld tool has been ported to Mac OS X and is available via "fink" . Another link is this one. You will need to install fink first however, and I believe you can get

How can I diff two files with full context?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 05:41:54
I have two files with slight differences. A normal diff will show me the differences between the files. With -c or -u I can add an amount of context to each hunk. What options can I pass to diff to see every unchanged line alongside the changes, and get the diff as a single, large hunk? Use the "-y" option for full side by side output diff -y file1 file2 Will give you output something like * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * Lorem ipsum dolor sit amet, consectetuer adipiscing elit. * Praesent fringilla facilisis pede. * Praesent fringilla facilisis pede. * Nulla sit

Is it possible to have all “git diff” commands use the “Python diff”, in all git projects?

一笑奈何 提交于 2019-12-03 05:29:50
When including the line *.py diff=python in a local .gitattributes file, git diff produces nice labels for the different diff hunks of Python files (with the name of the function where the changes are, etc.). Is is possible to ask git to use this diff mode for all Python files across all git projects? I tried to set a global ~/.gitattributes, but it is not used by local git repositories. Is there a more convenient method than initializing each new git project with a ln -s ~/.gitattributes ? Quoting from gitattributes(5) : Attributes that should affect all repositories for a single user should

Hamming Distance vs. Levenshtein Distance

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 05:25:55
问题 For the problem I'm working on, finding distances between two sequences to determine their similarity, sequence order is very important. However, the sequences that I have are not all the same length, so I pad any deficient strings with empty points such that both sequences are the same length in order to satisfy the Hamming distance requirement. Is there any major problem with me doing this, since all I care about are the number of transpositions (not insertions or deletions like Levenshtein