lib/git_wrapper/repository.rb in git_wrapper-1.0.3 vs lib/git_wrapper/repository.rb in git_wrapper-1.1.0
- old
+ new
@@ -94,19 +94,33 @@
def show_theirs(file_name)
execute(Commands::Show.new(@location).file(file_name).theirs)
end
def log(options={})
- if options[:file_name]
- execute(Commands::Log.new(@location).file(options[:file_name]))
- elsif options[:commit]
- execute(Commands::Log.new(@location).commit(options[:commit]))
- else
- execute(Commands::Log.new(@location))
+ command = Commands::Log.new(@location)
+ options.each do |option, value|
+ command.send option, value if value && !value.to_s.strip.empty?
end
+ execute(command)
end
+ def rev_list(options={})
+ command = Commands::RevList.new(@location)
+ options.each do |option, value|
+ command.send option, value if value && !value.to_s.strip.empty?
+ end
+ execute(command)
+ end
+
+ def rev_list_count(options={})
+ command = Commands::RevList.new(@location).count
+ options.each do |option, value|
+ command.send option, value if value && !value.to_s.strip.empty?
+ end
+ execute(command)
+ end
+
def branches
execute(Commands::Branch.new(@location).list)
end
def current_branch
@@ -170,9 +184,13 @@
execute(Commands::Diff.new(@location).with(commit))
end
def diff_reverse(commit)
execute(Commands::Diff.new(@location).with(commit).reverse)
+ end
+
+ def diff_tree(commit)
+ execute(Commands::DiffTree.new(@location).commit(commit))
end
def revert(commit)
if log(:commit => commit).merge?
execute(Commands::Revert.new(@location).merge(commit))
\ No newline at end of file