https://github.com/breezy-team/patiencediff
Patiencediff implementation
https://github.com/breezy-team/patiencediff
diff patiencediff python python3
Last synced: 2 months ago
JSON representation
Patiencediff implementation
- Host: GitHub
- URL: https://github.com/breezy-team/patiencediff
- Owner: breezy-team
- License: gpl-2.0
- Created: 2018-07-11T20:18:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-04-07T11:01:23.000Z (2 months ago)
- Last Synced: 2025-04-07T12:21:46.949Z (2 months ago)
- Topics: diff, patiencediff, python, python3
- Language: Python
- Size: 248 KB
- Stars: 16
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: COPYING
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Authors: AUTHORS
Awesome Lists containing this project
README
patiencediff
############This package contains the implementation of the ``patiencediff`` algorithm, as
`first described `_ by Bram Cohen.Like Python's ``difflib``, this module provides both a convenience ``unified_diff``
function for the generation of unified diffs of text files
as well as a SequenceMatcher that can be used on arbitrary lists.Patiencediff provides a good balance of performance, nice output for humans,
and implementation simplicity.The code in this package was extracted from the `Bazaar `_
code base.The package comes with two implementations:
* A Python implementation (_patiencediff_py.py); this implementation only
requires a Python interpreter and is the more readable version of the two* A C implementation implementation (_patiencediff_c.c); this implementation
is faster, but requires a C compiler and is less readableUsage
=====To invoke patiencediff from the command-line::
python -m patiencediff file_a file_b
Or from Python::
>>> import patiencediff
>>> print(''.join(patiencediff.unified_diff(
... ['a\n', 'b\n', 'b\n', 'c\n'],
... ['a\n', 'c\n', 'b\n'])))
---
+++
@@ -1,4 +1,3 @@
a
+c
b
-b
-c