obazoud-git-external 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -68,7 +68,7 @@ git external rm <path>
68
68
  git clone git://github.com/obazoud/git-external.git
69
69
  cd git-external
70
70
  git checkout develop
71
- gem build obazoud-git-external.gemspec && gem install --local obazoud-git-external-0.7.0.gem
71
+ gem build obazoud-git-external.gemspec && gem install --local obazoud-git-external-0.8.0.gem
72
72
  </pre>
73
73
 
74
74
  And voilà!
data/bin/git-external CHANGED
@@ -92,6 +92,21 @@ def untracked_files?(path)
92
92
  return ((untrackedExit == 1 || untracked.length > 0) ? true : false)
93
93
  end
94
94
 
95
+ # find how many commits we are ahead/behind our upstream
96
+ def ahead_behind_upstream(path)
97
+ upstreamExit, upstream = execute('git rev-list', ['--count', '--left-right', '@{upstream}...HEAD'], path, '2> /dev/null')
98
+ return "" if upstreamExit != 0
99
+ behind, ahead = upstream.match(/^(\d*)\t(\d*)$/).captures
100
+ my_str = ""
101
+ if Integer(behind) > 0 && Integer(ahead) > 0
102
+ my_str << "(u"
103
+ my_str << "+#{ahead}" if Integer(ahead) > 0
104
+ my_str << "-#{behind}" if Integer(behind) > 0
105
+ my_str << ")"
106
+ end
107
+ my_str
108
+ end
109
+
95
110
  # Check if a branch exists
96
111
  def branch_exists(path, branch)
97
112
  branchesExit, branches = execute('git branch', [], path)
@@ -179,6 +194,8 @@ def command_status
179
194
  untrackedString = ""
180
195
  end
181
196
 
197
+ upstream = ahead_behind_upstream(path)
198
+
182
199
  remoteBranch = remote + "/" + gitBranch
183
200
 
184
201
  if gitBranchExit != 0 && gitBranchExit != 1 && gitRemoteExit != 0 && gitRemoteExit != 1
@@ -187,14 +204,14 @@ def command_status
187
204
  else
188
205
  if branch == remoteBranch
189
206
  if url == gitRemote
190
- puts " ✓ #{path} #{changesString} #{untrackedString}"
207
+ puts " ✓ #{path} #{upstream} #{changesString} #{untrackedString}"
191
208
  ok += 1
192
209
  else
193
- puts " ✗ #{path} #{changesString} #{untrackedString} -- expected url '#{url}' but was '#{gitRemote}'"
210
+ puts " ✗ #{path} #{upstream} #{changesString} #{untrackedString} -- expected url '#{url}' but was '#{gitRemote}'"
194
211
  broken +=1
195
212
  end
196
213
  else
197
- puts " ✗ #{path} #{changesString} #{untrackedString} -- expected branch '#{branch}' but was '#{remoteBranch}'"
214
+ puts " ✗ #{path} #{upstream} #{changesString} #{untrackedString} -- expected branch '#{branch}' but was '#{remoteBranch}'"
198
215
  broken +=1
199
216
  end
200
217
  end
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'obazoud-git-external'
4
- s.version = '0.7.0'
4
+ s.version = '0.8.0'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ['Daniel Cestari', 'Olivier Bazoud', 'Alastair Harrison']
7
7
  s.email = ["olivier.bazoud@gmail.com"]
metadata CHANGED
@@ -1,27 +1,35 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: obazoud-git-external
3
- version: !ruby/object:Gem::Version
4
- version: 0.7.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 63
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 8
9
+ - 0
10
+ version: 0.8.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Daniel Cestari
9
14
  - Olivier Bazoud
10
15
  - Alastair Harrison
11
16
  autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
- date: 2012-11-23 00:00:00.000000000 Z
19
+
20
+ date: 2012-11-23 00:00:00 Z
15
21
  dependencies: []
16
- description: Extension for git which adds a command providing similar functionality
17
- to git submodules but without attaching each module to a single version
18
- email:
22
+
23
+ description: Extension for git which adds a command providing similar functionality to git submodules but without attaching each module to a single version
24
+ email:
19
25
  - olivier.bazoud@gmail.com
20
- executables:
26
+ executables:
21
27
  - git-external
22
28
  extensions: []
29
+
23
30
  extra_rdoc_files: []
24
- files:
31
+
32
+ files:
25
33
  - .gitignore
26
34
  - LICENSE.txt
27
35
  - README.markdown
@@ -30,26 +38,36 @@ files:
30
38
  - unittest.sh
31
39
  homepage: http://github.com/obazoud/git-external
32
40
  licenses: []
41
+
33
42
  post_install_message:
34
43
  rdoc_options: []
35
- require_paths:
44
+
45
+ require_paths:
36
46
  - lib
37
- required_ruby_version: !ruby/object:Gem::Requirement
47
+ required_ruby_version: !ruby/object:Gem::Requirement
38
48
  none: false
39
- requirements:
40
- - - ! '>='
41
- - !ruby/object:Gem::Version
42
- version: '0'
43
- required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ hash: 3
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
57
  none: false
45
- requirements:
46
- - - ! '>='
47
- - !ruby/object:Gem::Version
48
- version: '0'
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
49
65
  requirements: []
66
+
50
67
  rubyforge_project:
51
68
  rubygems_version: 1.8.24
52
69
  signing_key:
53
70
  specification_version: 3
54
71
  summary: Git version of an svn:external, an alternative to Git Submodule
55
72
  test_files: []
73
+