lib/dev/cmd/Commit.rb in dev-1.0.202 vs lib/dev/cmd/Commit.rb in dev-1.0.203

- old
+ new

@@ -2,11 +2,27 @@ module Cmd class Commit < Array def refresh strip_auto_entries File.open('commit.message','w'){|f|f.puts "commit all"} if !File.exists?('commit.message') - self << "{:cmd=>'git commit -a -F commit.message',:auto=>true}" if File.exists?(".git") - self << "{:cmd=>'svn commit -F commit.message',:auto=>true}" if File.exists?(".svn") + scm_type = get_default_scm_type + if scm_type == "svn" + self << "{:cmd=>'svn commit -F commit.message',:auto=>true}" + else + if scm_type == "git" + self << "{:cmd=>'git commit -a -F commit.message',:auto=>true}" + end + end + end + + def get_default_scm_type + call=Dev::SystemCall.new("svn info") + return "svn" if call.output.include?("Last Changed Date:") + return "svn" if File.exists?(".svn") + call=Dev::SystemCall.new("git status") + return "git" if call.output.include?("#") + return "git" if File.exists?(".git") + return nil end end # class Compile end # module Cmd end # module Dev \ No newline at end of file