Skip to main content

Parse git diff data or .diff file. Access a list of properties including filenames, filepath, source-hash, target-hash and more for every file changed.

Project description

diff-parser

diff-parser is a Python package for parsing and representing diff files.

Parse a git diff data or .diff file. Access a list of properties including filenames, filepath, source-hash, target-hash and more for every file changed.

Installation

You can install diff-parser using pip:

pip install diff-parser

Usage

To use diff-parser, simply import the required modules and classes:

from diff_parser import Diff

# Example usage:
diff = Diff("path/to/diff/file.diff")
for block in diff:
    print(block.new_filename) # main.py
    print(block.new_filepath) # /path/to/main.py
    print(block.old_filename) # main.py
    print(block.old_filepath) # /path/to/main.py
    print(block.source_hash)  # abcdef
    print(block.target_hash)  # uvwxyz
    print(block.type)         # modified
    print(block.content)      # None (to be implemented)

Contributing

Contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

diff_parser-1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

diff_parser-1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file diff_parser-1.1.tar.gz.

File metadata

  • Download URL: diff_parser-1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.4

File hashes

Hashes for diff_parser-1.1.tar.gz
Algorithm Hash digest
SHA256 e7eed851078380319ba503d20cb8f382088e2f794b54c31ca79759b17bda2f40
MD5 51efc231b2f747c90c447dfb9aad0892
BLAKE2b-256 cd3e72fb3d2456b7749302f2adbbc1050a1f6bd1ab92504fe836d6509fe42528

See more details on using hashes here.

File details

Details for the file diff_parser-1.1-py3-none-any.whl.

File metadata

  • Download URL: diff_parser-1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.4

File hashes

Hashes for diff_parser-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a915aa00bfaed4e31e1c03bfc33a26ecdc5a00800cdbdecdbb83967b5f102a2b
MD5 4965b07e7165d66200c9ab4b745d99d1
BLAKE2b-256 a78b2b631b6a9652994db7562834b0c5ee991e11a059ff679f6a5935fc83dde3

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