avmtrf1-tools 0.8.1 → 0.9.0

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
  SHA256:
3
- metadata.gz: f03d926a7ddca3b912f57174f50f650ff3a4b6400cd02e272fa5fb3d39c4ff93
4
- data.tar.gz: 24bc88f1cff2bb1242caa262432dc0ed61c2bcbce05e96712e139c262e8938a7
3
+ metadata.gz: 777ea2b3c50e09553565dffe045f75d83355b6b80a44e3ee390f4fc9bc39401a
4
+ data.tar.gz: 5323ea0237c1d9136c74dd9a227663184be4cd9822e204ae11d56c4e8e8b2a8f
5
5
  SHA512:
6
- metadata.gz: 56e39a9c82c64ed30da2124b886326863ac676fdc849a6547930bb2a6497f64009819d51c3c7f42e3f1f01b97ac6bab0386cf570f73f700d251e0e8fd812b11d
7
- data.tar.gz: f478e7dac578971f6ee30fb96f7e8c29046cbf4929bc04f463b648f5dfedc2e43b1111d21329c8c7404ef8f092926b0d9acc6530afee700dee940655cfcaf7f1
6
+ metadata.gz: c18ec390a1b12454422a6f973efcdba70708eb5f99f12ac2663bca459b6ff72819580e70485766256eda64992cc1e10cf4c75a2040601859c6f630a8517543d1
7
+ data.tar.gz: d10352ab9f7c69141fa9fda14a18432a70f21787a1db0a23bde067661df90147c8678cd302b965154ff7aa6508abf7444ea49b158588968f793f6580e1dcb62f
@@ -7,6 +7,8 @@ module Avmtrf1
7
7
  require 'avmtrf1/default_esosti'
8
8
  require 'avmtrf1/default_jira'
9
9
  require 'avmtrf1/default_redmine'
10
+ require 'avmtrf1/filesystem_cache'
11
+ require 'avmtrf1/fs_cache'
10
12
  require 'avmtrf1/git'
11
13
  require 'avmtrf1/ini'
12
14
  require 'avmtrf1/issues'
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ class FilesystemCache
5
+ attr_reader :path
6
+
7
+ def initialize(*path_parts)
8
+ raise ArgumentError, "\"#{path_parts}\" is empty" if path_parts.empty?
9
+
10
+ @path = ::File.join(*path_parts.map(&:to_s))
11
+ end
12
+
13
+ def read
14
+ check_file
15
+ return nil unless ::File.exist?(path)
16
+
17
+ ::File.read(path)
18
+ end
19
+
20
+ def write(value)
21
+ raise "\"#{value}\" is blank" if value.blank?
22
+
23
+ check_file
24
+ ::File.write(path, value)
25
+ value
26
+ end
27
+
28
+ def sub(*path_parts)
29
+ self.class.new(absolute_path, *path_parts)
30
+ end
31
+
32
+ def absolute_path
33
+ ::File.expand_path(path)
34
+ end
35
+
36
+ def dirname
37
+ ::File.dirname
38
+ end
39
+
40
+ private
41
+
42
+ def check_file
43
+ dirname = ::File.dirname(absolute_path)
44
+ raise "#{dirname}|#{dirname.class}" unless dirname.is_a?(String)
45
+
46
+ ::FileUtils.mkdir_p(dirname)
47
+ return unless ::File.exist?(absolute_path)
48
+ return if ::File.file?(absolute_path)
49
+
50
+ raise "\"#{absolute_path}\" exist and is not a path"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avmtrf1/filesystem_cache'
4
+
5
+ module Avmtrf1
6
+ class << self
7
+ def fs_cache
8
+ @fs_cache ||= ::Avmtrf1::FilesystemCache.new(ENV['HOME'], '.cache', 'avmtrf1-tools')
9
+ end
10
+ end
11
+ end
@@ -4,6 +4,7 @@ module Avmtrf1
4
4
  module Git
5
5
  require 'avmtrf1/git/cached_repository'
6
6
  require 'avmtrf1/git/issue_on_repository'
7
+ require 'avmtrf1/git/push_large'
7
8
  require 'avmtrf1/git/reference'
