[ANN] bzr-grep

Parth Malwankar parth.malwankar at gmail.com
Wed Mar 10 14:23:13 GMT 2010


Hello,

I am happy announce the bzr-grep plugin that can be used
to search for a pattern in bzr revisions. Thanks to all
the bzr developers who help me out over IRC and merge
proposals.

This is 0.0.1-final release. Its tested with bzr 2.0 and 2.1.
You can get it using the command:

$ bzr branch lp:bzr-grep/0.0.1-final
$ mv 0.0.1-final ~/.bazaar/plugins/grep

I would be happy to receive any feedback, bugs, merge
proposals :-) on lp:bzr-grep[1].

Below is the detailed help and sample usage.

Regards,
Parth
[1] https://launchpad.net/bzr-grep

[grep]% bzr help grep
Purpose: Print lines matching PATTERN for specified files and revisions.
Usage:   bzr grep PATTERN [PATH...]

Options:
  --from-root           Search for pattern starting from the root of the
                        branch. (implies --recursive)
  -Z, --null            Write an ascii NUL (\0) separator between output lines
                        rather than a newline.
  -v, --verbose         Display more information.
  -R, --recursive       Recurse into subdirectories.
  -h, --help            Show help message.
  -q, --quiet           Only display errors and warnings.
  -i, --ignore-case     ignore case distinctions while matching.
  --levels=N            Number of levels to display - 0 for all, 1 for
                        collapsed (default).
  --usage               Show usage message and options.
  -n, --line-number     show 1-based line number.
  -r ARG, --revision=ARG
                        See "help revisionspec" for details.

Description:
  This command searches the specified files and revisions for a given pattern.
  The pattern is specified as a Python regular expressions[1].
  If the file name is not specified the file revisions in the current directory
  are searched. If the revision number is not specified, the latest revision is
  searched.

  Note that this command is different from POSIX grep in that it searches the
  revisions of the branch and not the working copy. Unversioned files and
  uncommitted changes are not seen.

  When searching a pattern, the output is shown in the 'filepath:string' format.
  If a revision is explicitly searched, the output is shown as
'filepath~N:string',
  where N is the revision number.

  [1] http://docs.python.org/library/re.html#regular-expression-syntax

From:     plugin "grep"
See also: plugins/grep
[grep]%

[grep]% bzr grep commands
__init__.py:from bzrlib.commands import Command, register_command,
display_command
setup.py:bzr_commands = ['grep']

[grep]% bzr grep -r 1..3 commands
__init__.py~3:from bzrlib.commands import Command, register_command,
display_command
__init__.py~2:from bzrlib.commands import Command, register_command,
display_command
__init__.py~1:from bzrlib.commands import Command, register_command



More information about the bazaar mailing list