mgit 0.4.6 → 0.4.7
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.
- checksums.yaml +4 -4
- data/lib/mgit/commands/branches.rb +26 -0
- data/lib/mgit/commands/clone.rb +7 -9
- data/lib/mgit/repository.rb +12 -1
- data/lib/mgit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f34a0f58527681ae3555ace98e7f7ab91adacdcb
|
4
|
+
data.tar.gz: 57e4d004541d62602ab2ed2aa1591cb4babe032e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/mgit/commands/clone.rb
CHANGED
@@ -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
|
5
|
-
|
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
|
-
|
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
|
data/lib/mgit/repository.rb
CHANGED
@@ -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
|
123
|
+
[:index, :dirty].any? { |f| flags.include?(f) }
|
113
124
|
end
|
114
125
|
|
115
126
|
def in_repo
|
data/lib/mgit/version.rb
CHANGED
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.
|
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-
|
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
|