mgit 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mgit/commands/show.rb +64 -0
- data/lib/mgit/repository.rb +4 -2
- 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: d9b3bfc54404924e4ed38ea5a98aa62a11707fa4
|
4
|
+
data.tar.gz: c72619042d01acef75e949a9e957bf63f84421c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09e18f231d617d8ecd65e59f690d337a0cfa11de889d33e52babb830476ddb9003b96eb113bef2e4764157f30d63c661f85dd2f4b7ac9b5e92b97a67a65b0ae6
|
7
|
+
data.tar.gz: 658fb29f923abb609ab78972d3dfedf379ae7d338d78293f99d97338b34723b6eeb999a88295da7f70ad1b220bfc8d3f0d90d30f00d359fb8058c2d0f0c12c0a
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module MGit
|
2
|
+
class ShowCommand < Command
|
3
|
+
def execute(args)
|
4
|
+
@commit = args.shift
|
5
|
+
|
6
|
+
case repos.size
|
7
|
+
when 0
|
8
|
+
perror "Couldn't find commit #{@commit} in any repository."
|
9
|
+
when 1
|
10
|
+
show_commit(repos.first)
|
11
|
+
else
|
12
|
+
show_menu
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def arity
|
17
|
+
[1, 1]
|
18
|
+
end
|
19
|
+
|
20
|
+
def usage
|
21
|
+
'show <commit-sha/obj>'
|
22
|
+
end
|
23
|
+
|
24
|
+
def description
|
25
|
+
'display commit object from any repository'
|
26
|
+
end
|
27
|
+
|
28
|
+
register_command :show
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def repos
|
33
|
+
@rs || begin
|
34
|
+
@rs = []
|
35
|
+
Registry.chdir_each do |r|
|
36
|
+
@rs << r if has_commit?
|
37
|
+
end
|
38
|
+
@rs
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def has_commit?
|
43
|
+
!(`git rev-parse --quiet --verify #{@commit}`.empty?)
|
44
|
+
end
|
45
|
+
|
46
|
+
def show_commit(repo)
|
47
|
+
repo.chdir do
|
48
|
+
system("git show #{@commit}")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def show_menu
|
53
|
+
pinfo "Found commit #{@commit} in multiple repositories."
|
54
|
+
choose do |menu|
|
55
|
+
menu.prompt = 'Which one should be used?'
|
56
|
+
repos.each do |r|
|
57
|
+
menu.choice(r.name) do
|
58
|
+
show_commit(r)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/mgit/repository.rb
CHANGED
@@ -96,12 +96,14 @@ module MGit
|
|
96
96
|
[:index, :dirty, :untracked].any? { |f| flags.include?(f) }
|
97
97
|
end
|
98
98
|
|
99
|
-
private
|
100
|
-
|
101
99
|
def in_repo
|
102
100
|
Dir.chdir(path) { yield }
|
103
101
|
end
|
104
102
|
|
103
|
+
alias_method :chdir, :in_repo
|
104
|
+
|
105
|
+
private
|
106
|
+
|
105
107
|
def status
|
106
108
|
@status ||= in_repo { `git status --short --branch --ignore-submodules`.split("\n") }
|
107
109
|
end
|
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.3.
|
4
|
+
version: 0.3.1
|
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: 2013-12-
|
11
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/mgit/commands/foreach.rb
|
93
93
|
- lib/mgit/commands/add.rb
|
94
94
|
- lib/mgit/commands/log.rb
|
95
|
+
- lib/mgit/commands/show.rb
|
95
96
|
- lib/mgit/commands/ffmerge.rb
|
96
97
|
- lib/mgit/commands/clone.rb
|
97
98
|
- lib/mgit/command.rb
|