tracker-client 1.1.1 → 1.1.2
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 -2
 - data/lib/command.rb +15 -2
 - metadata +2 -2
 
    
        data/bin/tracker
    CHANGED
    
    | 
         @@ -14,7 +14,7 @@ opts = Trollop::options do 
     | 
|
| 
       14 
14 
     | 
    
         
             
              opt :config, "Tracker config file location", :short => 'c', :default => "#{File.join(ENV['HOME'], '.trackerrc')}"
         
     | 
| 
       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 
     | 
    
         
            -
              opt :id, " 
     | 
| 
      
 17 
     | 
    
         
            +
              opt :id, "Set identifier used by download, ack, push or nack", :short => 'i', :type => :string
         
     | 
| 
       18 
18 
     | 
    
         
             
              opt :upload, 'Upload current branch patches after record', :short => 'u', :type => :flag
         
     | 
| 
       19 
19 
     | 
    
         
             
              opt :branch, 'Create specified branch when downloading patches', :short => 'b', :type => :string
         
     | 
| 
       20 
20 
     | 
    
         
             
            end
         
     | 
| 
         @@ -41,7 +41,7 @@ def print_usage 
     | 
|
| 
       41 
41 
     | 
    
         
             
              puts 'Examples:'
         
     | 
| 
       42 
42 
     | 
    
         
             
              puts
         
     | 
| 
       43 
43 
     | 
    
         
             
              puts '$ tracker record -o 45           # Record current branch and obsolete patchset 45 (bump revision)'
         
     | 
| 
       44 
     | 
    
         
            -
              puts '$ tracker  
     | 
| 
      
 44 
     | 
    
         
            +
              puts '$ tracker download 45 -b review  # Download set 45, create branch "review" and apply the downloaded patches'
         
     | 
| 
       45 
45 
     | 
    
         
             
              puts '$ tracker list new               # Display all new or open sets'
         
     | 
| 
       46 
46 
     | 
    
         
             
              puts '$ tracker list mfojtik -i author # Display all sets that were recorded by %mfojtik%'
         
     | 
| 
       47 
47 
     | 
    
         
             
              ''
         
     | 
    
        data/lib/command.rb
    CHANGED
    
    | 
         @@ -79,7 +79,7 @@ module Tracker 
     | 
|
| 
       79 
79 
     | 
    
         
             
                    )
         
     | 
| 
       80 
80 
     | 
    
         
             
                    response = JSON::parse(response)
         
     | 
| 
       81 
81 
     | 
    
         
             
                    output = "#{number_of_commits} patches were recorded to the tracker server"+
         
     | 
| 
       82 
     | 
    
         
            -
                      " [\e[1m 
     | 
| 
      
 82 
     | 
    
         
            +
                      " [\e[1m#{config[:url]}set/#{response['id']}\e[0m] [revision #{response['revision']}]"
         
     | 
| 
       83 
83 
     | 
    
         
             
                    output += "\n" + upload(directory) if opts[:upload]
         
     | 
| 
       84 
84 
     | 
    
         
             
                    output
         
     | 
| 
       85 
85 
     | 
    
         
             
                  rescue => e
         
     | 
| 
         @@ -179,7 +179,16 @@ module Tracker 
     | 
|
| 
       179 
179 
     | 
    
         
             
                    patch_filename = File.join(directory, "#{counter}-#{commit}.patch")
         
     | 
| 
       180 
180 
     | 
    
         
             
                    File.open(patch_filename, 'w') { |f| f.puts download_patch_body(commit) }
         
     | 
| 
       181 
181 
     | 
    
         
             
                    if !branch.nil?
         
     | 
| 
       182 
     | 
    
         
            -
                       
     | 
| 
      
 182 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 183 
     | 
    
         
            +
                        puts git_cmd("git am #{patch_filename}", directory)
         
     | 
| 
      
 184 
     | 
    
         
            +
                      rescue ChildCommandError => e
         
     | 
| 
      
 185 
     | 
    
         
            +
                        puts git_cmd "git am --abort", directory
         
     | 
| 
      
 186 
     | 
    
         
            +
                        puts git_cmd "git checkout master", directory
         
     | 
| 
      
 187 
     | 
    
         
            +
                        puts git_cmd "git branch -D #{branch}", directory
         
     | 
| 
      
 188 
     | 
    
         
            +
                        puts "ERROR: #{e.message}. Reverting back to 'master' branch."
         
     | 
| 
      
 189 
     | 
    
         
            +
                        puts "Downloaded patch saved to :#{patch_filename}"
         
     | 
| 
      
 190 
     | 
    
         
            +
                        exit 1
         
     | 
| 
      
 191 
     | 
    
         
            +
                      end
         
     | 
| 
       183 
192 
     | 
    
         
             
                      FileUtils.rm_f(patch_filename)
         
     | 
| 
       184 
193 
     | 
    
         
             
                    end
         
     | 
| 
       185 
194 
     | 
    
         
             
                    counter += 1
         
     | 
| 
         @@ -327,6 +336,8 @@ module Tracker 
     | 
|
| 
       327 
336 
     | 
    
         
             
                  ''
         
     | 
| 
       328 
337 
     | 
    
         
             
                end
         
     | 
| 
       329 
338 
     | 
    
         | 
| 
      
 339 
     | 
    
         
            +
                class ChildCommandError < StandardError; end
         
     | 
| 
      
 340 
     | 
    
         
            +
             
     | 
| 
       330 
341 
     | 
    
         
             
                private
         
     | 
| 
       331 
342 
     | 
    
         | 
| 
       332 
343 
     | 
    
         
             
                # Execute GIT command ('git') in the specified directory. Method will then
         
     | 
| 
         @@ -340,7 +351,9 @@ module Tracker 
     | 
|
| 
       340 
351 
     | 
    
         
             
                  begin
         
     | 
| 
       341 
352 
     | 
    
         
             
                    Dir.chdir(directory)
         
     | 
| 
       342 
353 
     | 
    
         
             
                    result = %x[#{cmd}]
         
     | 
| 
      
 354 
     | 
    
         
            +
                    raise ChildCommandError.new("Child process returned #{$?}") if $? != 0
         
     | 
| 
       343 
355 
     | 
    
         
             
                  rescue => e
         
     | 
| 
      
 356 
     | 
    
         
            +
                    raise e if e.kind_of? ChildCommandError
         
     | 
| 
       344 
357 
     | 
    
         
             
                    puts "ERROR: #{e.message}"
         
     | 
| 
       345 
358 
     | 
    
         
             
                    exit(1)
         
     | 
| 
       346 
359 
     | 
    
         
             
                  ensure
         
     | 
    
        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.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2012- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-10-06 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rest-client
         
     |