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 patch.py and run it with Python. It is a self-contained module without external dependencies.

patch.py diff.patch

You can also run the .zip file.

python patch-1.15.zip diff.patch

### Installation

patch.py 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

https://github.com/techtonik/python-patch/blob/master/doc/CHANGES.md

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

patch-1.15.zip (11.6 kB view details)

Uploaded Source

File details

Details for the file patch-1.15.zip.

File metadata

  • Download URL: patch-1.15.zip
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for patch-1.15.zip
Algorithm Hash digest
SHA256 c9ebda243e569dddf0eb87fd8e9cb1cbc02d63ff63abd4aa2204ace5d5fb833d
MD5 53077758f60fa068b9dd3e179d4d34df
BLAKE2b-256 e0b8bda6f5f559ad762c1d9b80a1ab5e7414421e390a1c241e944c95c4c0ad29

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page