Tag: svn
SVN Log Generator based on user history
I faced with the problem of writing reports. Most of cases what I do at work is the same as what I pushed to the repository. If you still use SVN (no idea why though) then you can use this script to show all your comments in svn log in this week. It shows logs only in current week.
log-generator.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
from datetime import date, timedelta import subprocess import sys login = None path = None if len(sys.argv) is not 0: for arg in sys.argv: if "--login=" in arg: login = arg.replace("--login=", "") if "--path=" in arg: path = arg.replace("--path=", "") if login is None: raise Exception("Login is required. Use --login=your_login") if path is None: raise Exception("Path is required. Use --path=your_login") date = date.today() startWeekDay = date if date.weekday() is not 0: startWeekDay -= timedelta(days=date.weekday()) bashCommand = 'svn log -r {' + str(startWeekDay) + '}:HEAD | sed -n \'/' + login + '/,/-----$/ p\'' # print bashCommand p = subprocess.Popen(bashCommand, stdout=subprocess.PIPE, shell=True, cwd=path) (output, err) = p.communicate() lines = output.split('\n') i = 0 for line in lines: if line.find("r") != 0 and line.find("--") != 0 and len(line) != 0: print " * " + line i += 1 |
Usage:
1 |
/usr/bin/python log-generator.py --login=strife --path=/absolute-path-to-repo |
Example Output:
1 2 3 |
* Added I18N to billing application #21 * Fixed issue #203 * Fixed issue #421 |