mgit 0.4.6 → 0.4.7

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: 701280b683790872b7dec9ba0bb84c1c8af87556
4
- data.tar.gz: 65ecbe1775dca509ff2e49f43898bb734f25b179
3
+ metadata.gz: f34a0f58527681ae3555ace98e7f7ab91adacdcb
4
+ data.tar.gz: 57e4d004541d62602ab2ed2aa1591cb4babe032e
5
5
  SHA512:
6
- metadata.gz: 60f46155d0bec27d85a1612c65739ac7771cf6f91279610b3a481ee2f4262e26cbf2196b0572d5a7cb6da1b8f48fbd0d2ca9d3c73d0b48dcefecdad4c7e9b5dd
7
- data.tar.gz: ad4dcb31ff9a501b5cf09ef9102ba2ff7727a5fbbf2c7076fa4dbc3481c3386c6e5eca3c4ab488ac68517e5d876d0345637214a1abca69b8de66d37b4d7cccd0
6
+ metadata.gz: 0484335cd8c44046c7f054196c72c1a5194dee622d6a63541b1c04914fd7b8c3ab42418a84ce12a7ca73d953754ed8a44d9d583c7a848d2d623efd6f6c245e27
7
+ data.tar.gz: 4ed6fe14d944ea5a30631945a5220e7822b1b3b615e11b092d112d934dfaba27befaddacc9441d54abcb3a76cb7fce2ebca549062239e5572f8a3d307fec255a
@@ -0,0 +1,26 @@
1
+ module MGit
2
+ class BranchesCommand < Command
3
+ def execute(args)
4
+ Registry.each do |repo|
5
+ pinfo "Repository #{repo.name} contains branches:"
6
+ repo.branches.each do |b|
7
+ psystem "#{b[:name]} #{b[:current] ? '*' : ''}"
8
+ end
9
+ end
10
+ end
11
+
12
+ def arity
13
+ [nil, 0]
14
+ end
15
+
16
+ def usage
17
+ 'branches'
18
+ end
19
+
20
+ def description
21
+ 'list all repository branches and tracked upstream branches'
22
+ end
23
+
24
+ register_command :branches
25
+ end
26
+ end
@@ -1,10 +1,14 @@
1
1
  module MGit
2
2
  class CloneCommand < Command
3
3
  def execute(args)
4
- log = System.git("clone #{args.join(' ')}", raise: true, print_stderr: true)
5
- .stdout
4
+ log = System.git("clone #{args.join(' ')}", raise: true)
5
+
6
+ m = [log.stdout, log.stderr].find do |l|
7
+ /Cloning into '(.*)'/.match(l.split("\n").first)
8
+ end
6
9
 
7
- m = /Cloning into '(.*)'/.match(log.split("\n").first)
10
+ fail 'Failed to determine repository directory.' unless m
11
+
8
12
  Command.execute('add', [m[1]])
9
13
  end
10
14
 
@@ -21,11 +25,5 @@ module MGit
21
25
  end
22
26
 
23
27
  register_command :clone
24
-
25
- private
26
-
27
- def option?(arg)
28
- arg.start_with?('-')
29
- end
30
28
  end
31
29
  end
@@ -31,6 +31,17 @@ module MGit
31
31
  in_repo { System.git('rev-parse --verify --short HEAD').stdout.strip }
32
32
  end
33
33
 
34
+ def branches
35
+ in_repo do
36
+ System.git('branch --no-color')
37
+ .stdout
38
+ .strip
39
+ .split("\n")
40
+ .map { |b| b.split(' ') }
41
+ .map { |b| { name: b.last, current: (b.size == 2) } }
42
+ end
43
+ end
44
+
34
45
  def remote_tracking_branches(upstream_exists_only = true)
35
46
  rb = remote_branches
36
47
 
@@ -109,7 +120,7 @@ module MGit
109
120
  end
110
121
 
111
122
  def dirty?
112
- [:index, :dirty, :untracked].any? { |f| flags.include?(f) }
123
+ [:index, :dirty].any? { |f| flags.include?(f) }
113
124
  end
114
125
 
115
126
  def in_repo
data/lib/mgit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MGit
2
- VERSION = '0.4.6'
2
+ VERSION = '0.4.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
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: 2014-06-08 00:00:00.000000000 Z
11
+ date: 2014-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -79,6 +79,7 @@ files:
79
79
  - lib/mgit/cli.rb
80
80
  - lib/mgit/command.rb
81
81
  - lib/mgit/commands/add.rb
82
+ - lib/mgit/commands/branches.rb
82
83
  - lib/mgit/commands/clone.rb
83
84
  - lib/mgit/commands/config.rb
84
85
  - lib/mgit/commands/fetch.rb