vcsdiff 0.1.3.alpha → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/vcsdiff +48 -8
- metadata +5 -5
data/bin/vcsdiff
CHANGED
@@ -37,9 +37,10 @@ option_parser = OptionParser.new do |opts|
|
|
37
37
|
opts.separator 'Options'
|
38
38
|
|
39
39
|
options[:files] = Array.new
|
40
|
-
opts.on('-f','--file FILE',Array,'Define the file/files you want to diff',
|
40
|
+
opts.on('-f','--file FILE[,FILE]',Array,'Define the file/files you want to diff',
|
41
41
|
'(you can use it more than once',
|
42
|
-
'or seperate the filenames with commas)'
|
42
|
+
'or seperate the filenames with commas)',
|
43
|
+
'If not specified vcsdiff diffs all files in the directory') do |f|
|
43
44
|
options[:files]+=f
|
44
45
|
end
|
45
46
|
|
@@ -60,7 +61,13 @@ option_parser = OptionParser.new do |opts|
|
|
60
61
|
'defaults to vimdiff') do |t|
|
61
62
|
options[:diff]=t
|
62
63
|
end
|
63
|
-
|
64
|
+
|
65
|
+
options[:verbose]=false
|
66
|
+
opts.on('-v','--verbose',
|
67
|
+
'Enable verbose printing') do
|
68
|
+
options[:verbose]=true
|
69
|
+
end
|
70
|
+
|
64
71
|
opts.separator ''
|
65
72
|
opts.separator 'Diff options:'
|
66
73
|
opts.separator 'All diff options are passed to svn/git/hg diff'
|
@@ -81,19 +88,52 @@ rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
|
81
88
|
end
|
82
89
|
|
83
90
|
if not options[:sys]
|
84
|
-
#
|
85
|
-
|
91
|
+
# Check if it is a svn repository
|
92
|
+
%x[svn info 2> /dev/null]
|
93
|
+
if ($?.success?)
|
94
|
+
options[:sys]="svn"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
if not options[:sys]
|
99
|
+
# Check if it is a git repository
|
100
|
+
%x[git status 2> /dev/null]
|
101
|
+
if ($?.success?)
|
102
|
+
options[:sys]="git"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if not options[:sys]
|
107
|
+
# Check if it is a svn repository
|
108
|
+
%x[hg status 2> /dev/null]
|
109
|
+
if ($?.success?)
|
110
|
+
options[:sys]="hg"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
if options[:verbose]
|
115
|
+
puts 'Auto-detected ' + options[:sys] + ' version control'
|
86
116
|
end
|
87
117
|
|
88
118
|
# if the user didn't specify any arguments go through each file in the directory
|
89
119
|
if options[:files].length == 0
|
90
|
-
|
91
|
-
|
120
|
+
if options[:sys].eql? "git"
|
121
|
+
modified=%x[#{options[:sys]} status 2> /dev/null | grep modified | awk '{print $3}']
|
122
|
+
else
|
123
|
+
modified=%x[#{options[:sys]} status 2> /dev/null | grep -e "^[MU]" | awk '{print $2}']
|
124
|
+
end
|
92
125
|
modified.split(%r[\n]).each do |f|
|
93
126
|
options[:files].push(f) if File.file?(f)
|
94
127
|
end
|
95
128
|
end
|
96
129
|
|
130
|
+
if options[:verbose]
|
131
|
+
puts 'Files that are going to be diffed:'
|
132
|
+
options[:files].each do |f|
|
133
|
+
puts " " + f
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
97
137
|
patch="/tmp/svnkomp_747_patch"
|
98
138
|
remote=""
|
99
139
|
|
@@ -108,7 +148,7 @@ options[:files].each do |f|
|
|
108
148
|
exit 1;
|
109
149
|
end
|
110
150
|
%x[patch -R -p0 #{remote} #{patch}]
|
111
|
-
%x[#{options[:diff]} #{
|
151
|
+
%x[#{options[:diff]} #{f} #{remote} < `tty` > `tty`]
|
112
152
|
File.delete(remote)
|
113
153
|
end
|
114
154
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcsdiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.4
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Foivos Zakkak
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A ruby gem for inspecting diffs generated by git/svn/hg diff using vim
|
15
15
|
or Kompare
|
@@ -36,9 +36,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
37
|
none: false
|
38
38
|
requirements:
|
39
|
-
- - ! '
|
39
|
+
- - ! '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: '0'
|
42
42
|
requirements:
|
43
43
|
- patch
|
44
44
|
rubyforge_project:
|