avm-git 0.23.0 → 0.24.0
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/avm/git/issue/complete/commits.rb +1 -1
- data/lib/avm/git/launcher_stereotypes/git_subrepo.rb +9 -5
- data/lib/avm/git/runners/base/subrepo/fix/rebase.rb +51 -0
- data/lib/avm/git/runners/base/subrepo/fix.rb +42 -33
- data/lib/avm/git/subrepo/checks.rb +1 -1
- data/lib/avm/git/version.rb +1 -1
- metadata +12 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f463713bd688c8f5f38ab60a0798195009a1c7c9e3fdbca0b63019de18af4e7e
|
|
4
|
+
data.tar.gz: 45b78d469200bcb7425ea018167b8ef987036892d255c08b9afc5c6cca25772e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 430a782734bd006d843458a05bce5b469d6bb5392215cd1e34110a1f397aabcf0b3d171fb4b7771b37d8b130334838fdf8b54eca5f14ae3b832c1a2393fc79a6
|
|
7
|
+
data.tar.gz: 239b3e62804fe65116688785d63d61a4da64e002d01bb149b75156a14aafc65c56c5c8d92678e537832c46288925198205122430c8dc1096259dfb0596b05f32
|
|
@@ -18,11 +18,15 @@ module Avm
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def subrepo_url(path)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
configuration(path).remote_uri ||
|
|
22
|
+
raise(::Avm::Git::Launcher::Error.new(path, '"remote = ... " not found'))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
# @return [EacGit::Subrepo::Configuration]
|
|
28
|
+
def configuration(path)
|
|
29
|
+
::EacGit::Subrepo::Configuration.from_file(path.subpath(CONFIG_SUBPATH))
|
|
26
30
|
end
|
|
27
31
|
end
|
|
28
32
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'shellwords'
|
|
4
|
+
|
|
5
|
+
module Avm
|
|
6
|
+
module Git
|
|
7
|
+
module Runners
|
|
8
|
+
class Base
|
|
9
|
+
class Subrepo
|
|
10
|
+
class Fix
|
|
11
|
+
class Rebase
|
|
12
|
+
# @!method initialize(local, upstream, commands)
|
|
13
|
+
# @param local [EacGit::Local]
|
|
14
|
+
# @param upstream [String]
|
|
15
|
+
# @param commands [Hash<String, String>] Commands indexed by full commit ID.
|
|
16
|
+
common_constructor :local, :upstream, :commands
|
|
17
|
+
|
|
18
|
+
# @return [void]
|
|
19
|
+
def perform
|
|
20
|
+
::EacRubyUtils::Fs::Temp.on_file do |todo_file|
|
|
21
|
+
todo_file.write(todo)
|
|
22
|
+
local.command('rebase', '-i', upstream)
|
|
23
|
+
.envvar('GIT_SEQUENCE_EDITOR', "cp #{todo_file.to_path.shellescape}").system!
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @return [String]
|
|
28
|
+
def todo
|
|
29
|
+
commits.flat_map { |commit| commit_lines(commit) }.map { |line| "#{line}\n" }.join
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
protected
|
|
33
|
+
|
|
34
|
+
# @param commit [String]
|
|
35
|
+
# @return [Array<String>]
|
|
36
|
+
def commit_lines(commit)
|
|
37
|
+
["pick #{commit}", commands[commit].if_present { |v| "exec #{v}" }].compact
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @return [Array<String>]
|
|
41
|
+
def commits
|
|
42
|
+
local.command('rev-list', '--reverse', '--no-merges', "#{upstream}..HEAD")
|
|
43
|
+
.execute!.split
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -1,65 +1,74 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'shellwords'
|
|
4
|
+
|
|
3
5
|
module Avm
|
|
4
6
|
module Git
|
|
5
7
|
module Runners
|
|
6
8
|
class Base
|
|
7
9
|
class Subrepo
|
|
8
10
|
class Fix
|
|
11
|
+
UPSTREAM = 'origin/master'
|
|
12
|
+
|
|
9
13
|
runner_with :help do
|
|
10
14
|
desc 'Fix git-subrepos\' parent property.'
|
|
11
15
|
end
|
|
12
16
|
|
|
13
17
|
def run
|
|
14
|
-
|
|
15
|
-
break if fix
|
|
18
|
+
return unless check_failed?
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
+
rebase
|
|
21
|
+
fatal_error 'Failed' if check_failed?
|
|
20
22
|
end
|
|
21
23
|
|
|
22
24
|
private
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[::Avm::Scms::AutoCommit::Rules::Unique.new]
|
|
31
|
-
).run
|
|
32
|
-
end
|
|
26
|
+
# @return [Boolean]
|
|
27
|
+
def check_failed?
|
|
28
|
+
infom 'Checking...'
|
|
29
|
+
checks = ::Avm::Git::Subrepo::Checks.new(local_repos).add_all_subrepos
|
|
30
|
+
checks.show_result
|
|
31
|
+
checks.result.error?
|
|
33
32
|
end
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
# @param subrepos [Array<EacGit::Local::Subrepo>]
|
|
35
|
+
# @return [String]
|
|
36
|
+
def fix_parent_command(subrepos)
|
|
37
|
+
paths = subrepos.map { |subrepo| subrepo.config_relative_path.to_path.shellescape }
|
|
38
|
+
paths.map { |path| fix_parent_path_command(path) }
|
|
39
|
+
.push("git add -- #{paths.join(' ')}", 'git commit --amend --no-edit')
|
|
40
|
+
.join(' && ')
|
|
40
41
|
end
|
|
41
42
|
|
|
42
|
-
# @
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
# @param path [String]
|
|
44
|
+
# @return [String]
|
|
45
|
+
def fix_parent_path_command(path)
|
|
46
|
+
"git config --file=#{path} subrepo.parent \"$(git rev-parse HEAD^)\""
|
|
45
47
|
end
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
# @param subrepo [EacGit::Local::Subrepo]
|
|
50
|
+
# @return [String]
|
|
51
|
+
def last_config_change(subrepo)
|
|
52
|
+
local_repos.command('log', '-n', '1', '--pretty=format:%H', '--',
|
|
53
|
+
subrepo.config_relative_path.to_path).execute!.strip
|
|
51
54
|
end
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
# @return [EacGit::Local]
|
|
57
|
+
memoize def local_repos
|
|
54
58
|
::EacGit::Local.new(runner_context.call(:git))
|
|
55
59
|
end
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
).
|
|
61
|
+
# @return [void]
|
|
62
|
+
def rebase
|
|
63
|
+
::Avm::Git::Runners::Base::Subrepo::Fix::Rebase.new(
|
|
64
|
+
local_repos, UPSTREAM,
|
|
65
|
+
subrepos_by_last_config_change.transform_values { |v| fix_parent_command(v) }
|
|
66
|
+
).perform
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @return [Hash<String, Array<EacGit::Local::Subrepo>>]
|
|
70
|
+
memoize def subrepos_by_last_config_change
|
|
71
|
+
local_repos.subrepos.group_by { |subrepo| last_config_change(subrepo) }
|
|
63
72
|
end
|
|
64
73
|
end
|
|
65
74
|
end
|
data/lib/avm/git/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avm-git
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.24.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Put here the authors
|
|
@@ -30,6 +30,9 @@ dependencies:
|
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '0.22'
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: 0.22.1
|
|
33
36
|
type: :runtime
|
|
34
37
|
prerelease: false
|
|
35
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -37,20 +40,23 @@ dependencies:
|
|
|
37
40
|
- - "~>"
|
|
38
41
|
- !ruby/object:Gem::Version
|
|
39
42
|
version: '0.22'
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: 0.22.1
|
|
40
46
|
- !ruby/object:Gem::Dependency
|
|
41
47
|
name: eac_ruby_utils
|
|
42
48
|
requirement: !ruby/object:Gem::Requirement
|
|
43
49
|
requirements:
|
|
44
50
|
- - "~>"
|
|
45
51
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0.
|
|
52
|
+
version: '0.136'
|
|
47
53
|
type: :runtime
|
|
48
54
|
prerelease: false
|
|
49
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
56
|
requirements:
|
|
51
57
|
- - "~>"
|
|
52
58
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0.
|
|
59
|
+
version: '0.136'
|
|
54
60
|
- !ruby/object:Gem::Dependency
|
|
55
61
|
name: filesize
|
|
56
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -131,14 +137,14 @@ dependencies:
|
|
|
131
137
|
requirements:
|
|
132
138
|
- - "~>"
|
|
133
139
|
- !ruby/object:Gem::Version
|
|
134
|
-
version: '0.
|
|
140
|
+
version: '0.16'
|
|
135
141
|
type: :development
|
|
136
142
|
prerelease: false
|
|
137
143
|
version_requirements: !ruby/object:Gem::Requirement
|
|
138
144
|
requirements:
|
|
139
145
|
- - "~>"
|
|
140
146
|
- !ruby/object:Gem::Version
|
|
141
|
-
version: '0.
|
|
147
|
+
version: '0.16'
|
|
142
148
|
executables: []
|
|
143
149
|
extensions: []
|
|
144
150
|
extra_rdoc_files: []
|
|
@@ -195,6 +201,7 @@ files:
|
|
|
195
201
|
- lib/avm/git/runners/base/subrepo/check.rb
|
|
196
202
|
- lib/avm/git/runners/base/subrepo/clone.rb
|
|
197
203
|
- lib/avm/git/runners/base/subrepo/fix.rb
|
|
204
|
+
- lib/avm/git/runners/base/subrepo/fix/rebase.rb
|
|
198
205
|
- lib/avm/git/scms/git.rb
|
|
199
206
|
- lib/avm/git/scms/git/branch.rb
|
|
200
207
|
- lib/avm/git/scms/git/branches.rb
|