git-process 0.9.1.pre3 → 0.9.2

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.
Files changed (57) hide show
  1. data/CHANGELOG.md +0 -0
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +2 -0
  4. data/README.md +27 -9
  5. data/bin/git-new-fb +42 -13
  6. data/bin/git-pull-request +79 -13
  7. data/bin/git-sync +47 -13
  8. data/bin/git-to-master +56 -13
  9. data/git-process.gemspec +1 -1
  10. data/lib/git-process/{abstract-error-builder.rb → abstract_error_builder.rb} +13 -3
  11. data/lib/git-process/{git-abstract-merge-error-builder.rb → git_abstract_merge_error_builder.rb} +15 -5
  12. data/lib/git-process/{git-branch.rb → git_branch.rb} +13 -1
  13. data/lib/git-process/git_branches.rb +72 -0
  14. data/lib/git-process/{git-lib.rb → git_lib.rb} +82 -70
  15. data/lib/git-process/git_merge_error.rb +38 -0
  16. data/lib/git-process/git_process.rb +124 -0
  17. data/lib/git-process/git_process_error.rb +18 -0
  18. data/lib/git-process/git_process_options.rb +101 -0
  19. data/lib/git-process/git_rebase_error.rb +38 -0
  20. data/lib/git-process/{git-status.rb → git_status.rb} +13 -1
  21. data/lib/git-process/{github-client.rb → github_client.rb} +13 -1
  22. data/lib/git-process/github_pull_request.rb +107 -0
  23. data/lib/git-process/{github-service.rb → github_service.rb} +39 -21
  24. data/lib/git-process/new_fb.rb +40 -0
  25. data/lib/git-process/parked_changes_error.rb +40 -0
  26. data/lib/git-process/pull_request.rb +61 -0
  27. data/lib/git-process/rebase_to_master.rb +110 -0
  28. data/lib/git-process/sync.rb +63 -0
  29. data/lib/git-process/uncommitted_changes_error.rb +23 -0
  30. data/lib/git-process/version.rb +19 -9
  31. data/spec/GitRepoHelper.rb +35 -21
  32. data/spec/{git-abstract-merge-error-builder_spec.rb → git_abstract_merge_error_builder_spec.rb} +3 -3
  33. data/spec/{git-lib_spec.rb → git_lib_spec.rb} +79 -16
  34. data/spec/git_process_spec.rb +36 -0
  35. data/spec/{git-status_spec.rb → git_status_spec.rb} +28 -29
  36. data/spec/github_pull_request_spec.rb +91 -0
  37. data/spec/{github-service_spec.rb → github_service_spec.rb} +1 -1
  38. data/spec/new_fb_spec.rb +80 -0
  39. data/spec/rebase_to_master_spec.rb +314 -0
  40. data/spec/spec_helper.rb +1 -1
  41. data/spec/sync_spec.rb +149 -0
  42. metadata +46 -43
  43. data/lib/git-process/git-branches.rb +0 -53
  44. data/lib/git-process/git-merge-error.rb +0 -31
  45. data/lib/git-process/git-new-fb-options.rb +0 -34
  46. data/lib/git-process/git-process-error.rb +0 -10
  47. data/lib/git-process/git-process-options.rb +0 -82
  48. data/lib/git-process/git-process.rb +0 -194
  49. data/lib/git-process/git-pull-request-options.rb +0 -42
  50. data/lib/git-process/git-rebase-error.rb +0 -31
  51. data/lib/git-process/git-sync-options.rb +0 -34
  52. data/lib/git-process/git-to-master-options.rb +0 -18
  53. data/lib/git-process/parked-changes-error.rb +0 -32
  54. data/lib/git-process/pull-request.rb +0 -38
  55. data/lib/git-process/uncommitted-changes-error.rb +0 -15
  56. data/spec/git-process_spec.rb +0 -328
  57. data/spec/pull-request_spec.rb +0 -57
@@ -1,16 +1,13 @@
1
1
  require 'FileHelpers'
2
- require 'git-lib'
2
+ require 'git-process/git_process'
3
3
 
4
4
  module GitRepoHelper
5
5
 
6
-
7
- def gitlib
8
- @gitlib ||= Git::GitLib.new(tmpdir, :log_level => log_level)
9
- end
10
-
11
-
12
6
  def gitprocess
