esr-rim 1.2.2 → 1.3.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 +7 -0
- data/CHANGELOG +4 -0
- data/lib/rim/command/info.rb +28 -0
- data/lib/rim/command/sync.rb +10 -2
- data/lib/rim/command_helper.rb +14 -5
- data/lib/rim/info_helper.rb +45 -0
- data/lib/rim/info_module_helper.rb +35 -0
- data/lib/rim/module_helper.rb +4 -1
- data/lib/rim/module_info.rb +9 -1
- data/lib/rim/rim.rb +1 -0
- data/lib/rim/rim_info.rb +10 -7
- data/lib/rim/sync_module_helper.rb +8 -1
- data/lib/rim/upload_module_helper.rb +11 -1
- data/lib/rim/version.rb +1 -1
- data/test/rim_info_test.rb +26 -1
- data/test/sync_helper_test.rb +61 -0
- data/test/upload_helper_test.rb +65 -0
- metadata +12 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b33d85be666d5c844f3cea2badd20b014e513ba4
|
4
|
+
data.tar.gz: 5f33ff002ac05cf4c3d387bda151e0e8f21658fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 74d2e60c72834483f12dbc892ab25e87997d75913ad88caa979af85467bb89c42b98c06b7900ff88520da55082b563eeb721f6ea98bdbe0bb7f747ca3bb36478
|
7
|
+
data.tar.gz: a941d0d2b90bd32a6d5ea5221dacd399769bb6de2e9e81d81ff796faf9d92e143754ed1f312c70ab72a437132ebbdaca1ba7dfce8ac1a97c370fb87c271ea38e
|
data/CHANGELOG
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rim/command/command'
|
2
|
+
require 'rim/info_helper'
|
3
|
+
|
4
|
+
module RIM
|
5
|
+
module Command
|
6
|
+
|
7
|
+
class Info < Command
|
8
|
+
|
9
|
+
def initialize(opts)
|
10
|
+
opts.banner = "Usage: rim info [<options>] [<local_module_path>]"
|
11
|
+
opts.description = "Prints information about RIM modules in <local_module_path> or all modules if omitted"
|
12
|
+
opts.separator ""
|
13
|
+
opts.on("-d", "--detailed", "print detailed information") do
|
14
|
+
@detailed = true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def invoke
|
19
|
+
helper = InfoHelper.new(project_git_dir, @logger)
|
20
|
+
helper.modules_from_paths(helper.module_paths(ARGV))
|
21
|
+
helper.upstream_info
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
data/lib/rim/command/sync.rb
CHANGED
@@ -44,6 +44,9 @@ class Sync < Command
|
|
44
44
|
opts.on("-m", "--message MESSAGE", String, "Message header to provide to each commit.") do |message|
|
45
45
|
@message = message
|
46
46
|
end
|
47
|
+
opts.on("-d", "--subdir SUBDIR", String, "Sync just a subdir from the remote module.") do |subdir|
|
48
|
+
@module_options[:subdir] = subdir
|
49
|
+
end
|
47
50
|
opts.on("-s", "--split", "Create a separate commit for each module.") do
|
48
51
|
@split = true
|
49
52
|
end
|
@@ -63,8 +66,13 @@ class Sync < Command
|
|
63
66
|
elsif !@module_options[:remote_url] || !@module_options[:target_revision]
|
64
67
|
raise RimException.new("Please specify remote URL and target revision for the new module.")
|
65
68
|
else
|
66
|
-
helper.add_module_info(helper.create_module_info(
|
67
|
-
@module_options[:
|
69
|
+
helper.add_module_info(helper.create_module_info(
|
70
|
+
@module_options[:remote_url],
|
71
|
+
local_path,
|
72
|
+
@module_options[:target_revision],
|
73
|
+
@module_options[:ignores],
|
74
|
+
@module_options[:subdir],
|
75
|
+
))
|
68
76
|
end
|
69
77
|
else
|
70
78
|
helper.modules_from_paths(@all ? helper.module_paths(ARGV, @excludedirs) : ARGV, @module_options)
|
data/lib/rim/command_helper.rb
CHANGED
@@ -32,8 +32,14 @@ class CommandHelper < Processor
|
|
32
32
|
raise RimException.new("Unexpected command line arguments.") if !ARGV.empty?
|
33
33
|
end
|
34
34
|
|
35
|
-
def create_module_info(remote_url, local_path, target_revision, ignores)
|
36
|
-
ModuleInfo.new(
|
35
|
+
def create_module_info(remote_url, local_path, target_revision, ignores, subdir)
|
36
|
+
ModuleInfo.new(
|
37
|
+
remote_url,
|
38
|
+
get_relative_path(local_path),
|
39
|
+
target_revision,
|
40
|
+
ignores,
|
41
|
+
remote_url ? get_remote_branch_format(remote_url) : nil,
|
42
|
+
subdir)
|
37
43
|
end
|
38
44
|
|
39
45
|
def modules_from_manifest(path)
|
@@ -60,9 +66,12 @@ class CommandHelper < Processor
|
|
60
66
|
module_path = find_file_dir_in_workspace(path || ".", RimInfo::InfoFileName)
|
61
67
|
if module_path
|
62
68
|
rim_info = RimInfo.from_dir(module_path)
|
63
|
-
module_info = create_module_info(
|
64
|
-
|
65
|
-
|
69
|
+
module_info = create_module_info(
|
70
|
+
opts.has_key?(:remote_url) ? opts[:remote_url] : rim_info.remote_url,
|
71
|
+
module_path,
|
72
|
+
opts.has_key?(:target_revision) ? opts[:target_revision] : rim_info.target_revision,
|
73
|
+
opts.has_key?(:ignores) ? opts[:ignores] : rim_info.ignores,
|
74
|
+
opts.has_key?(:subdir) ? opts[:subdir] : rim_info.subdir)
|
66
75
|
if module_info.valid?
|
67
76
|
add_unique_module_info(module_info)
|
68
77
|
module_path
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rim/command_helper'
|
2
|
+
require 'rim/info_module_helper'
|
3
|
+
|
4
|
+
module RIM
|
5
|
+
|
6
|
+
class InfoHelper < CommandHelper
|
7
|
+
|
8
|
+
def initialize(workspace_root, logger)
|
9
|
+
@module_helpers = []
|
10
|
+
super(workspace_root, logger)
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_module_info(module_info)
|
14
|
+
@module_helpers.push(InfoModuleHelper.new(@ws_root, module_info, @logger))
|
15
|
+
end
|
16
|
+
|
17
|
+
def upstream_info
|
18
|
+
each_module_parallel("gather info", @module_helpers) do |m|
|
19
|
+
print "."
|
20
|
+
m.gather_info
|
21
|
+
end
|
22
|
+
puts
|
23
|
+
@module_helpers.each do |h|
|
24
|
+
path = h.module_info.local_path.split(/[\\\/]/).last.ljust(40)
|
25
|
+
info = "#{path}: ->#{h.target_rev.ljust(10)} @#{h.current_sha1[0..6]}"
|
26
|
+
if h.upstream_revs
|
27
|
+
if h.upstream_revs.size > 0
|
28
|
+
info += " [#{h.upstream_revs.size} commits behind]"
|
29
|
+
else
|
30
|
+
info += " [UP TO DATE]"
|
31
|
+
end
|
32
|
+
@logger.info(info)
|
33
|
+
h.upstream_revs.each do |r|
|
34
|
+
@logger.info(" #{r.strip}")
|
35
|
+
end
|
36
|
+
else
|
37
|
+
@logger.info(info)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rim/module_helper'
|
2
|
+
|
3
|
+
module RIM
|
4
|
+
|
5
|
+
class InfoModuleHelper < ModuleHelper
|
6
|
+
|
7
|
+
attr_accessor :target_rev
|
8
|
+
attr_accessor :current_sha1
|
9
|
+
attr_accessor :upstream_revs
|
10
|
+
attr_accessor :upstream_non_fast_forward
|
11
|
+
|
12
|
+
def initialize(workspace_root, module_info, logger)
|
13
|
+
super(workspace_root, module_info, logger)
|
14
|
+
end
|
15
|
+
|
16
|
+
def gather_info
|
17
|
+
fetch_module
|
18
|
+
rim_info = RimInfo.from_dir(File.join(@ws_root, @module_info.local_path))
|
19
|
+
@target_rev = rim_info.target_revision
|
20
|
+
@current_sha1 = rim_info.revision_sha1
|
21
|
+
RIM::git_session(git_path) do |s|
|
22
|
+
if s.has_remote_branch?(target_rev)
|
23
|
+
# repository is mirrored so branches are "local"
|
24
|
+
if s.is_ancestor?(current_sha1, target_rev)
|
25
|
+
@upstream_revs = s.execute("git rev-list --oneline #{target_rev} \"^#{current_sha1}\"").split("\n")
|
26
|
+
else
|
27
|
+
@upstream_non_fast_forward = true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/lib/rim/module_helper.rb
CHANGED
@@ -23,7 +23,6 @@ protected
|
|
23
23
|
# fetch module +mod+ into the .rim folder
|
24
24
|
# works both for initial fetch and updates
|
25
25
|
def fetch_module
|
26
|
-
git_path = module_git_path(@remote_path)
|
27
26
|
FileUtils.mkdir_p git_path
|
28
27
|
RIM::git_session(git_path) do |s|
|
29
28
|
if !File.exist?(git_path + "/config")
|
@@ -49,6 +48,10 @@ protected
|
|
49
48
|
FileUtils.mkdir_p(local_path)
|
50
49
|
end
|
51
50
|
|
51
|
+
def git_path
|
52
|
+
module_git_path(@remote_path)
|
53
|
+
end
|
54
|
+
|
52
55
|
end
|
53
56
|
|
54
57
|
end
|
data/lib/rim/module_info.rb
CHANGED
@@ -11,12 +11,20 @@ class ModuleInfo
|
|
11
11
|
attr_reader :target_revision
|
12
12
|
# ignores
|
13
13
|
attr_reader :ignores
|
14
|
+
|
15
|
+
attr_reader :subdir
|
14
16
|
|
15
|
-
def initialize(remote_url,
|
17
|
+
def initialize(remote_url,
|
18
|
+
local_path,
|
19
|
+
target_revision,
|
20
|
+
ignores = nil,
|
21
|
+
remote_branch_format = nil,
|
22
|
+
subdir = nil)
|
16
23
|
@remote_url = remote_url
|
17
24
|
@remote_branch_format = remote_branch_format
|
18
25
|
@local_path = local_path
|
19
26
|
@target_revision = target_revision
|
27
|
+
@subdir = subdir
|
20
28
|
if ignores.is_a?(String)
|
21
29
|
@ignores = ignores.split(",").each do |s|
|
22
30
|
s.strip!
|
data/lib/rim/rim.rb
CHANGED
data/lib/rim/rim_info.rb
CHANGED
@@ -9,12 +9,11 @@ module RIM
|
|
9
9
|
# Example:
|
10
10
|
#
|
11
11
|
# 4759302048574720930432049375757593827561
|
12
|
-
# remote_url:
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# checksum: 9584872389474857324485873627894494726222
|
12
|
+
# remote_url: ssh://some/url/to/git/repo
|
13
|
+
# revision_sha1: 8347982374198379842984562095637243593092
|
14
|
+
# target_revision: trunk
|
15
|
+
# ignores: CMakeLists.txt,*.arxml
|
16
|
+
# checksum: 9584872389474857324485873627894494726222
|
18
17
|
#
|
19
18
|
# rev_name is a symbolic name for revision
|
20
19
|
#
|
@@ -29,7 +28,8 @@ class RimInfo
|
|
29
28
|
:revision_sha1,
|
30
29
|
:target_revision,
|
31
30
|
:ignores,
|
32
|
-
:checksum
|
31
|
+
:checksum,
|
32
|
+
:subdir
|
33
33
|
]
|
34
34
|
|
35
35
|
AttrsDef.each do |d|
|
@@ -74,6 +74,9 @@ class RimInfo
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
77
|
+
if attrs[:subdir] == ""
|
78
|
+
attrs[:subdir] = nil
|
79
|
+
end
|
77
80
|
end
|
78
81
|
AttrsDef.each do |a|
|
79
82
|
send("#{a}=".to_sym, attrs[a])
|
@@ -3,6 +3,7 @@ require 'rim/rim_info'
|
|
3
3
|
require 'rim/file_helper'
|
4
4
|
require 'rim/dirty_check'
|
5
5
|
require 'tempfile'
|
6
|
+
require 'pathname'
|
6
7
|
|
7
8
|
module RIM
|
8
9
|
class SyncModuleHelper < ModuleHelper
|
@@ -33,13 +34,19 @@ module RIM
|
|
33
34
|
local_path = File.join(@dest_root, @module_info.local_path)
|
34
35
|
prepare_empty_folder(local_path, @module_info.ignores)
|
35
36
|
temp_commit(d, "clear directory") if d.uncommited_changes?
|
36
|
-
|
37
|
+
strip = ""
|
38
|
+
if @module_info.subdir
|
39
|
+
depth = Pathname(@module_info.subdir).each_filename.count()
|
40
|
+
strip = "--strip-components=#{depth}"
|
41
|
+
end
|
42
|
+
s.execute("git archive --format tar #{@module_info.target_revision} #{@module_info.subdir} | tar #{strip} -x -C #{local_path}")
|
37
43
|
sha1 = s.execute("git rev-parse #{@module_info.target_revision}").strip
|
38
44
|
@rim_info = RimInfo.new
|
39
45
|
@rim_info.remote_url = @module_info.remote_url
|
40
46
|
@rim_info.target_revision = @module_info.target_revision
|
41
47
|
@rim_info.revision_sha1 = sha1
|
42
48
|
@rim_info.ignores = @module_info.ignores.join(",")
|
49
|
+
@rim_info.subdir = @module_info.subdir
|
43
50
|
@rim_info.to_dir(local_path)
|
44
51
|
DirtyCheck.mark_clean(local_path)
|
45
52
|
end
|
@@ -30,6 +30,11 @@ private
|
|
30
30
|
local_branch = nil
|
31
31
|
remote_branch = nil
|
32
32
|
infos = nil
|
33
|
+
if @module_info.subdir
|
34
|
+
dest_path = File.join([tmp_git_path] + @module_info.subdir.split("/"))
|
35
|
+
else
|
36
|
+
dest_path = tmp_git_path
|
37
|
+
end
|
33
38
|
RIM::git_session(@ws_root) do |src|
|
34
39
|
infos = get_branches_and_revision_infos(src, dest, parent_sha1, sha1s)
|
35
40
|
if infos.branches.size == 1
|
@@ -37,7 +42,12 @@ private
|
|
37
42
|
if dest.has_remote_branch?(remote_branch)
|
38
43
|
infos.rev_infos.each do |rev_info|
|
39
44
|
local_branch = create_update_branch(dest, infos.parent_sha1, rev_info.src_sha1) if !local_branch
|
40
|
-
copy_revision_files(
|
45
|
+
copy_revision_files(
|
46
|
+
src,
|
47
|
+
rev_info.src_sha1,
|
48
|
+
dest_path,
|
49
|
+
rev_info.rim_info.ignores
|
50
|
+
)
|
41
51
|
commit_changes(dest, local_branch, rev_info.src_sha1, rev_info.message)
|
42
52
|
end
|
43
53
|
else
|
data/lib/rim/version.rb
CHANGED
data/test/rim_info_test.rb
CHANGED
@@ -75,7 +75,8 @@ def test_attributes
|
|
75
75
|
:remote_url => "ssh://somehost/dir1/dir2",
|
76
76
|
:revision_sha1 => "8347982374198379842984562095637243593092",
|
77
77
|
:target_revision => "trunk",
|
78
|
-
:ignores => "CMakeLists.txt,*.arxml"
|
78
|
+
:ignores => "CMakeLists.txt,*.arxml",
|
79
|
+
:subdir => "foo/bar"
|
79
80
|
}
|
80
81
|
d = empty_test_dir("rim_info")
|
81
82
|
create_rim_info(d, attrs)
|
@@ -86,6 +87,30 @@ def test_attributes
|
|
86
87
|
end
|
87
88
|
end
|
88
89
|
|
90
|
+
def test_subdir_default
|
91
|
+
attrs_write = {
|
92
|
+
:remote_url => "ssh://somehost/dir1/dir2",
|
93
|
+
:revision_sha1 => "8347982374198379842984562095637243593092",
|
94
|
+
:target_revision => "trunk",
|
95
|
+
:ignores => "CMakeLists.txt,*.arxml",
|
96
|
+
}
|
97
|
+
attrs_expected = {
|
98
|
+
:remote_url => "ssh://somehost/dir1/dir2",
|
99
|
+
:revision_sha1 => "8347982374198379842984562095637243593092",
|
100
|
+
:target_revision => "trunk",
|
101
|
+
:ignores => "CMakeLists.txt,*.arxml",
|
102
|
+
:subdir => nil
|
103
|
+
}
|
104
|
+
d = empty_test_dir("rim_info")
|
105
|
+
create_rim_info(d, attrs_write)
|
106
|
+
ri = RIM::RimInfo.from_dir(d)
|
107
|
+
#puts File.read(d+"/.riminfo")
|
108
|
+
attrs_expected.each_pair do |k,v|
|
109
|
+
assert_equal v, ri.send(k)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
|
89
114
|
def teardown
|
90
115
|
# clean up test dirs created during last test
|
91
116
|
remove_test_dirs
|
data/test/sync_helper_test.rb
CHANGED
@@ -44,9 +44,48 @@ class SyncHelperTest < Minitest::Test
|
|
44
44
|
assert log[1].include?("mod2")
|
45
45
|
assert File.exist?(File.join(@ws_dir, "mod1"))
|
46
46
|
assert File.exist?(File.join(@ws_dir, "mod2"))
|
47
|
+
assert File.exist?(File.join(@ws_dir, "mod1", "readme.txt"))
|
48
|
+
assert File.exist?(File.join(@ws_dir, "mod2", "readme.txt"))
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
def test_files_are_synchronized_subtree
|
53
|
+
mod_git_dir = create_all_module_git("mod_all")
|
54
|
+
mod_a_info = RIM::ModuleInfo.new("file://" + mod_git_dir, "modules/a", "master", nil, nil, "mod_a")
|
55
|
+
create_ws_git("testbr")
|
56
|
+
cut = RIM::SyncHelper.new(@ws_dir, @logger, [mod_a_info])
|
57
|
+
cut.sync
|
58
|
+
RIM::git_session(@ws_dir) do |s|
|
59
|
+
assert !File.exist?(File.join(@ws_dir, "modules", "a"))
|
60
|
+
s.execute("git checkout rim/testbr")
|
61
|
+
check_not_dirty(s)
|
62
|
+
log = s.execute("git log | grep \" module \"").split("\n").sort
|
63
|
+
assert log.size == 1
|
64
|
+
assert log[0].include?("modules/a")
|
65
|
+
assert !File.exist?(File.join(@ws_dir, "modules", "b"))
|
66
|
+
assert File.exist?(File.join(@ws_dir, "modules", "a"))
|
67
|
+
assert File.exist?(File.join(@ws_dir, "modules", "a", "file_a.c"))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_files_are_synchronized_subtree_deep
|
72
|
+
mod_git_dir = create_all_module_git("mod_all")
|
73
|
+
mod_a_info = RIM::ModuleInfo.new("file://" + mod_git_dir, "modules/b_src", "master", nil, nil, "mod_b/src")
|
74
|
+
create_ws_git("testbr")
|
75
|
+
cut = RIM::SyncHelper.new(@ws_dir, @logger, [mod_a_info])
|
76
|
+
cut.sync
|
77
|
+
RIM::git_session(@ws_dir) do |s|
|
78
|
+
assert !File.exist?(File.join(@ws_dir, "modules", "b_src"))
|
79
|
+
s.execute("git checkout rim/testbr")
|
80
|
+
check_not_dirty(s)
|
81
|
+
log = s.execute("git log | grep \" module \"").split("\n").sort
|
82
|
+
assert log.size == 1
|
83
|
+
assert log[0].include?("modules/b_src")
|
84
|
+
assert File.exist?(File.join(@ws_dir, "modules", "b_src", "file_b.c"))
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
|
50
89
|
def test_files_are_synchronized_on_existing_branch
|
51
90
|
mod1_info = create_module_git("mod1")
|
52
91
|
mod2_info = create_module_git("mod2")
|
@@ -217,6 +256,28 @@ private
|
|
217
256
|
return RIM::ModuleInfo.new("file://" + git_dir, name, branch)
|
218
257
|
end
|
219
258
|
|
259
|
+
def create_all_module_git(name, branch = "master")
|
260
|
+
git_dir = File.join(@remote_git_dir, name)
|
261
|
+
FileUtils.mkdir_p(File.join(git_dir,"mod_a"))
|
262
|
+
FileUtils.mkdir_p(File.join(git_dir,"mod_b","src"))
|
263
|
+
RIM::git_session(git_dir) do |s|
|
264
|
+
s.execute("git init")
|
265
|
+
s.execute("git checkout -B #{branch}")
|
266
|
+
File.open(File.join(git_dir, "readme.txt"), "w") do |f|
|
267
|
+
f.write("Content.")
|
268
|
+
end
|
269
|
+
File.open(File.join(git_dir, "mod_a", "file_a.c"), "w") do |f|
|
270
|
+
f.write("Content.")
|
271
|
+
end
|
272
|
+
File.open(File.join(git_dir, "mod_b", "src", "file_b.c"), "w") do |f|
|
273
|
+
f.write("Content.")
|
274
|
+
end
|
275
|
+
s.execute("git add .")
|
276
|
+
s.execute("git commit -m \"Initial commit\"")
|
277
|
+
end
|
278
|
+
return git_dir
|
279
|
+
end
|
280
|
+
|
220
281
|
def path_from_module_info(module_info)
|
221
282
|
module_info.remote_url.gsub(/^file:\/\//, "")
|
222
283
|
end
|
data/test/upload_helper_test.rb
CHANGED
@@ -79,6 +79,47 @@ class UploadHelperTest < Minitest::Test
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
def test_files_of_new_commits_are_uploaded_subdir
|
83
|
+
mod_git_dir = create_all_module_git("mod_all")
|
84
|
+
mod_a_info = RIM::ModuleInfo.new("file://" + mod_git_dir, "modules/a", "master", nil, nil, "mod_a")
|
85
|
+
create_ws_git("testbr")
|
86
|
+
sync_helper = RIM::SyncHelper.new(@ws_dir, @logger, [mod_a_info])
|
87
|
+
sync_helper.sync
|
88
|
+
RIM::git_session(@ws_dir) do |s|
|
89
|
+
s.execute("git rebase rim/testbr")
|
90
|
+
end
|
91
|
+
shas = []
|
92
|
+
# make two changes to module
|
93
|
+
RIM::git_session(@ws_dir) do |s|
|
94
|
+
`echo ' appended' >> #{File.join(@ws_dir, "modules/a/file_a.c")}`
|
95
|
+
s.execute("git commit . -m \"First change\"")
|
96
|
+
shas.push(s.rev_sha1("HEAD"))
|
97
|
+
`echo 'Test' > #{File.join(@ws_dir, "modules/a/new_file.txt")}`
|
98
|
+
s.execute("git add .")
|
99
|
+
s.execute("git commit . -m \"Second change\"")
|
100
|
+
shas.push(s.rev_sha1("HEAD"))
|
101
|
+
end
|
102
|
+
cut = RIM::UploadHelper.new(@ws_dir, true, @logger, [mod_a_info])
|
103
|
+
|
104
|
+
module_session(mod_a_info) do |s|
|
105
|
+
s.execute("git checkout --detach master")
|
106
|
+
assert File.exist?(File.join(mod_git_dir, "mod_a", "file_a.c"))
|
107
|
+
assert !File.exist?(File.join(mod_git_dir, "mod_a", "new_file.txt"))
|
108
|
+
assert File.exist?(File.join(mod_git_dir, "mod_b", "src", "file_b.c"))
|
109
|
+
end
|
110
|
+
|
111
|
+
cut.upload
|
112
|
+
|
113
|
+
module_session(mod_a_info) do |s|
|
114
|
+
s.execute("git checkout --detach master")
|
115
|
+
assert File.exist?(File.join(mod_git_dir, "mod_a", "file_a.c"))
|
116
|
+
assert File.exist?(File.join(mod_git_dir, "mod_a", "new_file.txt"))
|
117
|
+
assert File.exist?(File.join(mod_git_dir, "mod_b", "src", "file_b.c"))
|
118
|
+
assert s.execute("git show -s --format=%B HEAD").start_with?("Second change")
|
119
|
+
assert s.execute("git show -s --format=%B HEAD~1").start_with?("First change")
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
82
123
|
def test_files_of_new_commits_are_uploaded_to_push_branch
|
83
124
|
mod1_info = create_module_git("mod1", "master", "for/%s")
|
84
125
|
create_ws_git("testbr")
|
@@ -318,6 +359,30 @@ private
|
|
318
359
|
return RIM::ModuleInfo.new("file://" + git_dir, name, branch, nil, remote_branch_format)
|
319
360
|
end
|
320
361
|
|
362
|
+
def create_all_module_git(name, branch = "master")
|
363
|
+
git_dir = File.join(@remote_git_dir, name)
|
364
|
+
FileUtils.mkdir_p(File.join(git_dir,"mod_a"))
|
365
|
+
FileUtils.mkdir_p(File.join(git_dir,"mod_b","src"))
|
366
|
+
RIM::git_session(git_dir) do |s|
|
367
|
+
s.execute("git init")
|
368
|
+
s.execute("git checkout -B #{branch}")
|
369
|
+
File.open(File.join(git_dir, "readme.txt"), "w") do |f|
|
370
|
+
f.write("Content.")
|
371
|
+
end
|
372
|
+
File.open(File.join(git_dir, "mod_a", "file_a.c"), "w") do |f|
|
373
|
+
f.write("Content.")
|
374
|
+
end
|
375
|
+
File.open(File.join(git_dir, "mod_b", "src", "file_b.c"), "w") do |f|
|
376
|
+
f.write("Content.")
|
377
|
+
end
|
378
|
+
s.execute("git add .")
|
379
|
+
s.execute("git commit -m \"Initial commit\"")
|
380
|
+
s.execute("git checkout --detach #{branch}")
|
381
|
+
end
|
382
|
+
return git_dir
|
383
|
+
end
|
384
|
+
|
385
|
+
|
321
386
|
def module_session(module_info)
|
322
387
|
RIM::git_session(module_info.remote_url.gsub(/^file:\/\//, "")) do |s|
|
323
388
|
yield s
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esr-rim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- ESR Labs AG
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: subcommand
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.0.6
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.0.6
|
30
27
|
description: RIM lets you work with multiple git repositories from within one single
|
@@ -38,6 +35,7 @@ extra_rdoc_files:
|
|
38
35
|
- CHANGELOG
|
39
36
|
files:
|
40
37
|
- lib/rim/command/command.rb
|
38
|
+
- lib/rim/command/info.rb
|
41
39
|
- lib/rim/command/status.rb
|
42
40
|
- lib/rim/command/sync.rb
|
43
41
|
- lib/rim/command/upload.rb
|
@@ -46,6 +44,8 @@ files:
|
|
46
44
|
- lib/rim/file_helper.rb
|
47
45
|
- lib/rim/file_logger.rb
|
48
46
|
- lib/rim/git.rb
|
47
|
+
- lib/rim/info_helper.rb
|
48
|
+
- lib/rim/info_module_helper.rb
|
49
49
|
- lib/rim/manifest/helper.rb
|
50
50
|
- lib/rim/manifest/json_reader.rb
|
51
51
|
- lib/rim/manifest/manifest.json
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- bin/rim
|
86
86
|
homepage: http://esrlabs.com
|
87
87
|
licenses: []
|
88
|
+
metadata: {}
|
88
89
|
post_install_message:
|
89
90
|
rdoc_options:
|
90
91
|
- --main
|
@@ -94,21 +95,19 @@ rdoc_options:
|
|
94
95
|
require_paths:
|
95
96
|
- lib
|
96
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - '>='
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
103
|
requirements:
|
105
|
-
- -
|
104
|
+
- - '>='
|
106
105
|
- !ruby/object:Gem::Version
|
107
106
|
version: '0'
|
108
107
|
requirements: []
|
109
108
|
rubyforge_project:
|
110
|
-
rubygems_version:
|
109
|
+
rubygems_version: 2.0.3
|
111
110
|
signing_key:
|
112
|
-
specification_version:
|
111
|
+
specification_version: 4
|
113
112
|
summary: RIM - multi git tool
|
114
113
|
test_files: []
|