~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Parth Malwankar
  • Date: 2010-03-14 05:33:02 UTC
  • mto: (0.40.54 grep)
  • mto: This revision was merged to the branch mainline in revision 6555.
  • Revision ID: parth.malwankar@gmail.com-20100314053302-3443cdrqsf61px8e
updated to accept --include and --exclude. unused at this point.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
from bzrlib import errors
22
22
from bzrlib.commands import Command, register_command, display_command
23
 
from bzrlib.option import (
24
 
    Option,
25
 
    )
 
23
from bzrlib.option import Option, ListOption
26
24
 
27
25
from bzrlib.lazy_import import lazy_import
28
26
lazy_import(globals(), """
73
71
    format. If a revision is explicitly searched, the output is shown as
74
72
    'filepath~N:string', where N is the revision number.
75
73
 
 
74
    --include and --exclude options can be used to search only (or exclude
 
75
    from search) files with base name matches the specified Unix style GLOB
 
76
    pattern.  The GLOB pattern an use *, ?, and [...] as wildcards, and \\
 
77
    to quote wildcard or backslash character literally.
 
78
 
76
79
    [1] http://docs.python.org/library/re.html#regular-expression-syntax
77
80
    """
78
81
 
96
99
           help='Number of levels to display - 0 for all, 1 for collapsed (1 is default).',
97
100
           argname='N',
98
101
           type=_parse_levels),
 
102
        ListOption('include', type=str, argname='glob',
 
103
            help="Search only files whose base name matches GLOB."),
 
104
        ListOption('exclude', type=str, argname='glob',
 
105
            help="Skip files whose base name matches GLOB."),
99
106
        ]
100
107
 
101
108
 
102
109
    @display_command
103
 
    def run(self, verbose=False, ignore_case=False, no_recursive=False, from_root=False,
104
 
            null=False, levels=None, line_number=False, path_list=None, revision=None, pattern=None):
 
110
    def run(self, verbose=False, ignore_case=False, no_recursive=False,
 
111
            from_root=False, null=False, levels=None, line_number=False,
 
112
            path_list=None, revision=None, pattern=None, include=None,
 
113
            exclude=None):
105
114
 
106
115
        recursive = not no_recursive
107
116