Skip to main content

Library to parse and apply unified diffs

Project description

### Features

  • Automatic correction of * Linefeeds according to patched file * Diffs broken by stripping trailing whitespace * a/ and b/ prefixes

  • Single file, which is a command line tool and library

  • No dependencies outside Python stdlib

  • Patch format detection (SVN, HG, GIT)

  • Nice diffstat histogram

  • Linux / Windows / OX X

  • Python 2.5+ compatible, 2.6/2.7 tested

  • Test coverage

Things that don’t work out of the box:

  • Python 3

  • File renaming, creation and removal

  • Directory tree operations

  • Version control specific properties

  • Non-unified diff formats

### Usage

Download and run it with Python. It is a self-contained module without external dependencies. diff.patch

You can also run the .zip file.

python diff.patch

### Installation is self sufficient. You can copy it into your repository and use it from here. This setup will always be repeatable. But if you need to add patch module as a dependency, make sure to use strict specifiers to avoid hitting an API break:

pip install “patch>=1,<2”

With pip 6.x.x and later it is possible to use the alternative syntax:

pip install “patch==1.*”

### Changes

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution (11.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page