tracker-client 0.8 → 0.9
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/bin/tracker +2 -1
- data/lib/command.rb +5 -3
- metadata +1 -1
data/bin/tracker
CHANGED
@@ -15,6 +15,7 @@ opts = Trollop::options do
|
|
15
15
|
opt :obsolete, "Used when recording new revision of patchset", :short => 'o', :type => :int
|
16
16
|
opt :message, "Add short message to actions", :short => 'm', :type => :string
|
17
17
|
opt :id, "Patchset ID used by download action", :short => 'i', :type => :int
|
18
|
+
opt :upload, 'Upload current branch patches after record', :short => 'u', :type => :flag
|
18
19
|
end
|
19
20
|
|
20
21
|
Tracker::Cmd.config(:set, :file => opts[:config])
|
@@ -40,7 +41,7 @@ def print_usage
|
|
40
41
|
end
|
41
42
|
|
42
43
|
puts case ARGV[0]
|
43
|
-
when 'record' then Tracker::Cmd.record(opts[:dir], opts[:obsolete])
|
44
|
+
when 'record' then Tracker::Cmd.record(opts[:dir], { :obsolete => opts[:obsolete], :upload => opts[:upload]})
|
44
45
|
when 'ack' then Tracker::Cmd.ack(opts[:dir], :message => opts[:message])
|
45
46
|
when 'nack' then Tracker::Cmd.nack(opts[:dir], :message => opts[:message])
|
46
47
|
when 'push' then Tracker::Cmd.push(opts[:dir], :message => opts[:message])
|
data/lib/command.rb
CHANGED
@@ -63,7 +63,7 @@ module Tracker
|
|
63
63
|
#
|
64
64
|
# * +directory+ - If given, cmd app will 'chdir' into that directory (default: nil)
|
65
65
|
#
|
66
|
-
def self.record(directory,
|
66
|
+
def self.record(directory, opts={})
|
67
67
|
number_of_commits = JSON::parse(patches_to_json(directory)).pop.size
|
68
68
|
begin
|
69
69
|
response = RestClient.post(
|
@@ -72,12 +72,14 @@ module Tracker
|
|
72
72
|
{
|
73
73
|
:content_type => 'application/json',
|
74
74
|
'Authorization' => "Basic #{basic_auth}",
|
75
|
-
'X-Obsoletes' => obsolete || 'no'
|
75
|
+
'X-Obsoletes' => opts[:obsolete] || 'no'
|
76
76
|
}
|
77
77
|
)
|
78
78
|
response = JSON::parse(response)
|
79
|
-
"#{number_of_commits} patches were recorded to the tracker server"+
|
79
|
+
output = "#{number_of_commits} patches were recorded to the tracker server"+
|
80
80
|
" [#{config[:url]}][##{response['id']}][rev#{response['revision']}]"
|
81
|
+
output += "\n" + upload(directory) if opts[:upload]
|
82
|
+
output
|
81
83
|
rescue => e
|
82
84
|
e.message
|
83
85
|
end
|