git-process 1.1.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +14 -1
- data/LICENSE +193 -22
- data/README.md +212 -71
- data/man/git-process.1 +371 -0
- metadata +52 -140
- data/Gemfile +0 -20
- data/Gemfile.lock +0 -53
- data/Rakefile +0 -16
- data/bin/git-new-fb +0 -58
- data/bin/git-pull-request +0 -107
- data/bin/git-sync +0 -73
- data/bin/git-to-master +0 -133
- data/git-process.gemspec +0 -25
- data/lib/git-process/abstract_error_builder.rb +0 -53
- data/lib/git-process/changed_file_helper.rb +0 -115
- data/lib/git-process/git_abstract_merge_error_builder.rb +0 -146
- data/lib/git-process/git_branch.rb +0 -105
- data/lib/git-process/git_branches.rb +0 -73
- data/lib/git-process/git_config.rb +0 -153
- data/lib/git-process/git_lib.rb +0 -512
- data/lib/git-process/git_logger.rb +0 -84
- data/lib/git-process/git_merge_error.rb +0 -28
- data/lib/git-process/git_process.rb +0 -172
- data/lib/git-process/git_process_error.rb +0 -18
- data/lib/git-process/git_process_options.rb +0 -99
- data/lib/git-process/git_rebase_error.rb +0 -30
- data/lib/git-process/git_remote.rb +0 -256
- data/lib/git-process/git_status.rb +0 -108
- data/lib/git-process/github_configuration.rb +0 -298
- data/lib/git-process/github_pull_request.rb +0 -151
- data/lib/git-process/new_fb.rb +0 -50
- data/lib/git-process/parked_changes_error.rb +0 -41
- data/lib/git-process/pull_request.rb +0 -134
- data/lib/git-process/pull_request_error.rb +0 -25
- data/lib/git-process/rebase_to_master.rb +0 -148
- data/lib/git-process/sync.rb +0 -136
- data/lib/git-process/uncommitted_changes_error.rb +0 -23
- data/lib/git-process/version.rb +0 -22
- data/spec/FileHelpers.rb +0 -19
- data/spec/GitRepoHelper.rb +0 -123
- data/spec/changed_file_helper_spec.rb +0 -127
- data/spec/git_abstract_merge_error_builder_spec.rb +0 -126
- data/spec/git_branch_spec.rb +0 -123
- data/spec/git_config_spec.rb +0 -45
- data/spec/git_lib_spec.rb +0 -176
- data/spec/git_logger_spec.rb +0 -66
- data/spec/git_process_spec.rb +0 -208
- data/spec/git_remote_spec.rb +0 -227
- data/spec/git_status_spec.rb +0 -122
- data/spec/github_configuration_spec.rb +0 -152
- data/spec/github_pull_request_spec.rb +0 -96
- data/spec/github_test_helper.rb +0 -49
- data/spec/new_fb_spec.rb +0 -130
- data/spec/pull_request_helper.rb +0 -94
- data/spec/pull_request_spec.rb +0 -128
- data/spec/rebase_to_master_spec.rb +0 -429
- data/spec/spec_helper.rb +0 -21
- data/spec/sync_spec.rb +0 -304
data/spec/git_branch_spec.rb
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
require 'git-process/git_lib'
|
2
|
-
require 'GitRepoHelper'
|
3
|
-
|
4
|
-
describe GitProc::GitBranch do
|
5
|
-
include GitRepoHelper
|
6
|
-
|
7
|
-
|
8
|
-
def log_level
|
9
|
-
Logger::ERROR
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
before(:each) do
|
14
|
-
create_files(%w(.gitignore))
|
15
|
-
gitlib.commit('initial')
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
after(:each) do
|
20
|
-
rm_rf(gitlib.workdir)
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
describe 'contains_all_of' do
|
25
|
-
|
26
|
-
it 'should handle the trivial case' do
|
27
|
-
current = gitlib.branches.current
|
28
|
-
current.contains_all_of(current.name).should == true
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
it 'should handle new branch containing base branch that did not change' do
|
33
|
-
base_branch = gitlib.branches.current
|
34
|
-
|
35
|
-
gitlib.checkout('fb', :new_branch => base_branch.name)
|
36
|
-
current = gitlib.branches.current
|
37
|
-
|
38
|
-
change_file_and_commit('a', 'hello')
|
39
|
-
|
40
|
-
current.contains_all_of(base_branch.name).should == true
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
it "should handle new branch containing base branch that did change" do
|
45
|
-
base_branch = gitlib.branches.current
|
46
|
-
|
47
|
-
gitlib.checkout('fb', :new_branch => base_branch.name)
|
48
|
-
current = gitlib.branches.current
|
49
|
-
|
50
|
-
gitlib.checkout(base_branch.name)
|
51
|
-
change_file_and_commit('a', 'goodbye')
|
52
|
-
|
53
|
-
current.contains_all_of(base_branch.name).should == false
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
it 'should handle containing in both branches' do
|
58
|
-
base_branch = gitlib.branches.current
|
59
|
-
|
60
|
-
gitlib.checkout('fb', :new_branch => base_branch.name)
|
61
|
-
current = gitlib.branches.current
|
62
|
-
|
63
|
-
change_file_and_commit('a', 'hello')
|
64
|
-
|
65
|
-
gitlib.checkout(base_branch.name)
|
66
|
-
change_file_and_commit('a', 'goodbye')
|
67
|
-
|
68
|
-
current.contains_all_of(base_branch.name).should == false
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
describe "is_ahead_of" do
|
75
|
-
|
76
|
-
it "should handle the trivial case" do
|
77
|
-
current = gitlib.branches.current
|
78
|
-
current.is_ahead_of(current.name).should == false # same is not "ahead of"
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
it "should handle new branch containing base branch that did not change" do
|
83
|
-
base_branch = gitlib.branches.current
|
84
|
-
|
85
|
-
gitlib.checkout('fb', :new_branch => base_branch.name)
|
86
|
-
current = gitlib.branches.current
|
87
|
-
|
88
|
-
change_file_and_commit('a', 'hello')
|
89
|
-
|
90
|
-
current.is_ahead_of(base_branch.name).should == true
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
it "should handle new branch containing base branch that did change" do
|
95
|
-
base_branch = gitlib.branches.current
|
96
|
-
|
97
|
-
gitlib.checkout('fb', :new_branch => base_branch.name)
|
98
|
-
current = gitlib.branches.current
|
99
|
-
|
100
|
-
gitlib.checkout(base_branch.name)
|
101
|
-
change_file_and_commit('a', 'goodbye')
|
102
|
-
|
103
|
-
current.is_ahead_of(base_branch.name).should == false
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
|
-
it "should handle containing in both branches" do
|
108
|
-
base_branch = gitlib.branches.current
|
109
|
-
|
110
|
-
gitlib.checkout('fb', :new_branch => base_branch.name)
|
111
|
-
current = gitlib.branches.current
|
112
|
-
|
113
|
-
change_file_and_commit('a', 'hello')
|
114
|
-
|
115
|
-
gitlib.checkout(base_branch.name)
|
116
|
-
change_file_and_commit('a', 'goodbye')
|
117
|
-
|
118
|
-
current.is_ahead_of(base_branch.name).should == false
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
data/spec/git_config_spec.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
-
# you may not use this file except in compliance with the License.
|
3
|
-
# You may obtain a copy of the License at
|
4
|
-
#
|
5
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
-
#
|
7
|
-
# Unless required by applicable law or agreed to in writing, software
|
8
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
-
# See the License for the specific language governing permissions and
|
11
|
-
# limitations under the License.
|
12
|
-
|
13
|
-
require 'FileHelpers'
|
14
|
-
require 'git-process/git_lib'
|
15
|
-
require 'git-process/git_config'
|
16
|
-
include GitProc
|
17
|
-
|
18
|
-
describe GitConfig do
|
19
|
-
|
20
|
-
def tmpdir
|
21
|
-
@tmpdir ||= Dir.mktmpdir
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
after(:each) do
|
26
|
-
rm_rf(tmpdir)
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
it 'should retrieve values by []' do
|
31
|
-
lib = GitLib.new(tmpdir, :log_level => Logger::ERROR)
|
32
|
-
lib.command(:config, %w(somevalue.subvalue here))
|
33
|
-
config = GitConfig.new(lib)
|
34
|
-
config['somevalue.subvalue'].should == 'here'
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
it "should set values by []" do
|
39
|
-
lib = GitLib.new(tmpdir, :log_level => Logger::ERROR)
|
40
|
-
config = GitConfig.new(lib)
|
41
|
-
config['somevalue.subvalue'] = 'there'
|
42
|
-
lib.command(:config, %w(--get somevalue.subvalue)).should == 'there'
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/spec/git_lib_spec.rb
DELETED
@@ -1,176 +0,0 @@
|
|
1
|
-
require 'git-process/git_lib'
|
2
|
-
require 'GitRepoHelper'
|
3
|
-
include GitProc
|
4
|
-
|
5
|
-
|
6
|
-
describe GitLib, :git_repo_helper do
|
7
|
-
|
8
|
-
|
9
|
-
def log_level
|
10
|
-
Logger::ERROR
|
11
|
-
end
|
12
|
-
|
13
|
-
|
14
|
-
describe 'workdir' do
|
15
|
-
|
16
|
-
it 'should use the passed in directory when the top level is a git workdir' do
|
17
|
-
dir = Dir.mktmpdir
|
18
|
-
mkdir_p "#{dir}/.git"
|
19
|
-
gitlib = GitLib.new(dir, :log_level => Logger::ERROR)
|
20
|
-
gitlib.workdir.should == dir
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
it "should find the parent git workdir" do
|
25
|
-
topdir = Dir.mktmpdir
|
26
|
-
mkdir_p "#{topdir}/.git"
|
27
|
-
dir = "#{topdir}/a/b/c/d/e/f/g"
|
28
|
-
mkdir_p dir
|
29
|
-
gitlib = GitLib.new(dir, :log_level => Logger::ERROR)
|
30
|
-
gitlib.workdir.should == topdir
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
describe 'branches' do
|
37
|
-
|
38
|
-
it 'list all the branches' do
|
39
|
-
gitlib.branch('ba', :base_branch => 'master')
|
40
|
-
gitlib.branch('bb', :base_branch => 'master')
|
41
|
-
gitlib.branch('origin/master', :base_branch => 'master')
|
42
|
-
|
43
|
-
gitlib.branches.names.should == %w(ba bb master origin/master)
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
describe 'fetch' do
|
50
|
-
|
51
|
-
it 'parse the list of changes' do
|
52
|
-
output = '''
|
53
|
-
remote: Counting objects: 1028, done.
|
54
|
-
remote: Compressing objects: 100% (301/301), done.
|
55
|
-
remote: Total 699 (delta 306), reused 654 (delta 273)
|
56
|
-
Receiving objects: 100% (699/699), 600.68 KiB | 686 KiB/s, done.
|
57
|
-
Resolving deltas: 100% (306/306), completed with 84 local objects.
|
58
|
-
From remote.system.com:tuser/test-proj
|
59
|
-
8e667e0..19ecc91 SITE_TOUR_MODAL -> origin/SITE_TOUR_MODAL
|
60
|
-
+ cea75d7...d656188 WEBCMS-2014 -> origin/WEBCMS-2014 (forced update)
|
61
|
-
* [new branch] WEBCMS-2047 -> origin/WEBCMS-2047
|
62
|
-
ca9e80e..d383005 WEBCMS-2157 -> origin/WEBCMS-2157
|
63
|
-
77b5d5c..f485c7f WEBCMS-2159 -> origin/WEBCMS-2159
|
64
|
-
* [new branch] WEBCMS-2166 -> origin/WEBCMS-2166
|
65
|
-
c648f2a..86ee15e WEBCMS-2167 -> origin/WEBCMS-2167
|
66
|
-
* [new tag] RELEASE_1.0.1.53 -> RELEASE_1.0.1.53
|
67
|
-
* [new tag] RELEASE_1.0.1.54 -> RELEASE_1.0.1.54
|
68
|
-
x [deleted] (none) -> origin/WEBCMS-4650-resi-breadcrumbs
|
69
|
-
* [new branch] WEBCMS-2169 -> origin/WEBCMS-2169
|
70
|
-
* [new branch] base-carousel -> origin/base-carousel
|
71
|
-
1de9c437..7546667 develop -> origin/develop
|
72
|
-
90e8d75..23ae7d1 new-ui-smoketest -> origin/new-ui-smoketest
|
73
|
-
* [new branch] webcms-2023 -> origin/webcms-2023
|
74
|
-
b9797f8..dd24a9f webcms-2135 -> origin/webcms-2135
|
75
|
-
* [new branch] webcms-831-faq-web-service -> origin/webcms-831-faq-web-service
|
76
|
-
x [deleted] (none) -> origin/webcms-1315-masthead
|
77
|
-
'''
|
78
|
-
changes = gitlib.fetch_changes(output)
|
79
|
-
|
80
|
-
changes[:new_branch].size().should == 6
|
81
|
-
changes[:new_tag].size().should == 2
|
82
|
-
changes[:deleted].size().should == 2
|
83
|
-
changes[:force_updated].size().should == 1
|
84
|
-
changes[:updated].size().should == 7
|
85
|
-
|
86
|
-
empty_changes = gitlib.fetch_changes('')
|
87
|
-
|
88
|
-
empty_changes[:new_branch].size().should == 0
|
89
|
-
empty_changes[:new_tag].size().should == 0
|
90
|
-
empty_changes[:deleted].size().should == 0
|
91
|
-
empty_changes[:force_updated].size().should == 0
|
92
|
-
empty_changes[:updated].size().should == 0
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
describe "branch" do
|
99
|
-
|
100
|
-
it "should create a branch with default base" do
|
101
|
-
gitlib.stub(:command).with(:branch, %w(test_branch master))
|
102
|
-
gitlib.branch('test_branch')
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
it "should create a branch with explicit base" do
|
107
|
-
gitlib.should_receive(:command).with(:branch, %w(test_branch other_branch))
|
108
|
-
gitlib.branch('test_branch', :base_branch => 'other_branch')
|
109
|
-
end
|
110
|
-
|
111
|
-
|
112
|
-
it 'should delete a branch without force' do
|
113
|
-
gitlib.should_receive(:command).with(:branch, %w(-d test_branch))
|
114
|
-
gitlib.branch('test_branch', :delete => true)
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
it 'should delete a branch with force' do
|
119
|
-
gitlib.should_receive(:command).with(:branch, %w(-D test_branch))
|
120
|
-
gitlib.branch('test_branch', :delete => true, :force => true)
|
121
|
-
end
|
122
|
-
|
123
|
-
|
124
|
-
it "should rename a branch" do
|
125
|
-
gitlib.should_receive(:command).with(:branch, %w(-m test_branch new_branch))
|
126
|
-
gitlib.branch('test_branch', :rename => 'new_branch')
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
|
132
|
-
describe "push" do
|
133
|
-
|
134
|
-
it "should push local branch to remote" do
|
135
|
-
gitlib.should_receive(:command).with(:push, %w(remote local_branch:test_branch))
|
136
|
-
|
137
|
-
gitlib.push('remote', 'local_branch', 'test_branch')
|
138
|
-
end
|
139
|
-
|
140
|
-
|
141
|
-
it "should push current branch to remote" do
|
142
|
-
gitlib.stub(:command).with(:branch, %w(-a --no-color)).and_return("* my_branch\n")
|
143
|
-
gitlib.should_receive(:command).with(:push, %w(remote my_branch:my_branch))
|
144
|
-
|
145
|
-
gitlib.push('remote', 'my_branch', nil)
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
it "should remove named branch on remote" do
|
150
|
-
gitlib.remote.stub(:name).and_return('remote_server')
|
151
|
-
gitlib.config.stub(:master_branch).and_return('master')
|
152
|
-
gitlib.should_receive(:command).with(:push, %w(remote_server --delete my_branch))
|
153
|
-
|
154
|
-
gitlib.push('remote_server', 'my_branch', nil, :delete => true)
|
155
|
-
end
|
156
|
-
|
157
|
-
|
158
|
-
it "should remove current branch on remote" do
|
159
|
-
gitlib.remote.stub(:name).and_return('remote_server')
|
160
|
-
gitlib.config.stub(:master_branch).and_return('master')
|
161
|
-
gitlib.should_receive(:command).with(:push, %w(remote_server --delete my_branch))
|
162
|
-
|
163
|
-
gitlib.push('remote_server', nil, nil, :delete => 'my_branch')
|
164
|
-
end
|
165
|
-
|
166
|
-
|
167
|
-
it "should not remove integration branch on remote" do
|
168
|
-
gitlib.remote.stub(:name).and_return('remote_server')
|
169
|
-
gitlib.config.stub(:master_branch).and_return('master')
|
170
|
-
|
171
|
-
expect { gitlib.push('remote_server', nil, nil, :delete => 'master') }.to raise_error GitProcessError
|
172
|
-
end
|
173
|
-
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
data/spec/git_logger_spec.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
2
|
-
# you may not use this file except in compliance with the License.
|
3
|
-
# You may obtain a copy of the License at
|
4
|
-
#
|
5
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
-
#
|
7
|
-
# Unless required by applicable law or agreed to in writing, software
|
8
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
-
# See the License for the specific language governing permissions and
|
11
|
-
# limitations under the License.
|
12
|
-
|
13
|
-
require 'git-process/git_logger'
|
14
|
-
include GitProc
|
15
|
-
|
16
|
-
describe GitLogger do
|
17
|
-
|
18
|
-
it 'should log info blocks' do
|
19
|
-
val = false
|
20
|
-
GitLogger.new(GitLogger::INFO, nil).info { val = true }
|
21
|
-
val.should == true
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
it 'should not log info blocks by default' do
|
26
|
-
val = false
|
27
|
-
GitLogger.new(nil, nil).info { val = true }
|
28
|
-
val.should == false
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
it 'should log warn blocks' do
|
33
|
-
val = false
|
34
|
-
GitLogger.new(GitLogger::WARN, nil).warn { val = true }
|
35
|
-
val.should == true
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
it "should log warn blocks by default" do
|
40
|
-
val = false
|
41
|
-
GitLogger.new(nil, nil).warn { val = true }
|
42
|
-
val.should == true
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
it "should log error blocks" do
|
47
|
-
val = false
|
48
|
-
GitLogger.new(GitLogger::ERROR, nil).error { val = true }
|
49
|
-
val.should == true
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
it "should log error blocks by default" do
|
54
|
-
val = false
|
55
|
-
GitLogger.new.error { val = true }
|
56
|
-
val.should == true
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
it 'should log debug blocks' do
|
61
|
-
val = false
|
62
|
-
GitLogger.new(GitLogger::DEBUG, nil).debug { val = true }
|
63
|
-
val.should == true
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
data/spec/git_process_spec.rb
DELETED
@@ -1,208 +0,0 @@
|
|
1
|
-
require 'git-process/git_process'
|
2
|
-
require 'GitRepoHelper'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
describe GitProc::Process do
|
6
|
-
include GitRepoHelper
|
7
|
-
|
8
|
-
|
9
|
-
def log_level
|
10
|
-
Logger::ERROR
|
11
|
-
end
|
12
|
-
|
13
|
-
|
14
|
-
before(:each) do
|
15
|
-
create_files(%w(.gitignore))
|
16
|
-
gitlib.commit('initial')
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
after(:each) do
|
21
|
-
rm_rf(gitlib.workdir)
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
describe 'run lifecycle' do
|
26
|
-
|
27
|
-
it 'should call the standard hooks' do
|
28
|
-
proc = GitProc::Process.new(gitlib)
|
29
|
-
proc.should_receive(:verify_preconditions)
|
30
|
-
proc.should_receive(:runner)
|
31
|
-
proc.should_receive(:cleanup)
|
32
|
-
proc.should_not_receive(:exit)
|
33
|
-
|
34
|
-
proc.run
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
it "should call 'cleanup' even if there's an error" do
|
39
|
-
proc = GitProc::Process.new(gitlib)
|
40
|
-
proc.should_receive(:verify_preconditions)
|
41
|
-
proc.should_receive(:runner).and_raise(GitProc::GitProcessError.new("Error!"))
|
42
|
-
proc.should_receive(:cleanup)
|
43
|
-
proc.should_receive(:exit)
|
44
|
-
proc.should_receive(:puts).with("Error!")
|
45
|
-
|
46
|
-
proc.run
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
describe "validate local integration branch" do
|
53
|
-
|
54
|
-
it "should use remove the int-branch if not on it and not blocked" do
|
55
|
-
clone_repo('master') do |gl|
|
56
|
-
gl.checkout('fb', :new_branch => 'master')
|
57
|
-
|
58
|
-
gp = GitProc::Process.new(gl)
|
59
|
-
gp.stub(:ask_about_removing_master).and_return(true)
|
60
|
-
|
61
|
-
gp.verify_preconditions
|
62
|
-
|
63
|
-
gl.branches.include?('master').should be_false
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
it "should ask use remove the int-branch if not on it and not blocked" do
|
69
|
-
clone_repo('master') do |gl|
|
70
|
-
gl.checkout('fb', :new_branch => 'master')
|
71
|
-
|
72
|
-
gp = GitProc::Process.new(gl)
|
73
|
-
gp.should_receive(:ask_about_removing_master).and_return(true)
|
74
|
-
|
75
|
-
gp.verify_preconditions
|
76
|
-
|
77
|
-
gl.branches.include?('master').should be_false
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
it "should ask use remove the int-branch if not on it and not blocked and not remove if answered no" do
|
83
|
-
clone_repo('master') do |gl|
|
84
|
-
gl.checkout('fb', :new_branch => 'master')
|
85
|
-
|
86
|
-
gp = GitProc::Process.new(gl)
|
87
|
-
gp.should_receive(:ask_about_removing_master).and_return(false)
|
88
|
-
|
89
|
-
gp.verify_preconditions
|
90
|
-
|
91
|
-
gl.branches.include?('master').should be_true
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
it "should not remove the int-branch if on it" do
|
97
|
-
clone_repo('master') do |gl|
|
98
|
-
gp = GitProc::Process.new(gl)
|
99
|
-
gp.verify_preconditions
|
100
|
-
|
101
|
-
gl.branches.include?('master').should be_true
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
it "should not remove the int-branch if blocked" do
|
107
|
-
clone_repo('master') do |gl|
|
108
|
-
gl.config['gitProcess.keepLocalIntegrationBranch'] = 'true'
|
109
|
-
gl.checkout('fb', :new_branch => 'master')
|
110
|
-
|
111
|
-
gp = GitProc::Process.new(gl)
|
112
|
-
gp.verify_preconditions
|
113
|
-
|
114
|
-
gl.branches.include?('master').should be_true
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
|
119
|
-
describe "local vs remote branch status" do
|
120
|
-
|
121
|
-
before(:each) do
|
122
|
-
change_file_and_commit('a.txt', 'a content', gitlib)
|
123
|
-
change_file_and_commit('b.txt', 'b content', gitlib)
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
|
-
it "should not remove if both have changes" do
|
128
|
-
clone_repo('master') do |gl|
|
129
|
-
change_file_and_commit('c.txt', 'c on origin/master', gitlib)
|
130
|
-
change_file_and_commit('d.txt', 'd on master', gl)
|
131
|
-
|
132
|
-
gl.checkout('fb', :new_branch => 'master')
|
133
|
-
|
134
|
-
gl.fetch
|
135
|
-
|
136
|
-
gp = GitProc::Process.new(gl)
|
137
|
-
gp.verify_preconditions
|
138
|
-
|
139
|
-
gl.branches.include?('master').should be_true
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
|
144
|
-
it "should remove if server changed but not local" do
|
145
|
-
clone_repo('master') do |gl|
|
146
|
-
gp = GitProc::Process.new(gl)
|
147
|
-
gp.stub(:ask_about_removing_master).and_return(true)
|
148
|
-
|
149
|
-
change_file_and_commit('c.txt', 'c on origin/master', gitlib)
|
150
|
-
|
151
|
-
gl.checkout('fb', :new_branch => 'master')
|
152
|
-
|
153
|
-
gl.fetch
|
154
|
-
|
155
|
-
gp.verify_preconditions
|
156
|
-
|
157
|
-
gl.branches.include?('master').should be_false
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
|
162
|
-
it "should not remove if server did not change but local did" do
|
163
|
-
clone_repo('master') do |gl|
|
164
|
-
change_file_and_commit('c.txt', 'c on master', gl)
|
165
|
-
|
166
|
-
gl.checkout('fb', :new_branch => 'master')
|
167
|
-
|
168
|
-
gl.fetch
|
169
|
-
|
170
|
-
gp = GitProc::Process.new(gl)
|
171
|
-
gp.verify_preconditions
|
172
|
-
|
173
|
-
gl.branches.include?('master').should be_true
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
|
178
|
-
it "should remove if server and local are the same" do
|
179
|
-
change_file_and_commit('c.txt', 'c on origin/master', gitlib)
|
180
|
-
|
181
|
-
clone_repo('master') do |gl|
|
182
|
-
gl.checkout('fb', :new_branch => 'master')
|
183
|
-
gp = GitProc::Process.new(gl)
|
184
|
-
gp.stub(:ask_about_removing_master).and_return(true)
|
185
|
-
|
186
|
-
gl.fetch
|
187
|
-
gp.verify_preconditions
|
188
|
-
|
189
|
-
gl.branches.include?('master').should be_false
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
end
|
194
|
-
|
195
|
-
|
196
|
-
it "should not remove the int-branch if not a clone" do
|
197
|
-
gitlib.config['gitProcess.keepLocalIntegrationBranch'] = 'false'
|
198
|
-
gitlib.checkout('fb', :new_branch => 'master')
|
199
|
-
|
200
|
-
gitprocess = GitProc::Process.new(gitlib)
|
201
|
-
gitprocess.verify_preconditions
|
202
|
-
|
203
|
-
gitlib.branches.include?('master').should be_true
|
204
|
-
end
|
205
|
-
|
206
|
-
end
|
207
|
-
|
208
|
-
end
|