13
- @gitprocess ||= Git::Process.new(nil, gitlib)
7
+ opts = {}
8
+ opts[:quiet] = true if log_level == Logger::ERROR
9
+ opts[:verbose] = true if log_level == Logger::DEBUG
10
+ @gitprocess ||= create_process(tmpdir, opts)
14
11
  end
15
12
 
16
13
 
@@ -20,7 +17,7 @@ module GitRepoHelper
20
17
 
21
18
 
22
19
  def commit_count
23
- gitlib.log_count
20
+ gitprocess.log_count
24
21
  end
25
22
 
26
23
 
@@ -30,46 +27,63 @@ module GitRepoHelper
30
27
 
31
28
 
32
29
  def logger
33
- gitlib.logger
30
+ gitprocess.logger
34
31
  end
35
32
 
36
33
 
37
34
  def create_files(file_names)
38
- Dir.chdir(gitlib.workdir) do |dir|
35
+ Dir.chdir(gitprocess.workdir) do |dir|
39
36
  file_names.each do |fn|
40
- gitlib.logger.debug {"Creating #{dir}/#{fn}"}
37
+ gitprocess.logger.debug {"Creating #{dir}/#{fn}"}
41
38
  FileUtils.touch fn
42
39
  end
43
40
  end
44
- gitlib.add(file_names)
41
+ gitprocess.add(file_names)
45
42
  end
46
43
 
47
44
 
48
- def change_file(filename, contents, lib = gitlib)
45
+ def change_file(filename, contents, lib = gitprocess)
49
46
  Dir.chdir(lib.workdir) do
50
47
  File.open(filename, 'w') {|f| f.puts contents}
51
48
  end
52
49
  end
53
50
 
54
51
 
55
- def change_file_and_add(filename, contents, lib = gitlib)
52
+ def change_file_and_add(filename, contents, lib = gitprocess)
56
53
  change_file(filename, contents, lib)
57
54
  lib.add(filename)
58
55
  end
59
56
 
60
57
 
61
- def change_file_and_commit(filename, contents, lib = gitlib)
58
+ def change_file_and_commit(filename, contents, lib = gitprocess)
62
59
  change_file_and_add(filename, contents, lib)
63
60
  lib.commit("#{filename} - #{contents}")
64
61
  end
65
62
 
66
63
 
67
- def clone(branch='master', &block)
64
+ def create_process(dir, opts)
65
+ GitProc::Process.new(dir, opts)
66
+ end
67
+
68
+
69
+ def clone(branch='master', remote_name = 'origin', &block)
68
70
  td = Dir.mktmpdir
69
- gl = Git::GitLib.new(td, :log_level => log_level)
70
- gl.add_remote('origin', "file://#{tmpdir}")
71
- gl.fetch
72
- gl.checkout(branch, :new_branch => "origin/#{branch}")
71
+
72
+ logger.debug {"Cloning '#{tmpdir}' to '#{td}'"}
73
+
74
+ opts = {}
75
+ opts[:quiet] = true if log_level == Logger::ERROR
76
+ opts[:verbose] = true if log_level == Logger::DEBUG
77
+ gl = create_process(td, opts)
78
+ gl.add_remote(remote_name, "file://#{tmpdir}")
79
+ gl.fetch(remote_name)
80
+
81
+ if branch == 'master'
82
+ gl.reset("#{remote_name}/#{branch}", :hard => true)
83
+ else
84
+ gl.checkout(branch, :new_branch => "#{remote_name}/#{branch}")
85
+ end
86
+
73
87
  if block_given?
74
88
  begin
75
89
  block.arity < 1 ? gl.instance_eval(&block) : block.call(gl)
@@ -1,11 +1,11 @@
1
- require 'git-abstract-merge-error-builder'
1
+ require 'git-process/git_abstract_merge_error_builder'
2
2
 
3
- describe Git::AbstractMergeErrorBuilder do
3
+ describe GitProc::AbstractMergeErrorBuilder do
4
4
 
5
5
  def builder
6
6
  unless @builder
7
7
  @builder = Object.new
8
- @builder.extend(Git::AbstractMergeErrorBuilder)
8
+ @builder.extend(GitProc::AbstractMergeErrorBuilder)
9
9
  @builder.stub(:lib).and_return(lib)
10
10
  @builder.stub(:continue_command).and_return(nil)
11
11
  @builder.stub(:error_message).and_return('')
@@ -1,7 +1,46 @@
1
- require 'git-lib'
1
+ require 'git-process/git_lib'
2
2
  require 'GitRepoHelper'
3
3
 
4
- describe Git::GitLib do
4
+ describe GitProc::GitLib do
5
+
6
+ class GLStub
7
+ include GitProc::GitLib
8
+
9
+ def initialize(workdir, log_level)
10
+ @logger = Logger.new(STDOUT)
11
+ @logger.level = log_level || Logger::WARN
12
+ @logger.datetime_format = "%Y-%m-%d %H:%M:%S"
13
+ f = Logger::Formatter.new
14
+ @logger.formatter = proc do |severity, datetime, progname, msg|
15
+ "#{msg}\n"
16
+ end
17
+
18
+ @workdir = workdir
19
+ if workdir
20
+ unless File.directory?(File.join(workdir, '.git'))
21
+ logger.info { "Initializing new repository at #{workdir}" }
22
+ command(:init)
23
+ else
24
+ logger.debug { "Opening existing repository at #{workdir}" }
25
+ end
26
+ end
27
+ end
28
+
29
+
30
+ def workdir
31
+ @workdir
32
+ end
33
+
34
+ def logger
35
+ @logger
36
+ end
37
+ end
38
+
39
+
40
+ def gitlib
41
+ gitprocess
42
+ end
43
+
5
44
 
6
45
  describe "branches" do
7
46
  include GitRepoHelper
@@ -24,7 +63,7 @@ describe Git::GitLib do
24
63
  attr_reader :lib
25
64
 
26
65
  before(:each) do
27
- @lib = Git::GitLib.new(nil)
66
+ @lib = GLStub.new(nil, nil)
28
67
  end
29
68
 
30
69
 
@@ -58,7 +97,7 @@ describe Git::GitLib do
58
97
  attr_reader :lib
59
98
 
60
99
  before(:each) do
61
- @lib = Git::GitLib.new(nil, :git => double('git'))
100
+ @lib = GLStub.new(nil, nil)
62
101
  end
63
102
 
64
103
 
@@ -83,6 +122,8 @@ describe Git::GitLib do
83
122
 
84
123
 
85
124
  it "should remove named branch on remote" do
125
+ lib.stub(:remote_name).and_return('remote')
126
+ lib.stub(:config).and_return('master')
86
127
  lib.should_receive(:command).with(:push, ['remote', '--delete', 'my_branch'])
87
128
 
88
129
  lib.push('remote', 'my_branch', nil, :delete => true)
@@ -90,28 +131,50 @@ describe Git::GitLib do
90
131
 
91
132
 
92
133
  it "should remove current branch on remote" do
134
+ lib.stub(:remote_name).and_return('remote')
135
+ lib.stub(:config).and_return('master')
93
136
  lib.should_receive(:command).with(:push, ['remote', '--delete', 'my_branch'])
94
137
 
95
138
  lib.push('remote', nil, nil, :delete => 'my_branch')
96
139
  end
97
140
 
98
141
 
99
- # it "should create a branch with explicit base" do
100
- # lib.stub(:command).with(:branch, ['test_branch', 'other_branch'])
101
- # lib.branch('test_branch', :base_branch => 'other_branch')
102
- # end
142
+ it "should not remove integration branch on remote" do
143
+ lib.stub(:remote_name).and_return('remote')
144
+ lib.stub(:config).and_return('master')
145
+
146
+ expect {lib.push('remote', nil, nil, :delete => 'master')}.should raise_error GitProc::GitProcessError
147
+ end
148
+
149
+ end
150
+
103
151
 
152
+ describe "#remote_name" do
153
+ include GitRepoHelper
104
154
 
105
- # it "should delete a branch without force" do
106
- # lib.stub(:command).with(:branch, ['-d', 'test_branch'])
107
- # lib.branch('test_branch', :delete => true)
108
- # end
155
+ def log_level
156
+ Logger::ERROR
157
+ end
109
158
 
110
159
 
111
- # it "should delete a branch with force" do
112
- # lib.stub(:command).with(:branch, ['-D', 'test_branch'])
113
- # lib.branch('test_branch', :delete => true, :force => true)
114
- # end
160
+ it "should work with origin" do
161
+ change_file_and_commit('a', '')
162
+
163
+ clone('master', 'origin') do |gl|
164
+ gl.remote_name.should == 'origin'
165
+ gl.branches.include?('origin/master').should be_true
166
+ end
167
+ end
168
+
169
+
170
+ it "should work with a different remote name" do
171
+ change_file_and_commit('a', '')
172
+
173
+ clone('master', 'a_remote') do |gl|
174
+ gl.remote_name.should == 'a_remote'
175
+ gl.branches.include?('a_remote/master').should be_true
176
+ end
177
+ end
115
178
 
116
179
  end
117
180
 
@@ -0,0 +1,36 @@
1
+ require 'git-process/git_process'
2
+ require 'GitRepoHelper'
3
+ require 'fileutils'
4
+
5
+ describe GitProc::Process do
6
+ include GitRepoHelper
7
+
8
+ before(:each) do
9
+ create_files(['.gitignore'])
10
+ gitprocess.commit('initial')
11
+ end
12
+
13
+
14
+ after(:each) do
15
+ rm_rf(tmpdir)
16
+ end
17
+
18
+
19
+ describe "workdir" do
20
+
21
+ it "should use the passed in directory when the top level is a git workdir" do
22
+ proc = GitProc::Process.new(tmpdir)
23
+ proc.workdir.should == tmpdir
24
+ end
25
+
26
+
27
+ it "should find the parent git workdir" do
28
+ dir = "#{tmpdir}/a/b/c/d/e/f/g"
29
+ mkdir_p dir
30
+ proc = GitProc::Process.new(dir)
31
+ proc.workdir.should == tmpdir
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -1,13 +1,12 @@
1
- require 'git-status'
1
+ require 'git-process/git_status'
2
2
  require 'GitRepoHelper'
3
3
 
4
- describe Git::GitStatus do
5
-
4
+ describe GitProc::GitStatus do
6
5
  include GitRepoHelper
7
6
 
8
7
  before(:each) do
9
8
  create_files(['.gitignore'])
10
- gitlib.commit('initial')
9
+ gitprocess.commit('initial')
11
10
  end
12
11
 
13
12
 
@@ -19,37 +18,37 @@ describe Git::GitStatus do
19
18
  it "should handle added files" do
20
19
  create_files(['a', 'b', 'c'])
21
20
 
22
- gitlib.status.added.should == ['a', 'b', 'c']
21
+ gitprocess.status.added.should == ['a', 'b', 'c']
23
22
  end
24
23
 
25
24
 
26
25
  it "should handle a modification on both sides" do
27
26
  change_file_and_commit('a', '')
28
27
 
29
- gitlib.checkout('fb', :new_branch => 'master')
28
+ gitprocess.checkout('fb', :new_branch => 'master')
30
29
  change_file_and_commit('a', 'hello')
31
30
 
32
- gitlib.checkout('master')
31
+ gitprocess.checkout('master')
33
32
  change_file_and_commit('a', 'goodbye')
34
33
 
35
- gitlib.merge('fb') rescue
34
+ gitprocess.merge('fb') rescue
36
35
 
37
- status = gitlib.status
36
+ status = gitprocess.status
38
37
  status.unmerged.should == ['a']
39
38
  status.modified.should == ['a']
40
39
  end
41
40
 
42
41
 
43
42
  it "should handle an addition on both sides" do
44
- gitlib.checkout('fb', :new_branch => 'master')
43
+ gitprocess.checkout('fb', :new_branch => 'master')
45
44
  change_file_and_commit('a', 'hello')
46
45
 
47
- gitlib.checkout('master')
46
+ gitprocess.checkout('master')
48
47
  change_file_and_commit('a', 'goodbye')
49
48
 
50
- gitlib.merge('fb') rescue
49
+ gitprocess.merge('fb') rescue
51
50
 
52
- status = gitlib.status
51
+ status = gitprocess.status
53
52
  status.unmerged.should == ['a']
54
53
  status.added.should == ['a']
55
54
  end
@@ -58,16 +57,16 @@ describe Git::GitStatus do
58
57
  it "should handle a merge deletion on fb" do
59
58
  change_file_and_commit('a', '')
60
59
 
61
- gitlib.checkout('fb', :new_branch => 'master')
62
- gitlib.remove('a', :force => true)
63
- gitlib.commit('removed a')
60
+ gitprocess.checkout('fb', :new_branch => 'master')
61
+ gitprocess.remove('a', :force => true)
62
+ gitprocess.commit('removed a')
64
63
 
65
- gitlib.checkout('master')
64
+ gitprocess.checkout('master')
66
65
  change_file_and_commit('a', 'goodbye')
67
66
 
68
- gitlib.merge('fb') rescue
67
+ gitprocess.merge('fb') rescue
69
68
 
70
- status = gitlib.status
69
+ status = gitprocess.status
71
70
  status.unmerged.should == ['a']
72
71
  status.deleted.should == ['a']
73
72
  end
@@ -76,26 +75,26 @@ describe Git::GitStatus do
76
75
  it "should handle a merge deletion on master" do
77
76
  change_file_and_commit('a', '')
78
77
 
79
- gitlib.checkout('fb', :new_branch => 'master')
78
+ gitprocess.checkout('fb', :new_branch => 'master')
80
79
  change_file_and_commit('a', 'hello')
81
80
 
82
- gitlib.checkout('master')
83
- gitlib.remove('a', :force => true)
84
- gitlib.commit('removed a')
81
+ gitprocess.checkout('master')
82
+ gitprocess.remove('a', :force => true)
83
+ gitprocess.commit('removed a')
85
84
 
86
- gitlib.merge('fb') rescue
85
+ gitprocess.merge('fb') rescue
87
86
 
88
- status = gitlib.status
87
+ status = gitprocess.status
89
88
  status.unmerged.should == ['a']
90
89
  status.deleted.should == ['a']
91
90
  end
92
91
 
93
92
 
94
93
  it "should return an empty result" do
95
- gitlib.status.added.should == []
96
- gitlib.status.deleted.should == []
97
- gitlib.status.modified.should == []
98
- gitlib.status.unmerged.should == []
94
+ gitprocess.status.added.should == []
95
+ gitprocess.status.deleted.should == []
96
+ gitprocess.status.modified.should == []
97
+ gitprocess.status.unmerged.should == []
99
98
  end
100
99
 
101
100
  end
@@ -0,0 +1,91 @@
1
+ require 'git-process/pull_request'
2
+ require 'GitRepoHelper'
3
+ require 'webmock/rspec'
4
+ require 'json'
5
+ require 'octokit'
6
+ require 'tempfile'
7
+
8
+
9
+ describe GitHub::PullRequest do
10
+ include GitRepoHelper
11
+
12
+ def lib
13
+ unless @lib
14
+ @lib = double('lib')
15
+ @lib.stub(:logger).and_return(logger)
16
+ end
17
+ @lib
18
+ end
19
+
20
+
21
+ def test_token
22
+ 'hfgkdjfgksjhdfkls'
23
+ end
24
+
25
+
26
+ def pull_request
27
+ @pr ||= GitHub::PullRequest.new(lib, 'test_repo', :user => 'test_user')
28
+ end
29
+
30
+
31
+ before(:each) do
32
+ lib.stub(:config).with('gitProcess.github.authToken').and_return(test_token)
33
+ lib.stub(:config).with('remote.origin.url').and_return('git@github.com:jdigger/git-process.git')
34
+ end
35
+
36
+
37
+ describe "#create" do
38
+
39
+ it "should return a pull request for a good request" do
40
+ stub_request(:post, "https://api.github.com/repos/test_repo/pulls?access_token=#{test_token}").
41
+ to_return(:status => 200, :body => JSON({:number => 1, :state => 'open'}))
42
+
43
+ pull_request.create('test_base', 'test_head', 'test title', 'test body')[:state].should == 'open'
44
+ end
45
+
46
+
47
+ it "should handle asking for a duplicate pull request" do
48
+ # trying to create the request should return "HTTP 422: Unprocessable Entity" because it already exists
49
+ stub_request(:post, "https://api.github.com/repos/test_repo/pulls?access_token=#{test_token}").
50
+ to_return(:status => 422)
51
+
52
+ # listing all existing pull requests should contain the current branch
53
+ stub_request(:get, /test_repo\/pulls\?access_token=/).
54
+ to_return(:status => 200, :body => JSON([{:html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}]))
55
+
56
+ pull_request.create('test_base', 'test_head', 'test title', 'test body')[:html_url].should == 'test_url'
57
+ end
58
+
59
+ end
60
+
61
+
62
+ describe "#close" do
63
+
64
+ it "should close a good current pull request" do
65
+ stub_request(:get, /test_repo\/pulls\?access_token=/).
66
+ to_return(:status => 200, :body => JSON([{:number => 1, :state => 'open', :html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}]))
67
+ stub_request(:patch, /test_repo\/pulls\/1\?access_token=/).with(:body => JSON({:state => 'closed'})).
68
+ to_return(:status => 200, :body => JSON({:number => 1, :state => 'closed', :html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}))
69
+
70
+ pull_request.close('test_base', 'test_head')[:state].should == 'closed'
71
+ end
72
+
73
+
74
+ it "should close a good current pull request using the pull request number" do
75
+ stub_request(:patch, /test_repo\/pulls\/1\?access_token=/).with(:body => JSON({:state => 'closed'})).
76
+ to_return(:status => 200, :body => JSON({:number => 1, :state => 'closed', :html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}))
77
+
78
+ pull_request.close(1)[:state].should == 'closed'
79
+ end
80
+
81
+
82
+ it "should complain about a missing pull request" do
83
+ stub_request(:get, /test_repo\/pulls\?access_token=/).
84
+ to_return(:status => 200, :body => JSON([{:number => 1, :state => 'open', :html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}]))
85
+
86
+ expect {pull_request.close('test_base', 'missing_head')}.should raise_error GitHub::PullRequest::NotFoundError
87
+ end
88
+
89
+ end
90
+
91
+ end
@@ -1,4 +1,4 @@
1
- require 'github-service'
1
+ require 'git-process/github_service'
2
2
  require 'webmock/rspec'
