From bb11a2ad1c726e17af67b20b254c5165a54918d2 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 29 May 2012 09:40:48 +0200 Subject: [PATCH] --user option added to limit output --- README.md | 1 + bin/gitlog2timesheet.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c5f11f7..a6e7bb0 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Usage repository/project -f FORMAT, --outputformat=FORMAT output format text, csv (default is text) + -u USER, --user=USER limit timesheet to the user specified Sample output diff --git a/bin/gitlog2timesheet.py b/bin/gitlog2timesheet.py index 33763aa..6e50797 100644 --- a/bin/gitlog2timesheet.py +++ b/bin/gitlog2timesheet.py @@ -61,6 +61,7 @@ parser.add_option("-d", "--debug", action="store_true", dest="debug", help="outp parser.add_option("-w", "--commitfactor", dest="commitfactor", help="work time factor per commit, default is 4 hours",default=4, type="int") parser.add_option("-t", "--total", action="store_true", dest="total", help="total hours worked for each user per repository/project", default=False) parser.add_option("-f", "--outputformat", dest="format", help="output format text, csv (default is text)", default="text", type="string") +parser.add_option("-u", "--user", dest="user", help="limit timesheet to the user specified", default=None, type="string") (options, args) = parser.parse_args() @@ -77,8 +78,9 @@ for repo in args: try: (name, email, when, message) = line.split("|") except: - continue - print logmessage(name=unicode(name), email=email, when=float(when), commitfactor = options.commitfactor, message=unicode(message), repo = os.path.basename(os.path.normpath(repo)), format=options.format) + continue + if name == options.user or options.user is None: + print logmessage(name=unicode(name), email=email, when=float(when), commitfactor = options.commitfactor, message=unicode(message), repo = os.path.basename(os.path.normpath(repo)), format=options.format)