Skip to main content

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.

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.filname)    # main.py
    print(block.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


Release history Release notifications | RSS feed

This version

1.0

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.0.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

diff_parser-1.0-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

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