21 questions
0 votes
0 answers
58 views
Does unified diff suffice for testing-purposed string comparison?
If we are going to implement tests to compare some inline outputs from the program and the expected outputs, we want to enforce different levels of "strictness": exact match exact match ...
1 vote
1 answer
1k views
How to parse git diff -U output using unidiff parser
I need hunks (lines added and deleted) with context so I used git diff -u to obtain a diff. I can do line.is_added to to obtain lines_added but those line will not include lines of context. How do I ...
7 votes
1 answer
7k views
Create unified diff text for diff2html in browser
Is there a library that produces unified diff from two strings that diff2html can use? I've tried difflib but the output does not seem to fit the requirements that diff2html needs. I need a .js ...
1 vote
1 answer
2k views
How do I identify & list unique hunks in a git commit?
I have a commit with a large number (hundreds) of similar hunks, and I'd like to list each unique hunk in the commit in order to compare them. I wrote the following GNU awk script, which writes each ...
6 votes
1 answer
9k views
Why does unified_diff method from the difflib library in Python leave out some characters?
I am trying to check for differences between lines. This is my code: from difflib import unified_diff s1 = ['a', 'b', 'c', 'd', 'e', 'f'] s2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'i', 'k', 'l', 'm', ...
1 vote
0 answers
287 views
Is there a way to display the index in the list using difflib.unified_diff?
I would like to compare text files and see what sorts of changes were made. Not only would I like to see the changes, but I would like to see where these words can be found in the new list. This is ...
0 votes
1 answer
250 views
Read Unified Diff & extract to excel
I have extracted the Code difference in Unified format from TFS. Now I want to read this diff text (unified format) and then extract it to an excel in a customized format. So what I ...
3 votes
1 answer
1k views
How to append filename to a unified diff label
I am writing a bash script that needs to display a diff between a remote file and my local copy. I am doing this through a command: filepath=/home/user/test.txt ssh $REMOTE_USER cat $filepath | diff -...
1 vote
1 answer
509 views
Reverse diff -u in python
I need to write a module in python that gets the output of a unix diff -u command and one of the files that were used to create that ouput and in return output the second file. The diff -u returns a ...
1 vote
1 answer
2k views
TortoiseSVN unified diff to working copy
In TortoiseSVN it's possible to view a revision's changes as a unified diff by right clicking it in the revision log, and clicking "show changes as unified diff". But that doesn't let me view my ...
0 votes
1 answer
97 views
Remove certain files from unfied diff
I have a patch to apply on legacy codebase. There are a lot of files named pom.xml is there, changes to which are to be skipped. How do I remove them from patch? sed '/^diff --git .*pom.xml$/,/^diff -...
2 votes
1 answer
2k views
tf diff /recursive /format:unified - how to not include folder names in output
I want to generate the diff between two versions in TFS as a unified diff file. I do tf diff $/TFSPATH/PROJECT/FOLDER /recursive /version:C12345~C12346 /format:unified The generated output contains ...
3 votes
1 answer
785 views
How to configure unified diff context via git-config?
How can I configure via git-config the unified context so that I don't have to always provide the -U or --unified option with a value?
4 votes
1 answer
5k views
How to create patch file between two revisions in TortoiseSVN?
I'm using TortoiseSVN 1.7 and want to create patch file between two revisions. I've searched, but these threads How do I create a patch from diff between revisions using TortoiseSVN? Creating a patch ...
19 votes
2 answers
15k views
From a kdiff3 file comparison, can I generate a diff in unified diff format?
I have a kdiff3 comparison in Windows, and I would like to save the comparison as a text file in unified diff format. I realize this is kind of a strange question. Usually, people already have the ...