diff options
| author | Teng-Hui Zhu <ztenghui@google.com> | 2010-11-10 15:31:59 -0800 |
|---|---|---|
| committer | Teng-Hui Zhu <ztenghui@google.com> | 2010-11-17 13:35:59 -0800 |
| commit | 28040489d744e0c5d475a88663056c9040ed5320 (patch) | |
| tree | c463676791e4a63e452a95f0a12b2a8519730693 /WebKitTools/Scripts/webkitpy/style/optparser.py | |
| parent | eff9be92c41913c92fb1d3b7983c071f3e718678 (diff) | |
| download | external_webkit-28040489d744e0c5d475a88663056c9040ed5320.zip external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.gz external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.bz2 | |
Merge WebKit at r71558: Initial merge by git.
Change-Id: Ib345578fa29df7e4bc72b4f00e4a6fddcb754c4c
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/style/optparser.py')
| -rw-r--r-- | WebKitTools/Scripts/webkitpy/style/optparser.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/WebKitTools/Scripts/webkitpy/style/optparser.py b/WebKitTools/Scripts/webkitpy/style/optparser.py index 3ba0fae..f4e9923 100644 --- a/WebKitTools/Scripts/webkitpy/style/optparser.py +++ b/WebKitTools/Scripts/webkitpy/style/optparser.py @@ -145,6 +145,7 @@ class CommandOptionValues(object): def __init__(self, filter_rules=None, git_commit=None, + diff_files=None, is_verbose=False, min_confidence=1, output_format="emacs"): @@ -163,6 +164,7 @@ class CommandOptionValues(object): self.filter_rules = filter_rules self.git_commit = git_commit + self.diff_files = diff_files self.is_verbose = is_verbose self.min_confidence = min_confidence self.output_format = output_format @@ -174,6 +176,8 @@ class CommandOptionValues(object): return False if self.git_commit != other.git_commit: return False + if self.diff_files != other.diff_files: + return False if self.is_verbose != other.is_verbose: return False if self.min_confidence != other.min_confidence: @@ -214,6 +218,8 @@ class ArgumentPrinter(object): flags['filter'] = ",".join(filter_rules) if options.git_commit: flags['git-commit'] = options.git_commit + if options.diff_files: + flags['diff_files'] = options.diff_files flag_string = '' # Alphabetizing lets us unit test this method. @@ -308,6 +314,9 @@ class ArgumentParser(object): parser.add_option("-g", "--git-diff", "--git-commit", metavar="COMMIT", dest="git_commit", help=git_commit_help,) + diff_files_help = "diff the files passed on the command line rather than checking the style of every line" + parser.add_option("--diff-files", action="store_true", dest="diff_files", default=False, help=diff_files_help) + min_confidence_help = ("set the minimum confidence of style errors " "to report. Can be an integer 1-5, with 1 " "displaying all errors. Defaults to %default.") @@ -409,6 +418,7 @@ class ArgumentParser(object): filter_value = options.filter_value git_commit = options.git_commit + diff_files = options.diff_files is_verbose = options.is_verbose min_confidence = options.min_confidence output_format = options.output_format @@ -420,10 +430,6 @@ class ArgumentParser(object): # Validate user-provided values. - if paths and git_commit: - self._parse_error('You cannot provide both paths and a git ' - 'commit at the same time.') - min_confidence = int(min_confidence) if (min_confidence < 1) or (min_confidence > 5): self._parse_error('option --min-confidence: invalid integer: ' @@ -442,6 +448,7 @@ class ArgumentParser(object): options = CommandOptionValues(filter_rules=filter_rules, git_commit=git_commit, + diff_files=diff_files, is_verbose=is_verbose, min_confidence=min_confidence, output_format=output_format) |
