esr-rim 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -71,3 +71,8 @@
71
71
  # 1.2.1
72
72
 
73
73
  * fixed -i option not working as expected in rim sync [#6]
74
+
75
+ # 1.2.2
76
+
77
+ * fixed Issue #11: rim/xxx branch is not forwarded when remote head is past xxx branch.
78
+
@@ -41,14 +41,9 @@ class SyncHelper < CommandHelper
41
41
  remote_url = "file://" + @ws_root
42
42
  tmpdir = clone_or_fetch_repository(remote_url, module_tmp_git_path(".ws"), "Cloning workspace git...")
43
43
  RIM::git_session(tmpdir) do |tmp_session|
44
- if tmp_session.current_branch() == rim_branch
45
- tmp_session.execute("git reset --hard remotes/origin/#{rim_branch}")
46
- tmp_session.execute("git clean -xdf")
47
- else
48
- tmp_session.execute("git reset --hard")
49
- tmp_session.execute("git clean -xdf")
50
- tmp_session.execute("git checkout #{rim_branch}")
51
- end
44
+ tmp_session.execute("git reset --hard")
45
+ tmp_session.execute("git clean -xdf")
46
+ tmp_session.execute("git checkout -B #{rim_branch} remotes/origin/#{rim_branch}")
52
47
  changed_modules = sync_modules(tmp_session, message)
53
48
  if !split
54
49
  tmp_session.execute("git reset --soft #{branch_sha1}")
@@ -2,7 +2,7 @@ module RIM
2
2
 
3
3
  module Version
4
4
 
5
- Version = "1.2.1"
5
+ Version = "1.2.2"
6
6
 
7
7
  end
8
8
 
@@ -138,6 +138,48 @@ class SyncHelperTest < Minitest::Test
138
138
  end
139
139
  end
140
140
 
141
+ def test_sync_on_different_branches
142
+ mod1_info = create_module_git("mod1")
143
+ create_ws_git("testbr")
144
+ cut = RIM::SyncHelper.new(@ws_dir, @logger, [mod1_info])
145
+ cut.sync
146
+ remote_path = path_from_module_info(mod1_info)
147
+ RIM::git_session(remote_path) do |s|
148
+ FileUtils.mv(File.join(remote_path, "readme.txt"), File.join(remote_path, "readme.tx_"))
149
+ s.execute("git add --all .")
150
+ s.execute("git commit -m \"Temporary change of filename within mod1\"")
151
+ FileUtils.mv(File.join(remote_path, "readme.tx_"), File.join(remote_path, "Readme.txt"))
152
+ s.execute("git add --all .")
153
+ s.execute("git commit -m \"Changed case in filename within mod1\"")
154
+ end
155
+ RIM::git_session(@ws_dir) do |s|
156
+ s.execute("git checkout -b branch2")
157
+ end
158
+ cut.sync
159
+ RIM::git_session(@ws_dir) do |s|
160
+ s.execute("git rebase rim/branch2")
161
+ out = s.execute("git show --name-only")
162
+ assert out.include?("Readme.txt")
163
+ end
164
+ RIM::git_session(remote_path) do |s|
165
+ `echo ' changed' >> #{File.join(remote_path, "Readme.txt")}`
166
+ s.execute("git commit . -m \"Changed module file\"")
167
+ end
168
+ cut.sync
169
+ RIM::git_session(@ws_dir) do |s|
170
+ s.execute("git rebase rim/branch2")
171
+ s.execute("git checkout testbr")
172
+ s.execute("git reset --hard branch2~1")
173
+ s.execute("git push origin branch2:branch2")
174
+ end
175
+ cut.sync
176
+ RIM::git_session(@ws_dir) do |s|
177
+ s.execute("git reset --hard rim/testbr")
178
+ out = s.execute("git show --name-only")
179
+ assert out.include?("Readme.txt")
180
+ end
181
+ end
182
+
141
183
  private
142
184
  def create_ws_git(branch = "master")
143
185
  FileUtils.mkdir_p(@ws_remote_dir)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esr-rim
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-23 00:00:00.000000000 Z
12
+ date: 2015-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: subcommand