Skip to main content

Diff Patch Parsing Library

The parsedifflib package parses any style of diff patch into an event stream of patch instructions. These instructions can then be applied, colorized, reformatted, dissected, analyzed, etc.

Usage

import parsedifflib, subprocess

data = subprocess.check_output('svnlook diff /path/to/repos', shell=True)

for event, target in parsedifflib.parse_svnlook(data, {'lineNumbers': True}):

  if event in ( parsedifflib.Event.PATCH_START,
                parsedifflib.Event.PATCH_END,
                parsedifflib.Event.ENTRY_END,
                parsedifflib.Event.LINE_LOC,
                parsedifflib.Event.LINE_SAME,
                parsedifflib.Event.LINE_NOTE,
                parsedifflib.Event.PROPENTRY,
              ):
    continue

  elif event == parsedifflib.Event.ENTRY_START:
    print target.comment

  elif event == parsedifflib.Event.LINE_DELETE:
    print '  - deleted line %d: %s' % (target.oldnum, target.line)

  elif event == parsedifflib.Event.LINE_DELETE:
    print '  + added line %d: %s' % (target.newnum, target.line)

Credits

Much inspiration came from:

Metadata

Release files for parsedifflib 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for parsedifflib 0.2.0
File Size Uploaded Provenance Actions
parsedifflib-0.2.0.tar.gz 23.6 kB Without provenance Details for parsedifflib-0.2.0.tar.gz

Release files / parsedifflib-0.2.0.tar.gz

Download URL parsedifflib-0.2.0.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
beea7cf12b04a5639cec0c2064bfdc9dded55c1711272b3a73a5cf11e55ff3c3
BLAKE2b-256 checksum
How to use checksums
f6495b7452ae3651af0f47061e14d2a0738397651c093219b00dd0970486a63a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for parsedifflib 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file No provenance

0.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page