/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to __init__.py

grep support --diff for searching changesets. (#540705)

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
    files_with_matches = False
79
79
    files_without_match = False
80
80
    color = None
 
81
    diff = False
81
82
 
82
83
    # derived options
83
84
    recursive = None
124
125
        'revision',
125
126
        Option('color', type=str, argname='when',
126
127
               help='Show match in color. WHEN is never, always or auto.'),
 
128
        Option('diff', short_name='p',
 
129
               help='Grep for pattern in changeset for each revision.'),
127
130
        ListOption('exclude', type=str, argname='glob', short_name='X',
128
131
            help="Skip files whose base name matches GLOB."),
129
132
        ListOption('include', type=str, argname='glob', short_name='I',
161
164
            from_root=False, null=False, levels=None, line_number=False,
162
165
            path_list=None, revision=None, pattern=None, include=None,
163
166
            exclude=None, fixed_string=False, files_with_matches=False,
164
 
            files_without_match=False, color='never'):
 
167
            files_without_match=False, color='never', diff=False):
165
168
 
166
169
        if path_list == None:
167
170
            path_list = ['.']
229
232
        GrepOptions.files_with_matches = files_with_matches
230
233
        GrepOptions.files_without_match = files_without_match
231
234
        GrepOptions.color = color
 
235
        GrepOptions.diff = False
232
236
 
233
237
        GrepOptions.eol_marker = eol_marker
234
238
        GrepOptions.print_revno = print_revno
238
242
        GrepOptions.outf = self.outf
239
243
        GrepOptions.show_color = show_color
240
244
 
241
 
        if revision == None:
 
245
        if diff == True:
 
246
            # options not used:
 
247
            # files_with_matches, files_without_match
 
248
            # levels(?), line_number, from_root
 
249
            # include, exclude
 
250
            # These are silently ignored.
 
251
            grep.grep_diff(GrepOptions)
 
252
        elif revision == None:
242
253
            grep.workingtree_grep(GrepOptions)
243
254
        else:
244
255
            grep.versioned_grep(GrepOptions)