3
3
  require 'json'
4
4
  require 'octokit'
@@ -0,0 +1,80 @@
1
+ require 'git-process/new_fb'
2
+ require 'GitRepoHelper'
3
+
4
+ describe GitProc::NewFeatureBranch do
5
+ include GitRepoHelper
6
+
7
+ before(:each) do
8
+ create_files(['.gitignore'])
9
+ gitprocess.commit('initial')
10
+ end
11
+
12
+
13
+ after(:each) do
14
+ rm_rf(tmpdir)
15
+ end
16
+
17
+
18
+ def create_process(dir, opts)
19
+ opts[:branch_name] = 'test_branch'
20
+ GitProc::NewFeatureBranch.new(dir, opts)
21
+ end
22
+
23
+
24
+ describe "#new_feature_branch" do
25
+
26
+ def log_level
27
+ Logger::ERROR
28
+ end
29
+
30
+
31
+ it "should create the named branch against origin/master" do
32
+ clone do |gp|
33
+ new_branch = gp.run
34
+
35
+ new_branch.name.should == 'test_branch'
36
+ new_branch.sha.should == gp.branches['origin/master'].sha
37
+ end
38
+ end
39
+
40
+
41
+ it "should bring committed changes on _parking_ over to the new branch" do
42
+ gitprocess.branch('origin/master', :base_branch => 'master')
43
+ gitprocess.checkout('_parking_', :new_branch => 'master')
44
+ change_file_and_commit('a', '')
45
+ change_file_and_commit('b', '')
46
+
47
+ new_branch = gitprocess.run
48
+
49
+ new_branch.name.should == 'test_branch'
50
+ Dir.chdir(gitprocess.workdir) do |dir|
51
+ File.exists?('a').should be_true
52
+ File.exists?('b').should be_true
53
+ end
54
+
55
+ gitprocess.branches.parking.should be_nil
56
+ end
57
+
58
+
59
+ it "should bring new/uncommitted changes on _parking_ over to the new branch" do
60
+ gitprocess.branch('origin/master', :base_branch => 'master')
61
+ gitprocess.checkout('_parking_', :new_branch => 'master')
62
+ change_file_and_commit('a', '')
63
+ change_file_and_add('b', '')
64
+ change_file('c', '')
65
+
66
+ new_branch = gitprocess.run
67
+
68
+ new_branch.name.should == 'test_branch'
69
+ Dir.chdir(gitprocess.workdir) do |dir|
70
+ File.exists?('a').should be_true
71
+ File.exists?('b').should be_true
72
+ File.exists?('c').should be_true
73
+ end
74
+
75
+ gitprocess.branches.parking.should be_nil
76
+ end
77
+
78
+ end
79
+
80
+ end