diff options
author | Tobias Thierer <tobiast@google.com> | 2018-03-13 16:53:09 +0000 |
---|---|---|
committer | Tobias Thierer <tobiast@google.com> | 2018-03-13 17:04:02 +0000 |
commit | bc8f124f8fbe067d97558c56e9290a15abf9e214 (patch) | |
tree | bb477818140806e237b239153194ac88ce246b41 /tools | |
parent | 16a7c8e8fa569cf300ddb7eff92bb94607d54aaf (diff) |
upstream-diff tool: improve help text for command line parameters.
This CL makes the following improvements:
1. show default values through use of ArgumentDefaultsHelpFormatter;
it doesn't allow custom newlines, but it didn't seem worth fixing
with a custom formatter
2. show possible values for --repositories
Before this CL, the help text for --repositories reads:
-r REPOSITORIES, --repositories REPOSITORIES
Comma-separated list of >= 2 repositories to compare.
After this CL, the help text for --repositories reads:
-r REPOSITORIES, --repositories REPOSITORIES
Comma-separated list of 2-3 repositories, to compare,
in order; available repositories: ojluni 7u40
8u121-b13 8u60 9b113+ expected. (default:
ojluni,expected)
Test: Treehugger
Change-Id: Ide837281aeb342022476d231724db8f48699547b
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/upstream/upstream-diff | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/upstream/upstream-diff b/tools/upstream/upstream-diff index f52fdb5b03..359ffeeeb5 100755 --- a/tools/upstream/upstream-diff +++ b/tools/upstream/upstream-diff @@ -51,6 +51,7 @@ or to investigate which version of upstream introduced a change: import argparse import os +import os.path import subprocess import sys @@ -73,9 +74,17 @@ def run_diff(diff, repositories, rel_paths): def main(): parser = argparse.ArgumentParser( - description='Compare files between libcore/ojluni and ${OJLUNI_UPSTREAMS}.') + description='Compare files between libcore/ojluni and ${OJLUNI_UPSTREAMS}.', + formatter_class=argparse.ArgumentDefaultsHelpFormatter, # include default values in help + ) + upstreams = os.environ['OJLUNI_UPSTREAMS'] + # natsort.natsorted() would be a nicer sort order, but I'd rather avoid the dependency + repositories = ['ojluni'] + sorted( + [d for d in os.listdir(upstreams) if os.path.isdir(os.path.join(upstreams, d))] + ) parser.add_argument('-r', '--repositories', default='ojluni,expected', - help='Comma-separated list of >= 2 repositories to compare.') + help='Comma-separated list of 2-3 repositories, to compare, in order; ' + 'available repositories: ' + ' '.join(repositories) + '.') parser.add_argument('-d', '--diff', default='meld', help='Application to use for diffing.') parser.add_argument('rel_path', nargs="+", |