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
diff = Diff("path/to/diff/file.diff")
for block in diff:
print(block.new_filename)
print(block.new_filepath)
print(block.old_filename)
print(block.old_filepath)
print(block.source_hash)
print(block.target_hash)
print(block.type)
print(block.content)
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.