diff options
| author | Shawn O. Pearce <sop@google.com> | 2009-03-02 18:24:23 -0800 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2009-03-02 18:24:23 -0800 |
| commit | 47c1a63a07ebd67efac00ca9e0d877633aea5881 (patch) | |
| tree | 1d52cf3c114a4389a0ec79102604aa8ca6afdde7 /main.py | |
| parent | 559b846b17a5b720c1247d07e292150466f27f96 (diff) | |
| download | git-repo-47c1a63a07ebd67efac00ca9e0d877633aea5881.tar.gz | |
Add 'repo version' to describe what code we are running
I meant to have this in here, so clients can more easily report
what version of repo they are running.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'main.py')
| -rwxr-xr-x | main.py | 10 |
1 files changed, 10 insertions, 0 deletions
| @@ -46,6 +46,9 @@ global_options.add_option('-p', '--paginate', | |||
| 46 | global_options.add_option('--no-pager', | 46 | global_options.add_option('--no-pager', |
| 47 | dest='no_pager', action='store_true', | 47 | dest='no_pager', action='store_true', |
| 48 | help='disable the pager') | 48 | help='disable the pager') |
| 49 | global_options.add_option('--version', | ||
| 50 | dest='show_version', action='store_true', | ||
| 51 | help='display this version of repo') | ||
| 49 | 52 | ||
| 50 | class _Repo(object): | 53 | class _Repo(object): |
| 51 | def __init__(self, repodir): | 54 | def __init__(self, repodir): |
| @@ -69,6 +72,13 @@ class _Repo(object): | |||
| 69 | argv = [] | 72 | argv = [] |
| 70 | gopts, gargs = global_options.parse_args(glob) | 73 | gopts, gargs = global_options.parse_args(glob) |
| 71 | 74 | ||
| 75 | if gopts.show_version: | ||
| 76 | if name == 'help': | ||
| 77 | name = 'version' | ||
| 78 | else: | ||
| 79 | print >>sys.stderr, 'fatal: invalid usage of --version' | ||
| 80 | sys.exit(1) | ||
| 81 | |||
| 72 | try: | 82 | try: |
| 73 | cmd = self.commands[name] | 83 | cmd = self.commands[name] |
| 74 | except KeyError: | 84 | except KeyError: |
