Comments (3)
Looks like minimal differences like this are not reported by the underlying library being used, i.e. difflib._mdiff.
Per the mdiff spec:
def mdiff(self):
r"""The difflib._mdiff() function returns an interator which returns a
tuple: (from line tuple, to line tuple, boolean flag)
from/to line tuple -- (line num, line text)
line num -- integer or None (to indicate a context separation)
line text -- original line text with following markers inserted:
'\0+' -- marks start of added text
'\0-' -- marks start of deleted text
'\0^' -- marks start of changed text
'\1' -- marks end of added/deleted/changed text
boolean flag -- None indicates context separation, True indicates
either "from" or "to" line contains a change, otherwise False.
"""
return difflib._mdiff(self._get_old_text(), self._get_new_text())
And the output for your test files through mdiff is as follows:
(u'\x00-aaa\x01', u'\x00+aaa bbb ccc\x01')
So minimal differences would be a non-trivial change. Hope this helps shed some light on the issue. I also have a vested interest in this feature, but don't have enough python knowledge to make a change this substantial. May be good to look into a different difflib function?
from icdiff.
Yes, this looks like a bug in difflib
. Are you up for filing a bug against python?
from icdiff.
Similar to my comment on #58, it seems that difflib is sometimes able to do the correct thing, depending on the input. No, I've got no idea why it works the way it does! ;-)
import difflib
>>> list(difflib.ndiff(['aaa'], ['aaa bbb ccc']))
['- aaa', '+ aaa bbb ccc']
>>> list(difflib.ndiff(['aaaa'], ['aaaa bbb ccc']))
['- aaaa', '+ aaaa bbb ccc']
>>> list(difflib.ndiff(['aaaaa'], ['aaaaa bbb ccc']))
['- aaaaa', '+ aaaaa bbb ccc']
>>> list(difflib.ndiff(['aaaaaa'], ['aaaaaa bbb ccc']))
['- aaaaaa', '+ aaaaaa bbb ccc']
>>> list(difflib.ndiff(['aaaaaaa'], ['aaaaaaa bbb ccc']))
['- aaaaaaa', '+ aaaaaaa bbb ccc']
>>> list(difflib.ndiff(['aaaaaaaa'], ['aaaaaaaa bbb ccc']))
['- aaaaaaaa', '+ aaaaaaaa bbb ccc']
>>> list(difflib.ndiff(['aaaaaaaaa'], ['aaaaaaaaa bbb ccc']))
['- aaaaaaaaa', '+ aaaaaaaaa bbb ccc']
>>> list(difflib.ndiff(['aaaaaaaaaa'], ['aaaaaaaaaa bbb ccc']))
['- aaaaaaaaaa', '+ aaaaaaaaaa bbb ccc']
>>> list(difflib.ndiff(['aaaaaaaaaaa'], ['aaaaaaaaaaa bbb ccc']))
['- aaaaaaaaaaa', '+ aaaaaaaaaaa bbb ccc']
>>> list(difflib.ndiff(['aaaaaaaaaaaa'], ['aaaaaaaaaaaa bbb ccc']))
['- aaaaaaaaaaaa', '+ aaaaaaaaaaaa bbb ccc', '? ++++++++\n']
>>> list(difflib.ndiff(['aaaaaaaaaaaa'], ['aaaaaaaaaaaa bbbb ccc']))
['- aaaaaaaaaaaa', '+ aaaaaaaaaaaa bbbb ccc']
>>> list(difflib.ndiff(['aaaaaaaaaaaaa'], ['aaaaaaaaaaaaa bbbb ccc']))
['- aaaaaaaaaaaaa', '+ aaaaaaaaaaaaa bbbb ccc']
>>> list(difflib.ndiff(['aaaaaaaaaaaaaa'], ['aaaaaaaaaaaaaa bbbb ccc']))
['- aaaaaaaaaaaaaa', '+ aaaaaaaaaaaaaa bbbb ccc', '? +++++++++\n']
from icdiff.
Related Issues (20)
- Apt package? HOT 2
- update icdiff on pypi.org to latest version HOT 2
- ChangeLog does not mention versions newer than 1.9.4 HOT 1
- BUG: Filenames show as mismatch when using exclusions
- Bug report: configuration for `git icdiff` did not work HOT 2
- installing the latest release-2.0.0 requires different command than install instructions HOT 2
- icdiff doesn't work on windows HOT 2
- Add support to specify colors using RGB ? HOT 1
- Add Support for custom patch hunk headers (with some builtins) HOT 1
- It seems have some problem about utf-8 HOT 1
- git icdiff shows old filname for renamed files HOT 2
- Multi-version of the Python HOT 1
- Exit code 1 using process substitutions HOT 4
- Pip install with `--platform` showing ERROR HOT 2
- [issue] linux more shows empty line. ex) icdiff -N fileA fileB | more -60 HOT 1
- Config file HOT 1
- Feature Request: Add an option to output directories before the files (recursively) HOT 1
- icdiff hanging on large files HOT 5
- Not clear how to install icdiff HOT 2
- Publish wheels for icdiff HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icdiff.