8
9
  end
9
10
  end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ostruct'
4
+
5
+ require 'eac_ruby_utils/console/speaker'
6
+ require 'eac_ruby_utils/require_sub'
7
+ require 'eac_ruby_utils/simple_cache'
8
+ require 'avmtrf1/patches/eac_launcher/git/base'
9
+
10
+ module Avmtrf1
11
+ module Git
12
+ class PushLarge
13
+ include ::EacRubyUtils::SimpleCache
14
+ include ::EacRubyUtils::Console::Speaker
15
+
16
+ ::EacRubyUtils.require_sub(__FILE__)
17
+
18
+ attr_reader :git, :remote_name, :source_ref, :target_ref, :last_pushed_revision
19
+
20
+ def initialize(git_local_path, remote_name, source_ref, target_ref)
21
+ @git = ::EacLauncher::Git::Base.new(git_local_path)
22
+ @remote_name = remote_name
23
+ @source_ref = source_ref
24
+ @target_ref = target_ref
25
+ @last_pushed_revision = nil
26
+ end
27
+
28
+ def run
29
+ start_banner
30
+ push_revisions
31
+ end
32
+
33
+ def fs_cache
34
+ @fs_cache ||= ::Avmtrf1.fs_cache.sub(::File.expand_path(git).parameterize)
35
+ end
36
+
37
+ private
38
+
39
+ def start_banner
40
+ infov 'Git local', git
41
+ infov 'Remote name', remote_name
42
+ infov 'Source ref.', source_ref
43
+ infov 'Source rev.', source_rev
44
+ infov 'Target ref.', target_ref
45
+ infov 'Revisions to push', revisions.count
46
+ end
47
+
48
+ def push_revisions
49
+ count = 1
50
+ revisions.each do |rev|
51
+ infom "Pushing commit #{count}/#{revisions.count}..."
52
+ source_commit = ::Avmtrf1::Git::PushLarge::SourceCommit.new(self, rev)
53
+ source_commit.run
54
+ @last_pushed_revision = source_commit.pushed_revision.read
55
+ count += 1
56
+ end
57
+ end
58
+
59
+ def source_rev
60
+ git.rev_parse(source_ref)
61
+ end
62
+
63
+ def revisions_uncached
64
+ git.execute!('--no-pager', 'log', '--reverse', '--pretty=format:%H', source_rev)
65
+ .each_line.map(&:strip)
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class << self
7
+ def bytes_size(size)
8
+ return 'NONE' if size.blank?
9
+
10
+ b = "#{size} B"
11
+ "#{::Filesize.from(b).pretty} (#{b})"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+
5
+ module Avmtrf1
6
+ module Git
7
+ class PushLarge
8
+ class LfsCommit
9
+ include ::EacRubyUtils::Console::Speaker
10
+ include ::EacRubyUtils::SimpleCache
11
+
12
+ ::EacRubyUtils.require_sub(__FILE__)
13
+
14
+ attr_reader :source_commit, :lfs_file_min_size, :tracked_files
15
+
16
+ def initialize(source_commit, lfs_file_min_size)
17
+ @source_commit = source_commit
18
+ @lfs_file_min_size = lfs_file_min_size
19
+ @tracked_files = 0
20
+ @commit = nil
21
+ end
22
+
23
+ def push_ok?
24
+ push_ok
25
+ end
26
+
27
+ def start_banner
28
+ infov ' * LFS push', "revision: #{source_revision}" \
29
+ ", lfs_file_min_size: #{PushLarge.bytes_size(lfs_file_min_size)}"
30
+ end
31
+
32
+ private
33
+
34
+ def git
35
+ source_commit.git
36
+ end
37
+
38
+ def push_large
39
+ source_commit.push_large
40
+ end
41
+
42
+ def previous_revision
43
+ push_large.last_pushed_revision
44
+ end
45
+
46
+ def source_revision
47
+ source_commit.sha1
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ private
8
+
9
+ def checkout_base_uncached
10
+ if previous_revision.blank?
11
+ checkout_orphan
12
+ else
13
+ checkout_previous_revision
14
+ end
15
+ end
16
+
17
+ def checkout_orphan
18
+ infom message('Checkout orphan')
19
+ git.execute!('reset', '--hard')
20
+ git.execute!('clean', '-df')
21
+ git.execute!('checkout', source_commit.sha1)
22
+ end
23
+
24
+ def checkout_previous_revision
25
+ infom message("Checkout previous revision #{previous_revision}")
26
+ git.execute!('reset', '--hard')
27
+ git.execute!('clean', '-df')
28
+ git.execute!('checkout', previous_revision)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ private
8
+
9
+ def cherry_pick_source_revision_uncached
10
+ checkout_base
11
+ return unless previous_revision.present?
12
+
13
+ infom message("Cherry pick #{source_commit.sha1}")
14
+ result = git.execute('cherry-pick', '--allow-empty', '--allow-empty-message', '-Xtheirs',
15
+ source_commit.sha1)
16
+ check_cherry_pick_result(result)
17
+ end
18
+
19
+ def check_cherry_pick_result(result)
20
+ return if result.fetch(:exit_code).zero?
21
+
22
+ raise "Cherry pick failed: #{result}" unless cherry_pick_conflict?
23
+
24
+ warn message('Cherry pick failed with conflict')
25
+ resolve_cherry_pick_conflicts
26
+
27
+ check_dirty_files
28
+ check_cherry_continue
29
+ end
30
+
31
+ def cherry_pick_conflict?
32
+ ::File.exist?(::File.join(git, '.git', 'CHERRY_PICK_HEAD'))
33
+ end
34
+
35
+ def resolve_cherry_pick_conflicts
36
+ git.status_files.each do |scf|
37
+ if scf.dirty == 'D'
38
+ remove_file(scf.path)
39
+ elsif scf.dirty.present?
40
+ add_file(scf.path)
41
+ end
42
+ end
43
+ end
44
+
45
+ def remove_file(path)
46
+ infov message('Removing file'), path
47
+ git.execute!('rm', path)
48
+ end
49
+
50
+ def add_file(path)
51
+ infov message('Adding file'), path
52
+ git.execute!('add', path)
53
+ end
54
+
55
+ def check_dirty_files
56
+ infom message('Checking dirty files...')
57
+ df = dirty_files
58
+ infov message('Dirty files?'), df.any?
59
+ return unless df.any?
60
+
61
+ df.each do |f|
62
+ infov message(f.path, 1), "|#{f.stage}|#{f.dirty}|"
63
+ end
64
+ raise 'There are dirty files'
65
+ end
66
+
67
+ def dirty_files
68
+ git.status_files.select { |scf| scf.dirty.present? }
69
+ end
70
+
71
+ def check_cherry_continue
72
+ infom message('Continuing cherry pick')
73
+ git.execute!('-c', "core.editor=#{bash_editor}", 'cherry-pick', '--continue')
74
+ raise 'Still in cherry-pick conflict' if cherry_pick_conflict?
75
+
76
+ infom message('Cherry pick continue successful')
77
+ end
78
+
79
+ def bash_editor
80
+ if source_commit.subject.present?
81
+ 'true'
82
+ else
83
+ 'bash -c "printf \\"Mensagem original em branco.\\n\\" > $1"'
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ private
8
+
9
+ EXTENSIONS_REQUIRED_TO_TRACK = %w[
10
+ bak bkp bmp bpm cfm chm dat db doc fla flv gz jar log mp3 mp4 otf pdf ppt psd rar rtf swf
11
+ ttf wav wmf wmv wmz woff woff2 xmind z zip
12
+ ].freeze
13
+
14
+ def track_large_files_uncached
15
+ cherry_pick_source_revision
16
+ if lfs_file_min_size.present?
17
+
18
+ source_commit.files.each do |file|
19
+ next unless track_file_with_lfs?(file)
20
+
21
+ track_file(file)
22
+ end
23
+ raise 'None file was tracked' unless tracked_files.positive?
24
+ end
25
+ infov message('Tracked files'), @tracked_files
26
+ end
27
+
28
+ def track_file(file)
29
+ infov message('Tracking with LFS'), file
30
+ git.execute!('rm', '--cached', file.path)
31
+ git.execute!('lfs', 'track', file.path) unless tracked_file?(file)
32
+ @tracked_files += 1
33
+ end
34
+
35
+ def track_file_with_lfs?(file)
36
+ return false unless file.dst_size.positive?
37
+
38
+ required_extesion_to_track?(file) || (file.dst_size >= lfs_file_min_size)
39
+ end
40
+
41
+ def required_extesion_to_track?(file)
42
+ EXTENSIONS_REQUIRED_TO_TRACK.include?(::File.extname(file.path).gsub(/\A\./, ''))
43
+ end
44
+
45
+ def tracked_file?(file)
46
+ git.execute!('check-attr', '--all', '--', file.path).strip.present?
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ # @return [Avm::Git::Commit]
8
+ def commit
9
+ commit_changes
10
+ @commit
11
+ end
12
+
13
+ private
14
+
15
+ def commit_changes_uncached
16
+ if sha1_cache.read.present?
17
+ @commit = ::Avm::Git::Commit.new(git, sha1_cache.read)
18
+ return
19
+ end
20
+ track_large_files
21
+ add_files
22
+ commit_amend
23
+ store_commit
24
+ end
25
+
26
+ def add_files
27
+ infom ' * Adding files'
28
+ git.system!('add', '.')
29
+ end
30
+
31
+ def commit_amend
32
+ infom message('Commiting')
33
+ git.command('commit', '--amend', '--allow-empty', '--allow-empty-message')
34
+ .envvar('GIT_EDITOR', true).execute!
35
+ end
36
+
37
+ def store_commit
38
+ @commit = ::Avm::Git::Commit.new(git, git.rev_parse('HEAD'))
39
+ infov message('Commited (SHA1)'), @commit.sha1
40
+ sha1_cache.write(@commit.sha1)
41
+ files_size_cache.write(@commit.files_size)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ private
8
+
9
+ PACK_ERROR_MESSAGE = 'pack exceeds maximum allowed size'
10
+ PACK_ERROR_TRUE = 'true'
11
+ PACK_ERROR_FALSE = 'false'
12
+
13
+ def push_ok_uncached
14
+ commit
15
+ fresh_push if push_pack_error_cache.read.blank?
16
+ after_push_banner
17
+ push_pack_error_cache.read != PACK_ERROR_TRUE
18
+ end
19
+
20
+ def after_push_banner
21
+ infov message('Commit SHA1'), commit.sha1
22
+ raise 'Cache of files size not found' if files_size_cache.read.blank?
23
+
24
+ infov message('Files size'), PushLarge.bytes_size(files_size_cache.read)
25
+ end
26
+
27
+ def fresh_push
28
+ fresh_push_banner
29
+ check_push_result(
30
+ git.execute(
31
+ 'push', push_large.remote_name, '--force',
32
+ "#{commit.sha1}:#{push_reference}"
33
+ )
34
+ )
35
+ end
36
+
37
+ def fresh_push_banner
38
+ infom message('Pushing...')
39
+ fresh_push_commit_banner
40
+ fresh_push_remote_banner
41
+ end
42
+
43
+ def fresh_push_commit_banner
44
+ infov message('SHA1', 1), commit.sha1
45
+ infov message('Files size', 1), PushLarge.bytes_size(commit.files_size)
46
+ end
47
+
48
+ def fresh_push_remote_banner
49
+ infov message('Remote', 1), push_large.remote_name
50
+ infov message('Reference', 1), push_reference
51
+ end
52
+
53
+ def push_reference
54
+ "refs/heads/#{push_large.target_ref}"
55
+ end
56
+
57
+ def check_push_result(result)
58
+ if result.fetch(:exit_code).zero?
59
+ on_push_result_ok
60
+ elsif result.fetch(:stderr).include?(PACK_ERROR_MESSAGE)
61
+ on_push_result_pack_error
62
+ else
63
+ on_push_result_arbitrary_error(result)
64
+ end
65
+ end
66
+
67
+ def on_push_result_ok
68
+ push_pack_error_cache.write(PACK_ERROR_FALSE)
69
+ success(push_message('successful'))
70
+ end
71
+
72
+ def on_push_result_pack_error
73
+ push_pack_error_cache.write(PACK_ERROR_TRUE)
74
+ warn(push_message("failed with message \"#{PACK_ERROR_MESSAGE}\""))
75
+ end
76
+
77
+ def on_push_result_arbitrary_error(result)
78
+ raise result.pretty_inspect.to_s
79
+ end
80
+
81
+ def push_message(suffix)
82
+ message("Push of #{commit.sha1} (Size: #{commit.files_size}, " \
83
+ "Files: #{commit.files.count}): #{suffix}.")
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ def fs_cache_uncached
8
+ source_commit.fs_cache.sub(lfs_file_min_size.present? ? lfs_file_min_size : 'nil')
9
+ end
10
+
11
+ %w[sha1 files_size push_pack_error].each do |attr|
12
+ define_method("#{attr}_cache_uncached") { fs_cache.sub(attr) }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avmtrf1
4
+ module Git
5
+ class PushLarge
6
+ class LfsCommit
7
+ private
8
+
9
+ def message(suffix, padding = 0)
10
+ "#{(' ' * (padding + 2))}* #{suffix}"
11
+ end
12
+
13
+ def git
14
+ source_commit.git
15
+ end
16
+
17
+ def push_large
18
+ source_commit.push_large
19
+ end
20
+
21
+ def previous_revision
22
+ push_large.last_pushed_revision
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/commit'
4
+ require 'eac_ruby_utils/console/speaker'
5
+ require 'eac_ruby_utils/simple_cache'
6
+ require 'eac_ruby_utils/require_sub'
7
+
8
+ module Avmtrf1
9
+ module Git
10
+ class PushLarge
11
+ class SourceCommit < ::Avm::Git::Commit
12
+ include ::EacRubyUtils::SimpleCache
13
+ include ::EacRubyUtils::Console::Speaker
14
+
15
+ ::EacRubyUtils.require_sub(__FILE__)
16
+
17
+ attr_reader :push_large, :sha1, :no_lfs_max_size
18
+
19
+ def initialize(push_large, sha1)
20
+ super(push_large.git, sha1)
21
+ @push_large = push_large
22
+ end
23
+
24
+ def run
25
+ start_banner
26
+ if pushed_revision.read.present?
27
+ success ' * Target revision already pushed'
28
+ else
29
+ before_pushs_banner
30
+ run_pushs
31
+ after_pushs_banner
32
+ end
33
+ end
34
+
35
+ def fs_cache
36
+ @fs_cache ||= push_large.fs_cache.sub(sha1)
37
+ end
38
+
39
+ private
40
+
41
+ def start_banner
42
+ infov ' * SHA1', sha1
43
+ infov ' * Subject', subject
44
+ infov ' * Author', author_all
45
+ infov ' * Commiter', commiter_all
46
+ infov ' * Files', files.count
47
+ end
48
+
49
+ def before_pushs_banner
50
+ infov ' * Files size', PushLarge.bytes_size(files_size)
51
+ infov ' * Pushed revision (BEFORE)', pushed_revision.read
52
+ end
53
+
54
+ def after_pushs_banner
55
+ infov ' * Pushed revision (AFTER)', pushed_revision.read
56
+ raise 'Target revision is blank' if pushed_revision.read.blank?
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'filesize'
4
+
5
+ module Avmtrf1
6
+ module Git
7
+ class PushLarge
8
+ class SourceCommit
9
+ private
10
+
11
+ LFS_FILE_MIN_SIZES = [nil, 1_048_576, 524_288, 131_072].freeze
12
+
13
+ def pushed_revision_uncached
14
+ fs_cache.sub('pushed_revision')
15
+ end
16
+
17
+ def run_pushs
18
+ return if LFS_FILE_MIN_SIZES.any? do |lfs_file_min_size|
19
+ lfs_commit = ::Avmtrf1::Git::PushLarge::LfsCommit.new(self, lfs_file_min_size)
20
+ lfs_commit.start_banner
21
+ push_with_lfs(lfs_commit)
22
+ end
23
+
24
+ raise 'Push de todos os commits falharam'
25
+ end
26
+
27
+ def push_with_lfs(lfs_commit)
28
+ if lfs_commit.push_ok?
29
+ pushed_revision.write(lfs_commit.commit.sha1)
30
+ success " * Pushed: #{pushed_revision.read}"
31
+ true
32
+ else
33
+ warn ' * Push failed'
34
+ false
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_launcher/git/base'
4
+ require 'eac_ruby_utils/patch'
5
+ require 'active_support/concern'
6
+
7
+ module Avmtrf1
8
+ module Patches
9
+ module EacLauncher
10
+ module Git
11
+ module Base
12
+ extend ActiveSupport::Concern
13
+
14
+ included do
15
+ include InstanceMethods
16
+ end
17
+
18
+ module InstanceMethods
19
+ def execute(*args)
20
+ args, options = build_args(args)
21
+ ::EacRubyUtils::Envs.local.command(*args).execute(options)
22
+ end
23
+
24
+ def system(*args)
25
+ args, options = build_args(args)
26
+ ::EacRubyUtils::Envs.local.command(*args).system(options)
27
+ end
28
+
29
+ def command(*args)
30
+ args, _options = build_args(args)
31
+ ::EacRubyUtils::Envs.local.command(*args)
32
+ end
33
+
34
+ def status_files
35
+ execute!('-c', 'core.quotepath=off', 'status', '--porcelain').each_line.map do |line|
36
+ parse_status_file(line)
37
+ end
38
+ end
39
+
40
+ private
41
+
42
+ def parse_status_file(line)
43
+ m = /\A(.)(.)\s*(\S.*)\z/.match(line.strip)
44
+ return ::OpenStruct.new(stage: m[1], dirty: m[2], path: m[3]) if m
45
+
46
+ raise "\"#{line.strip}\" did not match pattern"
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ ::EacRubyUtils.patch(
56
+ ::EacLauncher::Git::Base,
57
+ ::Avmtrf1::Patches::EacLauncher::Git::Base
58
+ )
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'eac_ruby_utils/console/docopt_runner'
4
4
  require 'avmtrf1/tools/runner/git/issues_check'
