tracker-client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/tracker +7 -2
  2. data/lib/command.rb +32 -0
  3. metadata +1 -1
data/bin/tracker CHANGED
@@ -30,14 +30,18 @@ def print_usage
30
30
  puts 'tracker push - Mark all patches in current branch as PUSHED'
31
31
  puts 'tracker status - Display review status for current branch'
32
32
  puts 'tracker upload - Upload current patches (diffs) to tracker'
33
- puts 'tracker download - Download whole patchset from tracker (-i PATCHSET_ID)'
33
+ puts 'tracker download - Download whole patchset from tracker (-i PATCHSET_ID, -b CREATE_BRANCH)'
34
34
  puts 'tracker apply - Apply patch with specified commit (-i COMMIT_ID)'
35
+ puts 'tracker list - List all active sets'
35
36
  puts
36
37
  system("#{__FILE__} --help")
37
38
  puts
38
39
  puts 'Examples:'
39
40
  puts
40
- puts '$ tracker record -o 45 # Record current branch and obsolete patchset 45 (bump revision)'
41
+ puts '$ tracker record -o 45 # Record current branch and obsolete patchset 45 (bump revision)'
42
+ puts '$ tracker record -u # Record current branch and upload all patches'
43
+ puts '$ tracker list new # Display all new or open sets'
44
+ puts '$ tracker list mfojtik -i author # Display all sets that were recorded by %mfojtik%'
41
45
  ''
42
46
  end
43
47
 
@@ -52,5 +56,6 @@ puts case ARGV[0]
52
56
  when 'download' then Tracker::Cmd.download(opts[:dir], ARGV[1], opts[:branch])
53
57
  when 'status' then Tracker::Cmd.status(opts[:dir])
54
58
  when 'apply' then Tracker::Cmd.apply(opts[:dir], ARGV[1])
59
+ when 'list' then Tracker::Cmd.list(ARGV[1], opts)
55
60
  else print_usage
56
61
  end
data/lib/command.rb CHANGED
@@ -288,6 +288,38 @@ module Tracker
288
288
  end
289
289
  end
290
290
 
291
+ def self.list(value, opts={})
292
+ filter = ''
293
+ if !value.nil?
294
+ if ['new', 'ack', 'nack', 'push'].include? value
295
+ filter += '?filter=status&filter_value=%s' % value
296
+ elsif !opts[:id].nil?
297
+ filter += '?filter=%s&filter_value=%s' % [opts[:id], value]
298
+ else
299
+ puts "[ERR] To use filters other than status, you must use -i FILTER_NAME parameter"
300
+ exit 1
301
+ end
302
+ end
303
+ response = RestClient.get(
304
+ config[:url] + ('/set%s' % filter),
305
+ {
306
+ 'Accept' => 'application/json'
307
+ }
308
+ )
309
+ set_arr = JSON::parse(response)
310
+ puts
311
+ set_arr.each do |set|
312
+ puts "[%s][%s] \e[1m%s\e[0m (%s patches by %s)" % [
313
+ set['id'],
314
+ set['status'].upcase,
315
+ set['first_patch_message'],
316
+ set['num_of_patches'],
317
+ set['author']
318
+ ]
319
+ end
320
+ ''
321
+ end
322
+
291
323
  private
292
324
 
293
325
  # Execute GIT command ('git') in the specified directory. Method will then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: