From db58dea6a5c8a225ae2a2f8a054edef996ce71ee Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Sat, 14 Jun 2008 18:25:46 +0200 Subject: [PATCH] gitstats: Added a todo to check the file passed to "stats.py commit" There should be a check to see if the specified is tracked by git. If it is not checked, the parser should be use to signal incorrect usage. --- src/git_stats/commit.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/git_stats/commit.py b/src/git_stats/commit.py index 4d355e5..f1865ac 100644 --- a/src/git_stats/commit.py +++ b/src/git_stats/commit.py @@ -278,12 +278,13 @@ def _isUnique(options, atLeastOne=False): # None found, so unique only if we don't require at least one return not atLeastOne -def _checkOptions(parser, options): +def _checkOptions(parser, options, args): """Checks the specified options and uses the parser to indicate errors Args: parser: The parser to use to signal when the options are bad. options: The options to check. + args: The arguments to check, if used. """ opts = [options.touched, options.log_contains, options.diff_contains, options.all] @@ -291,8 +292,13 @@ def _checkOptions(parser, options): if not _isUnique(opts, True): parser.error("Please choose exactly one mode") - if options.relative and not options.touched: - parser.error("-r makes no sense without -t") + if not options.touched: + if options.relative: + parser.error("-r makes no sense without -t") + else: + pass + + # TODO check if git is tracking the file specified in args def dispatch(*args): """Dispatches commit related commands @@ -332,7 +338,7 @@ def dispatch(*args): (options, args) = parser.parse_args(list(args)) - _checkOptions(parser, options) + _checkOptions(parser, options, args) if options.touched: result = commitsThatTouched(args, options.relative) -- 2.11.4.GIT