5
+ require 'avmtrf1/tools/runner/git/push_large'
5
6
 
6
7
  module Avmtrf1
7
8
  module Tools
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/console/docopt_runner'
4
+ require 'avmtrf1/git/push_large'
5
+
6
+ module Avmtrf1
7
+ module Tools
8
+ class Runner < ::EacRubyUtils::Console::DocoptRunner
9
+ class Git < ::EacRubyUtils::Console::DocoptRunner
10
+ class PushLarge < ::EacRubyUtils::Console::DocoptRunner
11
+ DOC = <<~DOCOPT
12
+ Realiza push de repositórios grandes
13
+ (Que falham com "pack exceeds maximum allowed size").
14
+
15
+ Usage:
16
+ __PROGRAM__ [options] <source-ref> <target-ref>
17
+ __PROGRAM__ -h | --help
18
+
19
+ Options:
20
+ -h --help Mostra esta ajuda.
21
+ -C <git-local> Caminho do repositório local [default: .].
22
+ -r --remote <remote-name> Nome do remoto [default: origin].
23
+ DOCOPT
24
+
25
+ def run
26
+ ::Avmtrf1::Git::PushLarge.new(
27
+ ::File.expand_path(options.fetch('-C')),
28
+ options.fetch('--remote'),
29
+ options.fetch('<source-ref>'),
30
+ options.fetch('<target-ref>')
31
+ ).run
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avmtrf1
4
4
  module Tools
5
- VERSION = '0.8.1'
5
+ VERSION = '0.9.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avmtrf1-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-11 00:00:00.000000000 Z
11
+ date: 2019-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aranha
14
+ name: aranha-parsers
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.0
19
+ version: '0.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.1.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.1.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: aranha-selenium
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.1.0
20
40
  type: :runtime
21
41
  prerelease: false
22
42
  version_requirements: !ruby/object:Gem::Requirement
23
43
  requirements:
24
44
  - - "~>"
25
45
  - !ruby/object:Gem::Version
26
- version: 0.10.0
46
+ version: 0.1.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: avm-tools
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.12'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.12'
27
61
  - !ruby/object:Gem::Dependency
28
62
  name: curb
29
63
  requirement: !ruby/object:Gem::Requirement
@@ -58,20 +92,28 @@ dependencies:
58
92
  requirements:
59
93
  - - "~>"
60
94
  - !ruby/object:Gem::Version
61
- version: '0.10'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 0.10.1
95
+ version: '0.12'
65
96
  type: :runtime
66
97
  prerelease: false
67
98
  version_requirements: !ruby/object:Gem::Requirement
68
99
  requirements:
69
100
  - - "~>"
70
101
  - !ruby/object:Gem::Version
71
- version: '0.10'
102
+ version: '0.12'
103
+ - !ruby/object:Gem::Dependency
104
+ name: filesize
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
72
107
  - - ">="
73
108
  - !ruby/object:Gem::Version
74
- version: 0.10.1
109
+ version: '0'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
75
117
  - !ruby/object:Gem::Dependency
76
118
  name: inifile
77
119
  requirement: !ruby/object:Gem::Requirement
@@ -187,9 +229,23 @@ files:
187
229
  - lib/avmtrf1/esosti/session/login.rb
188
230
  - lib/avmtrf1/esosti/session/solicitacao.rb
189
231
  - lib/avmtrf1/esosti/session/solicitacao/main.rb
232
+ - lib/avmtrf1/filesystem_cache.rb
233
+ - lib/avmtrf1/fs_cache.rb
190
234
  - lib/avmtrf1/git.rb
191
235
  - lib/avmtrf1/git/cached_repository.rb
192
236
  - lib/avmtrf1/git/issue_on_repository.rb
237
+ - lib/avmtrf1/git/push_large.rb
238
+ - lib/avmtrf1/git/push_large/_utils.rb
239
+ - lib/avmtrf1/git/push_large/lfs_commit.rb
240
+ - lib/avmtrf1/git/push_large/lfs_commit/_00_checkout_previous_revision.rb
241
+ - lib/avmtrf1/git/push_large/lfs_commit/_01_cherry_pick_source_revision.rb
242
+ - lib/avmtrf1/git/push_large/lfs_commit/_02_track_large_files.rb
243
+ - lib/avmtrf1/git/push_large/lfs_commit/_03_commit_changes.rb
244
+ - lib/avmtrf1/git/push_large/lfs_commit/_04_push.rb
245
+ - lib/avmtrf1/git/push_large/lfs_commit/_cache.rb
246
+ - lib/avmtrf1/git/push_large/lfs_commit/_helpers.rb
247
+ - lib/avmtrf1/git/push_large/source_commit.rb
248
+ - lib/avmtrf1/git/push_large/source_commit/_push.rb
193
249
  - lib/avmtrf1/git/reference.rb
194
250
  - lib/avmtrf1/ini.rb
195
251
  - lib/avmtrf1/ini/profile.rb
@@ -204,6 +260,7 @@ files:
204
260
  - lib/avmtrf1/oracle/connection/base.rb
205
261
  - lib/avmtrf1/oracle/connection/string_builder.rb
206
262
  - lib/avmtrf1/patches.rb
263
+ - lib/avmtrf1/patches/eac_launcher/git/base.rb
207
264
  - lib/avmtrf1/patches/inifile.rb
208
265
  - lib/avmtrf1/red.rb
209
266
  - lib/avmtrf1/red/client.rb
@@ -228,6 +285,7 @@ files:
228
285
  - lib/avmtrf1/tools/runner/esosti.rb
229
286
  - lib/avmtrf1/tools/runner/git.rb
230
287
  - lib/avmtrf1/tools/runner/git/issues_check.rb
288
+ - lib/avmtrf1/tools/runner/git/push_large.rb
231
289
  - lib/avmtrf1/tools/runner/oracle.rb
232
290
  - lib/avmtrf1/tools/runner/oracle/source_get.rb
233
291
  - lib/avmtrf1/tools/runner/red.rb