Created
April 11, 2017 15:56
-
-
Save PierrePaul/64822a6e31515b0210ca91dcaff35815 to your computer and use it in GitHub Desktop.
timetasks with git history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sh | |
from datetime import datetime, timedelta | |
user = input("Your name, in git : ") | |
if user == '': | |
user = 'Pierre Paul' | |
from_date = input("Starting date, with format YYYY-MM-DD : ") | |
end_date = input("End date, with same format : ") | |
if from_date == '': | |
from_date = '2017-03-13' | |
time_format = '%Y-%m-%d' | |
from_date = datetime.strptime(from_date, time_format) | |
if end_date is None or end_date == '': | |
end_date = from_date + timedelta(days=10) | |
else: | |
end_date = datetime.strptime(end_date, time_format) | |
current_date = from_date | |
git = sh.git.bake("log",'--pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]"', '--decorate', '--date=short') | |
# git = sh.git.bake("log",'--decorate', '--date=short') | |
while current_date != end_date: | |
current_date += timedelta(days=1) | |
current_date_filter = '{}-{:0>2}-{:0>2}'.format(current_date.year, current_date.month, current_date.day) | |
for log in git(_tty_out=False, _iter=True): | |
if user in log and current_date_filter in log: | |
print(log.replace('\n', '').replace('\r', '').replace('\\', '').replace('"','')) | |
input("Press enter for next date") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment