autoproj-git 1.0.3 → 1.0.4

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: e87c5a0adc38e2a65acbed7359c527b634986923
4
- data.tar.gz: 24a902da94632e1f7eb60d1cd7adb3c05896ac27
3
+ metadata.gz: 7474cb8e9b1582cc738897f3808029d2030e21ab
4
+ data.tar.gz: 75ebdf1817d68911f86ca90595effb7510105b0f
5
5
  SHA512:
6
- metadata.gz: 7bbccbd6ceb14ae9ec04be87ffa0c42200221210dd31305a8004027903a2d7be729517854db495b50189570ae8c372c68db954e583deb1c910b1bde8aa36a2c1
7
- data.tar.gz: a5ee4d79a0824d076df8d652cf0379bcaff51cc18b62327eec45be27b97b14574edcd93c5e46bdddd16afad04e322014087c441280538836975bbf952293daff
6
+ metadata.gz: ab0478a5b553af6beb1568e1d93c24f2e83c7319c4e4d6075d0af90364b6c529043bbf9cd7a38debf596c367783b60275aafe1fb3f222a740894457addf300e3
7
+ data.tar.gz: 8eff2bd002be02900e6d9e11576041ad6926b41a8e6cf35ec1486f1d56475f269d21a65e171c18ce73bd25c2e3678b75fb13661595bb9dd712e9ed796af53e66
@@ -15,21 +15,46 @@ module Autoproj
15
15
  pkg if pkg.importer.kind_of?(Autobuild::Git)
16
16
  end.compact
17
17
 
18
- git_packages.each_with_index do |pkg, i|
19
- cleanup_package(pkg, "[#{i}/#{git_packages.size}] ",
20
- local: options[:local],
21
- remove_obsolete_remotes: options[:remove_obsolete_remotes])
18
+ package_failures = []
19
+ pool = Concurrent::FixedThreadPool.new(4)
20
+ futures = git_packages.each_with_index.map do |pkg, i|
21
+ Concurrent::Future.execute(executor: pool) do
22
+ begin
23
+ cleanup_package(pkg, " [#{i}/#{git_packages.size}]",
24
+ local: options[:local],
25
+ remove_obsolete_remotes: options[:remove_obsolete_remotes])
26
+ nil
27
+ rescue Autobuild::SubcommandFailed => e
28
+ Autoproj.error "failed: #{e.message}"
29
+ e
30
+ end
31
+ end
32
+ end
33
+ package_failures = futures.each(&:execute).map(&:value!).compact
34
+ rescue Interrupt => interrupt
35
+ ensure
36
+ pool.shutdown if pool
37
+ Autobuild::Reporting.report_finish_on_error(
38
+ package_failures, on_package_failures: :raise, interrupted_by: interrupt)
39
+ end
40
+
41
+ def git_clean_invalid_refs(pkg, progress)
42
+ output = pkg.importer.run_git_bare(pkg, 'show-ref')
43
+ output.each do |line|
44
+ if m = line.match(/error: (.*) does not point to a valid object!/)
45
+ pkg.importer.run_git_bare(pkg, 'update-ref', '-d', m[1])
46
+ end
22
47
  end
23
48
  end
24
49
 
25
50
  def git_gc(pkg, progress)
26
- pkg.progress_start "#{progress}%s: gc", done_message: "#{progress}%s: gc" do
51
+ pkg.progress_start "gc %s#{progress}", done_message: "gc %s#{progress}" do
27
52
  pkg.importer.run_git_bare(pkg, 'gc')
28
53
  end
29
54
  end
30
55
 
31
56
  def git_repack(pkg, progress)
32
- pkg.progress_start "#{progress}%s: repack", done_message: "#{progress}%s: repack" do
57
+ pkg.progress_start "repack %s#{progress}", done_message: "repack %s#{progress}" do
33
58
  pkg.importer.run_git_bare(pkg, 'repack', '-adl')
34
59
  end
35
60
  end
@@ -44,11 +69,8 @@ module Autoproj
44
69
  end
45
70
 
46
71
  def git_remote_prune(pkg, progress)
47
- remotes = git_all_remotes(pkg)
48
- remotes.each do |remote_name|
49
- pkg.progress_start "#{progress}%s: pruning #{remote_name}", done_message: "#{progress}%s: pruned #{remote_name}" do
50
- pkg.importer.run_git(pkg, 'remote', 'prune', remote_name)
51
- end
72
+ pkg.progress_start "pruning %s#{progress}", done_message: "pruned %s#{progress}" do
73
+ pkg.importer.run_git(pkg, 'fetch', '-p')
52
74
  end
53
75
  end
54
76
 
@@ -59,13 +81,14 @@ module Autoproj
59
81
  end
60
82
 
61
83
  remotes.each do |remote_name|
62
- pkg.progress_start "#{progress}%s: removing remote #{remote_name}", done_message: "#{progress}%s: removed remote #{remote_name}" do
84
+ pkg.progress_start "removing remote %s/#{remote_name}#{progress}", done_message: "removed remote %s/#{remote_name}#{progress}" do
63
85
  pkg.importer.run_git(pkg, 'remote', 'rm', remote_name)
64
86
  end
65
87
  end
66
88
  end
67
89
 
68
90
  def cleanup_package(pkg, progress, options = Hash.new)
91
+ git_clean_invalid_refs(pkg, progress)
69
92
  if options[:remove_obsolete_remotes]
70
93
  git_remove_obsolete_remotes(pkg, progress)
71
94
  end
@@ -1,5 +1,5 @@
1
1
  module Autoproj
2
2
  module Git
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-02 00:00:00.000000000 Z
11
+ date: 2018-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autoproj