diff options
author | Scott Chacon <schacon@gmail.com> | 2008-05-27 12:36:07 -0700 |
---|---|---|
committer | Scott Chacon <schacon@gmail.com> | 2008-05-27 12:36:07 -0700 |
commit | bceadeb7d377b6ba36de4f5de5a5f5034f89bee6 (patch) | |
tree | 05b4e3ccfd0e6c2f4b0cae8f118d12eca1f38f54 /lib/git | |
parent | 743ac297402ce8713d1c58db42c8a0540cb026a8 (diff) | |
download | third_party-ruby-git-bceadeb7d377b6ba36de4f5de5a5f5034f89bee6.tar.gz third_party-ruby-git-bceadeb7d377b6ba36de4f5de5a5f5034f89bee6.tar.xz third_party-ruby-git-bceadeb7d377b6ba36de4f5de5a5f5034f89bee6.zip |
added grep and author searching to logs
Diffstat (limited to 'lib/git')
-rw-r--r-- | lib/git/lib.rb | 4 | ||||
-rw-r--r-- | lib/git/log.rb | 16 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 5e597ad..1aaf131 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -68,6 +68,8 @@ module Git arr_opts << "-#{opts[:count]}" if opts[:count] arr_opts << "--since=\"#{opts[:since]}\"" if opts[:since].is_a? String arr_opts << "--until=\"#{opts[:until]}\"" if opts[:until].is_a? String + arr_opts << "--grep=\"#{opts[:grep]}\"" if opts[:grep].is_a? String + arr_opts << "--author=\"#{opts[:author]}\"" if opts[:author].is_a? String arr_opts << "#{opts[:between][0].to_s}..#{opts[:between][1].to_s}" if (opts[:between] && opts[:between].size == 2) arr_opts << opts[:object] if opts[:object].is_a? String arr_opts << '-- ' + opts[:path_limiter] if opts[:path_limiter].is_a? String @@ -80,6 +82,8 @@ module Git arr_opts << "-#{opts[:count]}" if opts[:count] arr_opts << "--since=\"#{opts[:since]}\"" if opts[:since].is_a? String arr_opts << "--until=\"#{opts[:until]}\"" if opts[:until].is_a? String + arr_opts << "--grep=\"#{opts[:grep]}\"" if opts[:grep].is_a? String + arr_opts << "--author=\"#{opts[:author]}\"" if opts[:author].is_a? String arr_opts << "#{opts[:between][0].to_s}..#{opts[:between][1].to_s}" if (opts[:between] && opts[:between].size == 2) arr_opts << opts[:object] if opts[:object].is_a? String arr_opts << '-- ' + opts[:path_limiter] if opts[:path_limiter].is_a? String diff --git a/lib/git/log.rb b/lib/git/log.rb index d620652..87a78a1 100644 --- a/lib/git/log.rb +++ b/lib/git/log.rb @@ -27,6 +27,18 @@ module Git @object = objectish return self end + + def author(regex) + dirty_log + @author = regex + return self + end + + def grep(regex) + dirty_log + @grep = regex + return self + end def path(path) dirty_log @@ -92,7 +104,9 @@ module Git # actually run the 'git log' command def run_log log = @base.lib.full_log_commits(:count => @count, :object => @object, - :path_limiter => @path, :since => @since, :until => @until, :between => @between) + :path_limiter => @path, :since => @since, + :author => @author, :grep => @grep, + :until => @until, :between => @between) @commits = log.map { |c| Git::Object::Commit.new(@base, c['sha'], c) } end |