ebm 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/commands.rb +1 -0
- data/lib/commands/format_helper.rb +106 -0
- data/lib/ebm.rb +1 -0
- data/lib/info.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e01e34fd0e0fb60f1d0aa96ded8834191e50502c
|
4
|
+
data.tar.gz: df9abd77254e4141b25a7d2b63b678cb8d9619e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0db7315f413799a57965c62508baf77ab2790ad8ab262297ef58457b84a598de56fb5a5ce2fecd2a1416a3aa29e33a6c2f66ec04d61c5a03ac9af66a031c365
|
7
|
+
data.tar.gz: e9a6ffde83a164d98530026d19c81e60d8c7a6ddac11b06f9d714875edccc59eb0e7d392ddb02b82c24834a8dc78b57c7cc5ba859b74b834e43a62bcb1c7e392
|
data/lib/commands.rb
CHANGED
@@ -0,0 +1,106 @@
|
|
1
|
+
#
|
2
|
+
# Greg Seitz
|
3
|
+
#
|
4
|
+
# Copyright 2013, eBay Inc.
|
5
|
+
# All rights reserved.
|
6
|
+
# http://www.ebay.com
|
7
|
+
#
|
8
|
+
module Commands
|
9
|
+
class FormatHelper
|
10
|
+
|
11
|
+
# holds the options that were passed
|
12
|
+
# you can set any initial defaults here
|
13
|
+
def options
|
14
|
+
@options ||= {
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
# required options
|
19
|
+
def required_options
|
20
|
+
@required_options ||= Set.new [
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
def register(opts, global_options)
|
25
|
+
opts.banner = "Usage: format_helper [options]"
|
26
|
+
opts.description = "Create checkouts and removes after format merge - only for android code reformat."
|
27
|
+
opts.on('-n', "--dry-run", "Perform a dry run.") do |v|
|
28
|
+
options[:dry_run] = true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param [Object] global_options
|
33
|
+
def run(global_options)
|
34
|
+
|
35
|
+
if ARGV.length > 0
|
36
|
+
raise "You must specify all arguments with their options."
|
37
|
+
end
|
38
|
+
dry_run = !!options[:dry_run]
|
39
|
+
|
40
|
+
# get config based on name of current dir
|
41
|
+
info = EbmSharedLib.get_config_from_top_dir
|
42
|
+
|
43
|
+
# Back up to version parent dir. This directory contains the top level repos.
|
44
|
+
top_dir = Dir.pwd
|
45
|
+
|
46
|
+
merge_failed = false
|
47
|
+
repos = info[:repos]
|
48
|
+
repos.each do |repo|
|
49
|
+
repo_name = EbmSharedLib.get_repo_name(repo[:git_path])
|
50
|
+
repo_path = "#{top_dir}/#{repo_name}"
|
51
|
+
branch = repo[:branch]
|
52
|
+
base_branch = repo[:base_branch]
|
53
|
+
|
54
|
+
puts("\n#{repo_name} format_helper:\n");
|
55
|
+
|
56
|
+
cmd = "git status --short"
|
57
|
+
result = EbmSharedLib::CL.do_cmd_output(cmd, repo_path)
|
58
|
+
if $?.exitstatus != 0
|
59
|
+
raise "Git status failed for #{repo_name}."
|
60
|
+
end
|
61
|
+
|
62
|
+
pairs = result.split
|
63
|
+
|
64
|
+
len = pairs.length
|
65
|
+
cur = 0
|
66
|
+
matches = 0
|
67
|
+
while true
|
68
|
+
if cur == len
|
69
|
+
break
|
70
|
+
end
|
71
|
+
code = pairs[cur]
|
72
|
+
cur += 1
|
73
|
+
path = pairs[cur]
|
74
|
+
cur += 1
|
75
|
+
if code == "UU"
|
76
|
+
matches +=1
|
77
|
+
#puts "#{code} - #{path}"
|
78
|
+
cmd = "git checkout --ours -- #{path}"
|
79
|
+
if dry_run
|
80
|
+
puts cmd
|
81
|
+
else
|
82
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
83
|
+
raise "Git checkout failed for #{path}."
|
84
|
+
end
|
85
|
+
cmd = "git add #{path}"
|
86
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
87
|
+
raise "Git add failed for #{path}."
|
88
|
+
end
|
89
|
+
end
|
90
|
+
elsif code == "DU"
|
91
|
+
matches += 1
|
92
|
+
cmd = "git rm #{path}"
|
93
|
+
if dry_run
|
94
|
+
puts cmd
|
95
|
+
else
|
96
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
97
|
+
raise "Git rm failed for #{path}."
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
data/lib/ebm.rb
CHANGED
@@ -50,6 +50,7 @@ class Ebm
|
|
50
50
|
sub_commands[:status] = Commands::Status.new
|
51
51
|
sub_commands[:periodic] = Commands::Periodic.new
|
52
52
|
sub_commands[:pull] = Commands::Pull.new
|
53
|
+
sub_commands[:format_helper] = Commands::FormatHelper.new
|
53
54
|
sub_commands[:prune] = Commands::Prune.new
|
54
55
|
sub_commands[:push] = Commands::Push.new
|
55
56
|
sub_commands[:commit] = Commands::Commit.new
|
data/lib/info.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Seitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: subcommand
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- lib/commands/commit.rb
|
77
77
|
- lib/commands/configs.rb
|
78
|
+
- lib/commands/format_helper.rb
|
78
79
|
- lib/commands/make_sample.rb
|
79
80
|
- lib/commands/periodic.rb
|
80
81
|
- lib/commands/prepare.rb
|