lib/heidi/git.rb in heidi-0.2.1 vs lib/heidi/git.rb in heidi-0.3.0
- old
+ new
@@ -35,10 +35,16 @@
def branches
res = @shell.git "branch", "--no-color"
res.out.split("\n").collect{ |b| b.gsub(/^[\s*]+/, '') }
end
+ def remote_branches
+ res = @shell.git(%W(branch --no-color -r))
+ branches = res.out.split("\n").collect{ |b| b.gsub(/^[\s*]+/, '') }
+ branches.select { |b| b !~ /HEAD/ }
+ end
+
# git checkout $name
def switch(name)
return nil unless branches.include?(name)
@shell.git "checkout", name
end
@@ -114,9 +120,17 @@
@shell.git(args).out
end
def graph(amount=40)
@shell.git %W(log -n#{amount} --color --graph --pretty=oneline --abbrev-commit)
+ end
+
+ def stat(commit)
+ @shell.git(%W(log -n1 --color --stat #{commit})).out
+ end
+
+ def diff(commit)
+ @shell.git(%W(diff --color #{commit}^ #{commit})).out
end
# git config $key $value
def []=(key, value)
@shell.system("git", "config", "heidi.#{key}", value)