mgit 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f1d7fb66f7b5315217a897738e1953ad2c58328
4
- data.tar.gz: 6b117b5098bd74d6ee3d96bd471395e99d1846a4
3
+ metadata.gz: a864d92e6cb5a13926592e78db2a4ca1a0892131
4
+ data.tar.gz: b8e77522a483f293d4fe5bfe8acba45a88c3a620
5
5
  SHA512:
6
- metadata.gz: 5e78108bc3f5af7f0d86fe6b38ee79d66c8ab1b2a1f76a80276ceb3cdd1bb8a824266538db65d0e1fbd951c00ee5a6ea6c91e65fcb86c6adac49d5d2b24c2fab
7
- data.tar.gz: c583723a6a24b2eee1e3d4b5ca7c36eb3b8de035be787b423dca2ec8cc5a2298cd36a01ca39de44f7eca666e19170d9db9c0c58919ac6e4520486e3a10a2c59a
6
+ metadata.gz: ff6fed45af97d221ea5760f480ca10e5cd55bbd23b6a650e9e1b4f2c3b5a18116caf1be8fab15fa1696c86de27b3604f2a9844b1d00e5fdf00f2269025bd8180
7
+ data.tar.gz: 3252a3ccfe20945ab5c2e6c2f040150afa9603aef41793b24a882ad5dbb0023779b720c375960e1931abacb58628c79707a177c8573fcac00da99990f43298f1
@@ -0,0 +1,50 @@
1
+ module MGit
2
+ class CheckoutCommand < Command
3
+ def execute(args)
4
+ @commit = args.shift
5
+
6
+ if repos.empty?
7
+ perror "Couldn't find commit #{@commit} in any repository."
8
+ else
9
+ checkout_all
10
+ end
11
+ end
12
+
13
+ def arity
14
+ [1, 1]
15
+ end
16
+
17
+ def usage
18
+ 'checkout <commit-sha/obj>'
19
+ end
20
+
21
+ def description
22
+ 'checkout commit object in all repositories that have it'
23
+ end
24
+
25
+ register_command :checkout
26
+ register_alias :co
27
+
28
+ private
29
+
30
+ def repos
31
+ @rs ||= Registry.select { |r| r.has_commit?(@commit) }
32
+ end
33
+
34
+ def checkout_all
35
+ repos.each do |repo|
36
+ begin
37
+ if repo.dirty?
38
+ pwarn "Skipping repository #{repo.name} as it is dirty."
39
+ next
40
+ end
41
+
42
+ repo.in_repo { System.git("checkout -q #{@commit}") }
43
+ pinfo "Switched to #{@commit} in repository #{repo.name}."
44
+ rescue GitError
45
+ perror "Failed to checkout #{@commit} in repository #{repo.name}."
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -30,17 +30,7 @@ module MGit
30
30
  private
31
31
 
32
32
  def repos
33
- @rs || begin
34
- @rs = []
35
- Registry.chdir_each do |r|
36
- @rs << r if commit?
37
- end
38
- @rs
39
- end
40
- end
41
-
42
- def commit?
43
- !(System.git("rev-parse --quiet --verify #{@commit}").stdout.empty?)
33
+ @rs ||= Registry.select { |r| r.has_commit?(@commit) }
44
34
  end
45
35
 
46
36
  def show_commit(repo)
@@ -31,6 +31,10 @@ module MGit
31
31
  in_repo { System.git('rev-parse --verify --short HEAD').stdout.strip }
32
32
  end
33
33
 
34
+ def has_commit?(obj)
35
+ in_repo { !(System.git("rev-parse --quiet --verify #{obj}").stdout.empty?) }
36
+ end
37
+
34
38
  def branches
35
39
  in_repo do
36
40
  System.git('branch --no-color')
data/lib/mgit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MGit
2
- VERSION = '0.4.10'
2
+ VERSION = '0.4.11'
3
3
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - FlavourSys Technology GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- version_requirements: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - "~>"
17
- - !ruby/object:Gem::Version
18
- version: '0.7'
19
14
  name: colorize
20
- prerelease: false
21
15
  requirement: !ruby/object:Gem::Requirement
22
16
  requirements:
23
17
  - - "~>"
24
18
  - !ruby/object:Gem::Version
25
19
  version: '0.7'
26
20
  type: :runtime
27
- - !ruby/object:Gem::Dependency
21
+ prerelease: false
28
22
  version_requirements: !ruby/object:Gem::Requirement
29
23
  requirements:
30
24
  - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '1.6'
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
33
28
  name: highline
34
- prerelease: false
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
33
  version: '1.6'
40
34
  type: :runtime
41
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
38
  - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: '2.2'
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
47
42
  name: xdg
48
- prerelease: false
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '2.2'
54
48
  type: :runtime
55
- - !ruby/object:Gem::Dependency
49
+ prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '2.14'
54
+ version: '2.2'
55
+ - !ruby/object:Gem::Dependency
61
56
  name: rspec
62
- prerelease: false
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - "~>"
66
60
  - !ruby/object:Gem::Version
67
61
  version: '2.14'
68
62
  type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.14'
69
69
  description: M[eta]Git let's you manage multiple git repositories simultaneously
70
70
  email: technology@flavoursys.com
71
71
  executables:
@@ -80,6 +80,7 @@ files:
80
80
  - lib/mgit/command.rb
81
81
  - lib/mgit/commands/add.rb
82
82
  - lib/mgit/commands/branches.rb
83
+ - lib/mgit/commands/checkout.rb
83
84
  - lib/mgit/commands/clone.rb
84
85
  - lib/mgit/commands/config.rb
85
86
  - lib/mgit/commands/fetch.rb
@@ -123,8 +124,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  version: '0'
124
125
  requirements: []
125
126
  rubyforge_project:
126
- rubygems_version: 2.4.5
127
+ rubygems_version: 2.2.2
127
128
  signing_key:
128
129
  specification_version: 4
129
130
  summary: MGit meta repository tool
130
131
  test_files: []
132
+ has_rdoc: