git-bundle 1.0.6 → 1.0.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: a8feeeb925b20aaf6289003e567f9f243e03d518
4
- data.tar.gz: e8eac2a34eefd759c6a726c9e04e227fc736b623
3
+ metadata.gz: cc213a9a96e4df28ae91c20989a06431fd3202ce
4
+ data.tar.gz: 7be0ca2bca7c8d53a275b8d5ecd2fcfc63cd5951
5
5
  SHA512:
6
- metadata.gz: 457e165a94c0e638a4437b6eb85aa6ad983673ae4573c24abb52f08e6e41942b1ac3f5105e3a3bb79ff4e9df6edef349eb7ae06ee5807846a46809ba8196ffd5
7
- data.tar.gz: f3c240557a740e25d9ee5baab591e9ff224123d7732f65f3703b8c44545418a02a747109fe489fdf3bd8df6237b9d8bc151b24ef843a74d81987ce28c3441c75
6
+ metadata.gz: 23105fce66785c11cbd80adf4635251a77db4e5aaa4326f635cc739a1a141c01a2f6837cc25203655aa633ab7a857d1e6e3f1b8775f28f378a8385a5f3aa3ba7
7
+ data.tar.gz: 9b8e0e887bc405c619015524b4a5038b89df568ccbbdebdb855b0f8dc189d3b797711b4bafd58cbeba949d7704b24de48f1f3b7067c607b1e45fb7624bc60073
@@ -12,7 +12,10 @@ module GitBundle
12
12
  return false unless prompt_confirm
13
13
 
14
14
  lockfile = Bundler.default_lockfile.basename.to_s
15
- if gemfile_lock_stale?
15
+ stale_repos = @repositories.select { |repo| !repo.main && repo.stale? }
16
+ stale_commits_message = stale_repos.map { |repo| "#{repo.name}(#{repo.stale_commits_count})" }.join(', ')
17
+
18
+ if stale_repos.any?
16
19
  puts "Local gems were updated. Building new #{lockfile} with bundle install."
17
20
  unless build_gemfile_lock
18
21
  puts_error 'Bundle install failed. Please run it manually before trying to push changes.'
@@ -20,8 +23,19 @@ module GitBundle
20
23
  end
21
24
  end
22
25
 
23
- combined_messages = @repositories.map { |repo| repo.commit_messages_not_pushed }.uniq.join("\n\n")
24
- @repositories.reject { |repo| repo.main || repo.commits_not_pushed.empty? }.each do |repo|
26
+ if main_repository.file_changed?(lockfile)
27
+ main_repository.add_file(lockfile)
28
+ if stale_commits_message.empty?
29
+ message = 'Updated Gemfile.lock.'
30
+ else
31
+ message = "Gemfile.lock includes new commits of: #{stale_commits_message}."
32
+ end
33
+
34
+ main_repository.commit(message, lockfile)
35
+ puts message
36
+ end
37
+
38
+ @repositories.select { |repo| !repo.main && repo.commits_not_pushed_count > 0 }.each do |repo|
25
39
  puts_repo_heading(repo)
26
40
  unless repo.push(@args)
27
41
  puts_error "Failed to push changes of #{repo.name}. Try pulling the latest changes or resolve conflicts first."
@@ -30,11 +44,6 @@ module GitBundle
30
44
  end
31
45
 
32
46
  puts_repo_heading(main_repository)
33
- if main_repository.file_changed?(lockfile)
34
- main_repository.add_file(lockfile)
35
- main_repository.commit("Updated Gemfile.lock to include changes: #{combined_messages}", lockfile)
36
- end
37
-
38
47
  unless main_repository.push(@args)
39
48
  puts_error "Failed to push changes of #{main_repository.name}. Try pulling the latest changes or resolve conflicts first."
40
49
  end
@@ -82,7 +91,7 @@ module GitBundle
82
91
  end
83
92
 
84
93
  def gemfile_lock_stale?
85
- @repositories.any? { |repo| repo.revision != repo.locked_revision }
94
+ @repositories.any? { |repo| repo.stale? }
86
95
  end
87
96
 
88
97
  def build_gemfile_lock
@@ -93,4 +102,4 @@ module GitBundle
93
102
  end
94
103
  end
95
104
  end
96
- end
105
+ end
@@ -36,13 +36,24 @@ module GitBundle
36
36
  @locked_revision || revision
37
37
  end
38
38
 
39
+ def stale?
40
+ revision != locked_revision
41
+ end
42
+
43
+ def stale_commits
44
+ execute_git('rev-list', '--pretty=oneline', '--abbrev-commit', "#{locked_revision}..#{revision}")
45
+ end
46
+
47
+ def stale_commits_count
48
+ execute_git('rev-list', '--pretty=oneline', '--abbrev-commit', '--count', "#{locked_revision}..#{revision}").to_i
49
+ end
50
+
39
51
  def commits_not_pushed
40
52
  execute_git('rev-list', '--pretty=oneline', '--abbrev-commit', "origin/#{branch}..#{branch}")
41
53
  end
42
54
 
43
- def commit_messages_not_pushed
44
- count = execute_git('rev-list', "origin/#{branch}..#{branch}", '--count').to_i
45
- count.times.map { |num| execute_git('rev-list', '--pretty=oneline', "--skip=#{num}", '--max-count=1', "origin/#{branch}..#{branch}").sub(/\h*\s/, '').strip }
55
+ def commits_not_pushed_count
56
+ execute_git('rev-list', '--pretty=oneline', '--abbrev-commit', '--count', "origin/#{branch}..#{branch}").to_i
46
57
  end
47
58
 
48
59
  def push(args)
@@ -1,3 +1,3 @@
1
1
  module GitBundle
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Pretorius
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-12 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,4 +75,3 @@ specification_version: 4
75
75
  summary: Simplifies working with gems from git repositories in combination with local
76
76
  overrides.
77
77
  test_files: []
78
- has_rdoc: