Skip to main content

Generate Reports from Your Repository's Git History

Project description

⚠️☢️☣️ For this to work properly, it must be run within the main folder of a Git repository and Git must be installed. ☣️☢️⚠️

Git History Analyzer

https://pypi.org/project/git-history-analyzer/

This package provides a simple way to analyze the commit history of a specified file in a Git repository. It retrieves the complete commit history along with the changes made in each commit, allowing users to track modifications effectively.

Features

  • Retrieve commit history for a specific file.
  • Display details such as commit ID, author, date, and commit message.
  • Track line changes with added and removed lines.

Installation

You can install the package using pip:

pip install git-history-analyzer

Usage

Here's how to use the GitCommitsReportGenerator function:

Parameters

report_type=['blame', 'log_history'], print_details=False

  • list_files_to_read (list): list of The path to the files you want to analyze. Please use single slashes (/) for linux or double backslashes (\\) for windows, depending on the operating system you are using to avoid directory-related issues.
  • report_type (list) ['blame', 'log_history']
  • print_details (bool): If set to True, the function will print the details of each commit. Default is False.

Output

The function returns a list of dictionaries, where each dictionary contains:

  • Branch: The branch currently under analysis.
  • commit_id: The ID of the commit.
  • commit_author: The author of the commit.
  • commit_email: The author's email address.
  • commit_date: The date of the commit.
  • commit_message: The message associated with the commit.
  • changes: A list of changes, each detailing the type (added or removed), the line content, and the line number.

Reports Directory

for blame_report_main.py and log_history_main.py

📦 jorge_cardona_project [project_directory]  
┗ report [package]  
┃ ┣ 📂 blame [package]  
┃ ┃ ┣ blame_report_main.py  
┃ ┣ 📂 log_history [package]  
┃ ┃ ┣ log_history_main.py  
┗ 📂 deployment [package]  
┗ 📂 requirements [package]  
┗ 📂 test [package]  
┗ 🐍 main.py [__main__]  
┗ 📜 README.md  
┗ ⚠️ .gitignore  

Example blame report

from git_history_analyzer import GitCommitsReportGenerator

# Example usage
list_files_to_read = ['C:\\Users\\USUARIO\\Documents\\satellite_notifier\\main.py',
                      'C:\\Users\\USUARIO\\Documents\\satellite_notifier\\.github\workflows\\main.yml']

GitCommitsReportGenerator(list_files_to_read=list_files_to_read,
                            report_type=['blame'],
                            print_details=True)

Example Output - blame report

blame

git_blame_report

Example log_history report

from git_history_analyzer import GitCommitsReportGenerator

# Example usage
list_files_to_read = ['C:\\Users\\USUARIO\\Documents\\satellite_notifier\\main.py',
                      'C:\\Users\\USUARIO\\Documents\\satellite_notifier\\.github\workflows\\main.yml']

GitCommitsReportGenerator(list_files_to_read=list_files_to_read,
                            report_type=['log_history'],
                            print_details=True)

Example Output - log_history report

log_history

git_log_history_report

Log History and Blame Reports (Without Print Details)

from git_history_analyzer import GitCommitsReportGenerator

# Example usage
list_files_to_read = ['C:\\Users\\USUARIO\\Documents\\satellite_notifier\\main.py',
                      'C:\\Users\\USUARIO\\Documents\\satellite_notifier\\.github\workflows\\main.yml']

GitCommitsReportGenerator(list_files_to_read=list_files_to_read)

Example Output - log_history report (Without Print Details)

Alt text

git_blame_report

git_log_history_report

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

License

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

Contact

Project Link: GitHub Repository

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

git-history-analyzer-0.0.10.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

git_history_analyzer-0.0.10-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file git-history-analyzer-0.0.10.tar.gz.

File metadata

  • Download URL: git-history-analyzer-0.0.10.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for git-history-analyzer-0.0.10.tar.gz
Algorithm Hash digest
SHA256 92669bb60078744b6ee06ad3b5c52a0ebf74edd50768b0281259d6ef99fa8ed4
MD5 f65a8a912fe3ac2b3d550ded645e235c
BLAKE2b-256 601769c2f29c45dfad9b8b6a5413982d9a3bb2e401fccefc7cce0189ab557e1c

See more details on using hashes here.

File details

Details for the file git_history_analyzer-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for git_history_analyzer-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 2b6832f423c6e98dd482033a5dca205a206ac4cefb198ccbd0be41181f7055e5
MD5 fa113d7f757a68d868d9e06706e86ffb
BLAKE2b-256 b27270cd2d7bd0c30195e1f691f96bf7d4212a803a7fcac0f0bdb2484ef402d6

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