aboutsummaryrefslogtreecommitdiffstats
path: root/tool/change_maker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/change_maker.rb')
-rwxr-xr-xtool/change_maker.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/tool/change_maker.rb b/tool/change_maker.rb
index 2bbc275d93..0ed7efd387 100755
--- a/tool/change_maker.rb
+++ b/tool/change_maker.rb
@@ -1,5 +1,8 @@
#! ./miniruby
+$:.unshift(File.expand_path("../../lib", __FILE__))
+require File.expand_path("../vcs", __FILE__)
+
def diff2index(cmd, *argv)
lines = []
path = nil
@@ -22,10 +25,17 @@ def diff2index(cmd, *argv)
lines.empty? ? nil : lines
end
-if `svnversion` =~ /^\d+/
+vcs = begin
+ VCS.detect(File.dirname(__FILE__))
+rescue VCS::NotFoundError
+ nil
+end
+
+case vcs
+when VCS::SVN
cmd = "svn diff --diff-cmd=diff -x-pU0"
change = diff2index(cmd, ARGV)
-elsif File.directory?(".git")
+when VCS::GIT
cmd = "git diff -U0"
change = diff2index(cmd, ARGV) || diff2index(cmd, "--cached", ARGV)
else