class Git::Si::GitControl
Public Class Methods
add_command(*files)
click to toggle source
# File lib/git/si/git-control.rb, line 34 def self.add_command(*files) raise GitSiError.new("Add command requires filenames") if ( files.length == 0 ) "#{@@git_binary} add " + files.join(' ') end
are_there_changes?(status_output)
click to toggle source
# File lib/git/si/git-control.rb, line 39 def self.are_there_changes?(status_output) status_output.match(/^\s*[MADRC]/) end
branch_command()
click to toggle source
# File lib/git/si/git-control.rb, line 81 def self.branch_command "#{@@git_binary} branch" end
checkout_command(branch)
click to toggle source
# File lib/git/si/git-control.rb, line 66 def self.checkout_command(branch) raise GitSiError.new("Checkout command requires branch name") if branch.empty? "#{@@git_binary} checkout #{branch}" end
commit_all_command()
click to toggle source
# File lib/git/si/git-control.rb, line 48 def self.commit_all_command version = Git::Si::Version.version "#{@@git_binary} commit --allow-empty -am 'git-si #{version} atuned to current svn state'" end
commit_revision_command(revision)
click to toggle source
# File lib/git/si/git-control.rb, line 43 def self.commit_revision_command(revision) version = Git::Si::Version.version "#{@@git_binary} commit --allow-empty -am 'git-si #{version} svn update to version #{revision}'" end
create_branch_command(branch)
click to toggle source
# File lib/git/si/git-control.rb, line 71 def self.create_branch_command(branch) raise GitSiError.new("New branch command requires branch name") if branch.empty? "#{@@git_binary} branch #{branch}" end
delete_branch_command(branch)
click to toggle source
# File lib/git/si/git-control.rb, line 76 def self.delete_branch_command(branch) raise GitSiError.new("Delete branch command requires branch name") if branch.empty? "#{@@git_binary} branch -D #{branch}" end
delete_command(filename)
click to toggle source
# File lib/git/si/git-control.rb, line 108 def self.delete_command(filename) raise GitSiError.new("Remove file command requires filename") if filename.empty? "#{@@git_binary} rm -r #{filename}" end
git_binary=(binary)
click to toggle source
# File lib/git/si/git-control.rb, line 9 def self.git_binary=(binary) @@git_binary = binary && binary.length > 0 ? binary : @@default_git_binary end
hard_reset_command()
click to toggle source
# File lib/git/si/git-control.rb, line 90 def self.hard_reset_command "#{@@git_binary} reset --hard HEAD" end
init_command()
click to toggle source
# File lib/git/si/git-control.rb, line 99 def self.init_command "#{@@git_binary} init" end
list_file_command(filename)
click to toggle source
# File lib/git/si/git-control.rb, line 94 def self.list_file_command(filename) raise GitSiError.new("List file command requires filename") if filename.empty? "#{@@git_binary} ls-files #{filename}" end
log_command(*args)
click to toggle source
# File lib/git/si/git-control.rb, line 21 def self.log_command(*args) command = "#{@@git_binary} log" if ( args.length > 0 ) command += " " + args.join(' ') end command end
parse_current_branch(git_branches)
click to toggle source
# File lib/git/si/git-control.rb, line 85 def self.parse_current_branch(git_branches) results = git_branches.match(/^\*\s+(\S+)/) return results[1] if results end
parse_last_svn_revision(info)
click to toggle source
# File lib/git/si/git-control.rb, line 29 def self.parse_last_svn_revision(info) results = info.match(/svn update to version (\d+)/i) return results[1] if results end
rebase_command(branch)
click to toggle source
# File lib/git/si/git-control.rb, line 61 def self.rebase_command(branch) raise GitSiError.new("Rebase command requires branch name") if branch.empty? "#{@@git_binary} rebase '#{branch}'" end
show_branch_command(branch)
click to toggle source
# File lib/git/si/git-control.rb, line 103 def self.show_branch_command(branch) raise GitSiError.new("Show branch command requires branch name") if branch.empty? "#{@@git_binary} show-ref refs/heads/#{branch}" end
stash_command()
click to toggle source
# File lib/git/si/git-control.rb, line 53 def self.stash_command "#{@@git_binary} stash" end
status_command(*args)
click to toggle source
# File lib/git/si/git-control.rb, line 13 def self.status_command(*args) command = "#{@@git_binary} status --porcelain" if ( args.length > 0 ) command += " " + args.join(' ') end command end
unstash_command()
click to toggle source
# File lib/git/si/git-control.rb, line 57 def self.unstash_command "#{@@git_binary} stash pop" end