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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7eed851078380319ba503d20cb8f382088e2f794b54c31ca79759b17bda2f40
|
|
| MD5 |
51efc231b2f747c90c447dfb9aad0892
|
|
| BLAKE2b-256 |
cd3e72fb3d2456b7749302f2adbbc1050a1f6bd1ab92504fe836d6509fe42528
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a915aa00bfaed4e31e1c03bfc33a26ecdc5a00800cdbdecdbb83967b5f102a2b
|
|
| MD5 |
4965b07e7165d66200c9ab4b745d99d1
|
|
| BLAKE2b-256 |
a78b2b631b6a9652994db7562834b0c5ee991e11a059ff679f6a5935fc83dde3
|