dev 1.0.202 → 1.0.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/dev/Commands.rb +1 -1
- data/lib/dev/Scm.rb +11 -0
- data/lib/dev/cmd/Commit.rb +18 -2
- metadata +1 -1
data/lib/dev/Commands.rb
CHANGED
@@ -138,7 +138,7 @@ class Commands < Hash
|
|
138
138
|
def has_diff
|
139
139
|
call=nil
|
140
140
|
|
141
|
-
if File.exists?(".git")
|
141
|
+
if DEV[:scm_type] == "git" #File.exists?(".git")
|
142
142
|
call=Dev::SystemCall.new('git status')
|
143
143
|
return true if call.output.include?("new file:")
|
144
144
|
return true if call.output.include?("deleted:")
|
data/lib/dev/Scm.rb
CHANGED
@@ -33,6 +33,17 @@ class Scm
|
|
33
33
|
call=Dev::SystemCall.new("svn add \"#{afile}\" --parents")
|
34
34
|
call.puts_summary
|
35
35
|
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if @scm_type=="git"
|
39
|
+
afile=file
|
40
|
+
|
41
|
+
`git status "#{afile}"`
|
42
|
+
status=$?.exitstatus
|
43
|
+
if(status != 0)
|
44
|
+
call=Dev::SystemCall.new("git add \"#{afile}\"")
|
45
|
+
call.puts_summary
|
46
|
+
end
|
36
47
|
end
|
37
48
|
end
|
38
49
|
|
data/lib/dev/cmd/Commit.rb
CHANGED
@@ -4,8 +4,24 @@ class Commit < Array
|
|
4
4
|
def refresh
|
5
5
|
strip_auto_entries
|
6
6
|
File.open('commit.message','w'){|f|f.puts "commit all"} if !File.exists?('commit.message')
|
7
|
-
|
8
|
-
|
7
|
+
scm_type = get_default_scm_type
|
8
|
+
if scm_type == "svn"
|
9
|
+
self << "{:cmd=>'svn commit -F commit.message',:auto=>true}"
|
10
|
+
else
|
11
|
+
if scm_type == "git"
|
12
|
+
self << "{:cmd=>'git commit -a -F commit.message',:auto=>true}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_default_scm_type
|
18
|
+
call=Dev::SystemCall.new("svn info")
|
19
|
+
return "svn" if call.output.include?("Last Changed Date:")
|
20
|
+
return "svn" if File.exists?(".svn")
|
21
|
+
call=Dev::SystemCall.new("git status")
|
22
|
+
return "git" if call.output.include?("#")
|
23
|
+
return "git" if File.exists?(".git")
|
24
|
+
return nil
|
9
25
|
end
|
10
26
|
end # class Compile
|
11
27
|
end # module Cmd
|