thegarage-gitx 2.5.0 → 2.5.1
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/thegarage/gitx/cli/integrate_command.rb +5 -1
- data/lib/thegarage/gitx/cli/update_command.rb +17 -3
- data/lib/thegarage/gitx/version.rb +1 -1
- data/spec/thegarage/gitx/cli/integrate_command_spec.rb +12 -1
- data/spec/thegarage/gitx/cli/update_command_spec.rb +54 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0b811de52af14874eb51c9c61fd1394fc6ce510
|
4
|
+
data.tar.gz: a497c02d33bbe70cdc915bbab537f019d20e82d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7cf35490ed34c5b821d659bf89f7e67450a1718c00f2d1fd63dc4843a837d13565bb3f36ca12e80e7e3c8eb9cdf61e4807c0ef62714bcdc067b7cc2c27e5cd2
|
7
|
+
data.tar.gz: 1d2d0f3cfd6f47ded0614469664a948a73ed5f1237bb8a4f46a97e5100e56616eb6f664673ba50127b11ac3b52e83cc32ead1d32d8234b9a5ca0ea523d9ee8d6
|
@@ -15,7 +15,11 @@ module Thegarage
|
|
15
15
|
branch = feature_branch_name
|
16
16
|
print_message(branch, integration_branch)
|
17
17
|
|
18
|
-
|
18
|
+
begin
|
19
|
+
UpdateCommand.new.update
|
20
|
+
rescue
|
21
|
+
fail MergeError, "Merge Conflict Occurred. Please Merge Conflict Occurred. Please fix merge conflict and rerun the integrate command"
|
22
|
+
end
|
19
23
|
|
20
24
|
integrate_branch(branch, integration_branch) unless options[:resume]
|
21
25
|
checkout_branch branch
|
@@ -8,15 +8,29 @@ module Thegarage
|
|
8
8
|
class UpdateCommand < BaseCommand
|
9
9
|
desc 'update', 'Update the current branch with latest changes from the remote feature branch and master'
|
10
10
|
def update
|
11
|
-
say
|
11
|
+
say "Updating "
|
12
12
|
say "#{current_branch.name} ", :green
|
13
13
|
say "with latest changes from "
|
14
14
|
say Thegarage::Gitx::BASE_BRANCH, :green
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
update_branch(current_branch.name) if remote_branch_exists?(current_branch.name)
|
17
|
+
update_branch(Thegarage::Gitx::BASE_BRANCH)
|
18
18
|
run_cmd 'git push origin HEAD'
|
19
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def update_branch(branch)
|
24
|
+
begin
|
25
|
+
run_cmd "git pull origin #{branch}"
|
26
|
+
rescue
|
27
|
+
fail MergeError, "Merge Conflict Occurred. Please fix merge conflict and rerun the update command"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def remote_branch_exists?(branch)
|
32
|
+
repo.branches.each_name(:remote).include?("origin/#{branch}")
|
33
|
+
end
|
20
34
|
end
|
21
35
|
end
|
22
36
|
end
|
@@ -91,7 +91,18 @@ describe Thegarage::Gitx::Cli::IntegrateCommand do
|
|
91
91
|
expect { cli.integrate('some-other-branch') }.to raise_error(/Invalid aggregate branch: some-other-branch must be one of supported aggregate branches/)
|
92
92
|
end
|
93
93
|
end
|
94
|
-
context 'when merge conflicts occur' do
|
94
|
+
context 'when merge conflicts occur during the updatecommand execution' do
|
95
|
+
let(:remote_branch_names) { ['origin/staging'] }
|
96
|
+
before do
|
97
|
+
expect(fake_update_command).to receive(:update).and_raise(Thegarage::Gitx::Cli::BaseCommand::MergeError)
|
98
|
+
|
99
|
+
expect { cli.integrate }.to raise_error(Thegarage::Gitx::Cli::BaseCommand::MergeError, 'Merge Conflict Occurred. Please Merge Conflict Occurred. Please fix merge conflict and rerun the integrate command')
|
100
|
+
end
|
101
|
+
it 'raises a helpful error' do
|
102
|
+
should meet_expectations
|
103
|
+
end
|
104
|
+
end
|
105
|
+
context 'when merge conflicts occur with the integrate command' do
|
95
106
|
let(:remote_branch_names) { ['origin/staging'] }
|
96
107
|
before do
|
97
108
|
expect(fake_update_command).to receive(:update)
|
@@ -11,23 +11,69 @@ describe Thegarage::Gitx::Cli::UpdateCommand do
|
|
11
11
|
end
|
12
12
|
let(:cli) { Thegarage::Gitx::Cli::UpdateCommand.new(args, options, config) }
|
13
13
|
let(:branch) { double('fake branch', name: 'feature-branch') }
|
14
|
+
let(:repo) { cli.send(:repo) }
|
15
|
+
let(:remote_branch_names) { ['origin/feature-branch'] }
|
14
16
|
|
15
17
|
before do
|
16
18
|
allow(cli).to receive(:current_branch).and_return(branch)
|
19
|
+
branches = double('fake branches')
|
20
|
+
allow(branches).to receive(:each_name).with(:remote).and_return(remote_branch_names)
|
21
|
+
allow(repo).to receive(:branches).and_return(branches)
|
17
22
|
end
|
18
23
|
|
19
24
|
describe '#update' do
|
20
|
-
|
21
|
-
|
25
|
+
context 'when no merge conflicts occur' do
|
26
|
+
before do
|
27
|
+
allow(cli).to receive(:say)
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
|
29
|
+
expect(cli).to receive(:run_cmd).with('git pull origin feature-branch').ordered
|
30
|
+
expect(cli).to receive(:run_cmd).with('git pull origin master').ordered
|
31
|
+
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
|
26
32
|
|
27
|
-
|
33
|
+
cli.update
|
34
|
+
end
|
35
|
+
it 'runs expected commands' do
|
36
|
+
should meet_expectations
|
37
|
+
end
|
28
38
|
end
|
29
|
-
|
30
|
-
|
39
|
+
context 'when merge conflicts occur when pulling remote feature-branch' do
|
40
|
+
before do
|
41
|
+
allow(cli).to receive(:say)
|
42
|
+
|
43
|
+
expect(cli).to receive(:run_cmd).with('git pull origin feature-branch').and_raise('merge error').ordered
|
44
|
+
|
45
|
+
expect { cli.update }.to raise_error(Thegarage::Gitx::Cli::BaseCommand::MergeError, 'Merge Conflict Occurred. Please fix merge conflict and rerun the update command')
|
46
|
+
end
|
47
|
+
it 'raises error' do
|
48
|
+
should meet_expectations
|
49
|
+
end
|
50
|
+
end
|
51
|
+
context 'when merge conflicts occur when pulling remote master branch' do
|
52
|
+
before do
|
53
|
+
allow(cli).to receive(:say)
|
54
|
+
|
55
|
+
expect(cli).to receive(:run_cmd).with('git pull origin feature-branch').ordered
|
56
|
+
expect(cli).to receive(:run_cmd).with('git pull origin master').and_raise('merge error occurred').ordered
|
57
|
+
|
58
|
+
expect { cli.update }.to raise_error(Thegarage::Gitx::Cli::BaseCommand::MergeError, 'Merge Conflict Occurred. Please fix merge conflict and rerun the update command')
|
59
|
+
end
|
60
|
+
it 'raises error' do
|
61
|
+
should meet_expectations
|
62
|
+
end
|
63
|
+
end
|
64
|
+
context 'when feature-branch does not exist remotely' do
|
65
|
+
let(:remote_branch_names) { [] }
|
66
|
+
before do
|
67
|
+
allow(cli).to receive(:say)
|
68
|
+
|
69
|
+
expect(cli).not_to receive(:run_cmd).with('git pull origin feature-branch')
|
70
|
+
expect(cli).to receive(:run_cmd).with('git pull origin master').ordered
|
71
|
+
|
72
|
+
cli.update
|
73
|
+
end
|
74
|
+
it 'skips pulling from feature branch' do
|
75
|
+
should meet_expectations
|
76
|
+
end
|
31
77
|
end
|
32
78
|
end
|
33
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thegarage-gitx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Sonnek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|