Packgage to provide git logs in csv
Project description
Python package for reading git logs
Example usage:
import argparse
import webbrowser
from datetime import datetime
import get_git_logs as gl
# Example
# python example_gl.py --git_folder <git_folder> --from_date 2023-08-01 --output_csv ~/git-functions/commit_logs.csv
def main():
parser = argparse.ArgumentParser(description='List Git commit logs for a given folder')
parser.add_argument('--git_folder', type=str, help='Path to the Git repository folder')
parser.add_argument('--from_date', type=str, help='Filter commits from the specified date (YYYY-MM-DD)')
parser.add_argument('--output_csv', type=str, help='Specify the output CSV file')
args = parser.parse_args()
git_folder = args.git_folder
from_date_str = args.from_date
from_date = datetime.strptime(from_date_str, '%Y-%m-%d') if from_date_str else None
commit_logs = gl.get_git_commit_logs(git_folder, from_date)
if args.output_csv:
output_csv = args.output_csv
gl.save_to_csv(commit_logs, output_csv)
print(f'Commit logs saved to {output_csv}')
# Copy CSV content to clipboard
with open(output_csv, 'r') as csv_file:
csv_content = csv_file.read()
gl.copy_to_clipboard(csv_content)
print('CSV content copied to clipboard')
# Open the specified URL with the CSV data
web_url = f'https://mohan-chinnappan-n5.github.io/viz/datatable/dt.html?c=csv'
webbrowser.open(web_url)
else:
print('Commit Logs:')
for commit in commit_logs:
print(commit)
main()
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
File details
Details for the file gitlogs_mohanchinnappan-0.0.11.tar.gz
.
File metadata
- Download URL: gitlogs_mohanchinnappan-0.0.11.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abe3387721c29662f395921c88d5a4aa8780df3b2fd36365d4f6af2726d7b092 |
|
MD5 | 144a63c72d7a72a5fcb1b45f8a5ca72a |
|
BLAKE2b-256 | 27e0377ba51767f832387822434f6a0116011342929a6bf47b701e2ab28fedff |
File details
Details for the file gitlogs_mohanchinnappan-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: gitlogs_mohanchinnappan-0.0.11-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7001d6646b605f076573f5eb8b2bdb4823dff2d858f8820d20f03689766d903 |
|
MD5 | 120d2588bb02e524025845888cd269db |
|
BLAKE2b-256 | c91a98511847e077d24a92e00d56ffacba28ef5da2bffb2a6caebbf53a776c72 |