dev 1.0.203 → 1.0.204
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 +3 -2
- data/lib/dev/Scm.rb +24 -7
- metadata +1 -1
data/lib/dev/Commands.rb
CHANGED
@@ -138,14 +138,15 @@ class Commands < Hash
|
|
138
138
|
def has_diff
|
139
139
|
call=nil
|
140
140
|
|
141
|
-
if DEV[:scm_type] == "git"
|
141
|
+
if DEV[:scm_type] == "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:")
|
145
145
|
return true if call.output.include?("modified:")
|
146
|
+
return false
|
146
147
|
end
|
147
148
|
|
148
|
-
call=Dev::SystemCall.new('git diff --name-only') if File.exists?(".git")
|
149
|
+
#call=Dev::SystemCall.new('git diff --name-only') if File.exists?(".git")
|
149
150
|
call=Dev::SystemCall.new('svn diff') if File.exists?(".svn")
|
150
151
|
|
151
152
|
unless call.nil? || call.output.length==0
|
data/lib/dev/Scm.rb
CHANGED
@@ -13,15 +13,29 @@ class Scm
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def file_tracked?(file)
|
16
|
+
puts_debug "file_tracked?(" + file + ")"
|
17
|
+
puts_debug "scm_type = #{@scm_type}"
|
16
18
|
if @scm_type=="git"
|
17
|
-
call=Dev::SystemCall.new("git ls-files #{file} -
|
18
|
-
|
19
|
+
call=Dev::SystemCall.new("git ls-files #{file} --error-unmatch")
|
20
|
+
puts_debug "call.output:"
|
21
|
+
puts_debug call.output
|
22
|
+
puts_debug "call.error"
|
23
|
+
puts_debug call.error
|
24
|
+
if call.status==0
|
25
|
+
puts_debug "file IS tracked by git."
|
26
|
+
puts_debug call.output
|
27
|
+
return true
|
28
|
+
else
|
29
|
+
puts_debug "file is NOT tracked by git."
|
30
|
+
#return false
|
31
|
+
end
|
32
|
+
#return true if call.status==0
|
19
33
|
end
|
20
|
-
false
|
34
|
+
#false
|
21
35
|
end
|
22
36
|
|
23
37
|
def add_file(file)
|
24
|
-
call=Dev::SystemCall.new("git add #{file}") if @scm_type=="git"
|
38
|
+
#call=Dev::SystemCall.new("git add #{file}") if @scm_type=="git"
|
25
39
|
|
26
40
|
if @scm_type=="svn"
|
27
41
|
afile=file
|
@@ -38,9 +52,12 @@ class Scm
|
|
38
52
|
if @scm_type=="git"
|
39
53
|
afile=file
|
40
54
|
|
41
|
-
|
42
|
-
status=$?.exitstatus
|
43
|
-
if(status != 0)
|
55
|
+
#`git status "#{afile}"`
|
56
|
+
#status=$?.exitstatus
|
57
|
+
#if(status != 0)
|
58
|
+
if(file_tracked?(afile))
|
59
|
+
puts "file #{afile} is tracked by git"
|
60
|
+
else
|
44
61
|
call=Dev::SystemCall.new("git add \"#{afile}\"")
|
45
62
|
call.puts_summary
|
46
63
|
end
|