diff options
| author | Conley Owens <cco3@android.com> | 2015-01-02 20:56:25 +0000 | 
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-02 20:56:25 +0000 | 
| commit | 42e679b9f63086dc1a27aed2d99deb3c1da428fc (patch) | |
| tree | 266db16bcb5013eb967bd6b035dde236c34c73a7 /main.py | |
| parent | c8d882ae2a75c732ef590ef425a3039b8b04403e (diff) | |
| parent | 902665bce668a58996de657a65c5ae3002a8810b (diff) | |
| download | git-repo-42e679b9f63086dc1a27aed2d99deb3c1da428fc.tar.gz | |
Merge "add a global --color option"
Diffstat (limited to 'main.py')
| -rwxr-xr-x | main.py | 6 | 
1 files changed, 6 insertions, 0 deletions
| @@ -36,6 +36,7 @@ try: | |||
| 36 | except ImportError: | 36 | except ImportError: | 
| 37 | kerberos = None | 37 | kerberos = None | 
| 38 | 38 | ||
| 39 | from color import SetDefaultColoring | ||
| 39 | from trace import SetTrace | 40 | from trace import SetTrace | 
| 40 | from git_command import git, GitCommand | 41 | from git_command import git, GitCommand | 
| 41 | from git_config import init_ssh, close_ssh | 42 | from git_config import init_ssh, close_ssh | 
| @@ -69,6 +70,9 @@ global_options.add_option('-p', '--paginate', | |||
| 69 | global_options.add_option('--no-pager', | 70 | global_options.add_option('--no-pager', | 
| 70 | dest='no_pager', action='store_true', | 71 | dest='no_pager', action='store_true', | 
| 71 | help='disable the pager') | 72 | help='disable the pager') | 
| 73 | global_options.add_option('--color', | ||
| 74 | choices=('auto', 'always', 'never'), default=None, | ||
| 75 | help='control color usage: auto, always, never') | ||
| 72 | global_options.add_option('--trace', | 76 | global_options.add_option('--trace', | 
| 73 | dest='trace', action='store_true', | 77 | dest='trace', action='store_true', | 
| 74 | help='trace git command execution') | 78 | help='trace git command execution') | 
| @@ -113,6 +117,8 @@ class _Repo(object): | |||
| 113 | print('fatal: invalid usage of --version', file=sys.stderr) | 117 | print('fatal: invalid usage of --version', file=sys.stderr) | 
| 114 | return 1 | 118 | return 1 | 
| 115 | 119 | ||
| 120 | SetDefaultColoring(gopts.color) | ||
| 121 | |||
| 116 | try: | 122 | try: | 
| 117 | cmd = self.commands[name] | 123 | cmd = self.commands[name] | 
| 118 | except KeyError: | 124 | except KeyError: | 
