summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/git/base.rb11
-rw-r--r--lib/git/lib.rb15
-rw-r--r--lib/git/log.rb9
-rw-r--r--ruby-git.gemspec2
4 files changed, 35 insertions, 2 deletions
diff --git a/lib/git/base.rb b/lib/git/base.rb
index 43a3c0d..6ce7efe 100644
--- a/lib/git/base.rb
+++ b/lib/git/base.rb
@@ -367,6 +367,17 @@ module Git
self.lib.gc
end
+ def apply(file)
+ if File.exists?(file)
+ self.lib.apply(file)
+ end
+ end
+
+ def apply_mail(file)
+ if File.exists?(file)
+ self.lib.apply_mail(file)
+ end
+ end
## LOWER LEVEL INDEX OPERATIONS ##
diff --git a/lib/git/lib.rb b/lib/git/lib.rb
index 033df12..5e597ad 100644
--- a/lib/git/lib.rb
+++ b/lib/git/lib.rb
@@ -67,6 +67,7 @@ module Git
arr_opts = ['--pretty=oneline']
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 << "#{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
@@ -78,6 +79,7 @@ module Git
arr_opts = ['--pretty=raw']
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 << "#{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
@@ -387,6 +389,18 @@ module Git
command('reset', arr_opts)
end
+ def apply(patch_file)
+ arr_opts = []
+ arr_opts << patch_file.to_s if patch_file
+ command('apply', arr_opts)
+ end
+
+ def apply_mail(patch_file)
+ arr_opts = []
+ arr_opts << patch_file.to_s if patch_file
+ command('am', arr_opts)
+ end
+
def stashes_all
arr = []
filename = File.join(@git_dir, 'logs/refs/stash')
@@ -429,6 +443,7 @@ module Git
def checkout(branch, opts = {})
arr_opts = []
arr_opts << '-f' if opts[:force]
+ arr_opts << ["-b '#{opts[:new_branch]}'"] if opts[:new_branch]
arr_opts << branch.to_s
command('checkout', arr_opts)
diff --git a/lib/git/log.rb b/lib/git/log.rb
index 9437ea6..d620652 100644
--- a/lib/git/log.rb
+++ b/lib/git/log.rb
@@ -11,6 +11,7 @@ module Git
@path = nil
@count = nil
@since = nil
+ @until = nil
@between = nil
@dirty_flag = nil
@@ -39,6 +40,12 @@ module Git
return self
end
+ def until(date)
+ dirty_log
+ @until = date
+ return self
+ end
+
def between(sha1, sha2 = nil)
dirty_log
@between = [sha1, sha2]
@@ -85,7 +92,7 @@ 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, :between => @between)
+ :path_limiter => @path, :since => @since, :until => @until, :between => @between)
@commits = log.map { |c| Git::Object::Commit.new(@base, c['sha'], c) }
end
diff --git a/ruby-git.gemspec b/ruby-git.gemspec
index d1e6f77..264bdec 100644
--- a/ruby-git.gemspec
+++ b/ruby-git.gemspec
@@ -1,7 +1,7 @@
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = "git"
- s.version = "1.0.6"
+ s.version = "1.0.7"
s.author = "Scott Chacon"
s.email = "schacon@gmail.com"
s.summary = "A package for using Git in Ruby code."