https://github.com/rec/myers
A tiny, generic implementation of the Myers diff algorithm
https://github.com/rec/myers
Last synced: about 1 year ago
JSON representation
A tiny, generic implementation of the Myers diff algorithm
- Host: GitHub
- URL: https://github.com/rec/myers
- Owner: rec
- License: mit
- Created: 2020-05-17T08:54:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-07T12:29:51.000Z (over 5 years ago)
- Last Synced: 2025-03-24T04:04:08.225Z (over 1 year ago)
- Language: Python
- Size: 27.3 KB
- Stars: 21
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELIST
- License: LICENSE
Awesome Lists containing this project
README
Myers diff of two lists or files
---------------------------------
Inspired by
https://gist.github.com/adamnew123456/37923cf53f51d6b9af32a539cdfa7cc4
API
===
``myers.diff(a, b, context=None, format=None)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(`myers.py, 25-60 `_)
Return the Myers diff of two lists.
The result is a list of (action, line) pairs,
where ``action`` is one of ``KEEP``, ``INSERT``, ``REMOVE``, or ``OMIT``
(which happen to be the characters k, i, r, and o).
ARGUMENTS:
``a``, ``b``:
The two files to compare
``context``:
How many lines of context to keep between blocks of changes?
``None``, the default, means keep all unchanged lines.
``0`` means throw away all the unchanged lines.
``format``:
If a dictionary, it is used to format
each diff entry. If true, the default dictionary above is
used to format the diff entries. Otherwise they are returned as-is.
(automatically generated by `doks `_ on 2020-11-07T12:19:33.047064)