Merge lp:~jdahlin-deactivatedaccount/bzr-grep/color-option into lp:bzr-grep

Proposed by Johan Dahlin
Status: Merged
Approved by: Parth Malwankar
Approved revision: 144
Merged at revision: 144
Proposed branch: lp:~jdahlin-deactivatedaccount/bzr-grep/color-option
Merge into: lp:bzr-grep
Diff against target: 35 lines (+10/-1)
1 file modified (+10/-1)
To merge this branch: bzr merge lp:~jdahlin-deactivatedaccount/bzr-grep/color-option
Reviewer Review Type Date Requested Status
Parth Malwankar Approve
Jelmer Vernooij (community) code Approve
Review via email:

Description of the change

This adds a global option so you don't have to type --color=auto all the time.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This seems reasonable, though it would be nice to have a test for the option.

review: Approve (code)
Revision history for this message
Johan Dahlin (jdahlin-deactivatedaccount) wrote :

I don't have the necessary permissions to merge it into lp:bzr-grep.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Hi Johan,

On 28/06/11 15:51, Johan Dahlin wrote:
> I don't have the necessary permissions to merge it into lp:bzr-grep.
I don't have access either. Hopefully Parth will be able to review and
merge it.



Revision history for this message
Parth Malwankar (parthm) wrote :

Thanks for the patch Johan.

Sorry for the delay. Things are a little crazy at work. I will do the merge this weekend.
Could you please make a NEWS entry for this enhancement?

I am not sure why we have a permissions issue as the project maintainer is set to Bazaar Developers (~bzr).


review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file ''
2--- 2011-02-20 00:34:00 +0000
3+++ 2011-06-17 13:03:27 +0000
4@@ -19,6 +19,7 @@
5 from bzrlib import errors
6 from bzrlib.commands import Command, display_command
7 from bzrlib.option import Option, ListOption
8+from bzrlib.config import GlobalConfig
10 # FIXME: _parse_levels should be shared with bzrlib.builtins. this is a copy
11 # to avoid the error
12@@ -143,7 +144,7 @@
13 from_root=False, null=False, levels=None, line_number=False,
14 path_list=None, revision=None, pattern=None, include=None,
15 exclude=None, fixed_string=False, files_with_matches=False,
16- files_without_match=False, color='never', diff=False):
17+ files_without_match=False, color=None, diff=False):
18 from bzrlib.plugins.grep import (
19 grep,
20 termcolor,
21@@ -159,6 +160,14 @@
22 raise errors.BzrCommandError('cannot specify both '
23 '-l/--files-with-matches and -L/--files-without-matches.')
25+ global_config = GlobalConfig()
27+ if color is None:
28+ color = global_config.get_user_option('grep_color')
30+ if color is None:
31+ color = 'never'
33 if color not in ['always', 'never', 'auto']:
34 raise errors.BzrCommandError('Valid values for --color are '
35 '"always", "never" or "auto".')


People subscribed via source and target branches

to all changes: