summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-24 03:52:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-24 03:52:46 +0000
commite16c316b52948396eac43ee9d79383274c616256 (patch)
tree3052f7072253ca50dcea5a358638348080741b19 /tool
parentccba83feffcb68bd46e75efcadb931e5d23c6bae (diff)
* common.mk (change), tool/change_maker.rb: make a brief template
for ChangeLog. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-xtool/change_maker.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/tool/change_maker.rb b/tool/change_maker.rb
new file mode 100755
index 0000000000..d039de9909
--- /dev/null
+++ b/tool/change_maker.rb
@@ -0,0 +1,26 @@
+#! ./miniruby
+
+if File.directory?(".svn")
+ cmd = "svn diff"
+elsif File.directory?(".git")
+ cmd = "git diff"
+else
+ abort "does not seem to be under a vcs"
+end
+
+def diff2index(cmd, *argv)
+ path = nil
+ `#{cmd} #{argv.join(" ")}`.split(/\n/).each do |line|
+ case line
+ when /^Index: (\S*)/, /^diff --git [a-z]\/(\S*) [a-z]\/\1/
+ path = $1
+ when /^@@.*@@ +([A-Za-z_][A-Za-z_0-9 ]*[A-Za-z_0-9])/
+ puts "* #{path} (#{$1}):"
+ end
+ end
+ !!path
+end
+
+if !diff2index(cmd, ARGV) and /^git/ =~ cmd
+ diff2index(cmd, "--cached", ARGV)
+end