Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Specs passing, trying repo owner as backup on collaborator checkouts …

…(sometimes the target user is a QA repo)
  • Loading branch information...
commit aadc11114aad868ab841ea472bc1b7ee0bf83b42 1 parent 4639a9f
@winton authored
Showing with 33 additions and 9 deletions.
  1. +11 −1 features/steps/gitcycle_steps.rb
  2. +22 −8 lib/gitcycle.rb
View
12 features/steps/gitcycle_steps.rb
@@ -30,6 +30,14 @@
$input = []
$remotes = nil
$ticket = nil
+
+ File.open("#{BASE}/features/fixtures/gitcycle.yml", 'w') do |f|
+ yaml = {
+ "#{config['user']}/#{config['repo']}" => [ config['user'], config['token_dev'] ],
+ "#{config['owner']}/#{config['repo']}" => [ config['user'], config['token_qa'] ],
+ }
+ f.write(YAML.dump(yaml))
+ end
end
def branches(options={})
@@ -332,9 +340,11 @@ def type(text)
}
should['collab'] = '1' if collab
if @scenario_title.include?("(Discuss)") && @scenario_title.include?("something committed")
- should['labels'] = 'Branch - master'
+ should['labels'] = [ "Discuss" ]
should['issue_url'] = $github_url
+ should['state'] = 'open'
end
+
branch.should == should
end
View
30 lib/gitcycle.rb
@@ -138,20 +138,34 @@ def checkout(*args)
unless branches(:match => branch)
collab = branch && remote
+ og_remote = nil
- unless collab
- puts "\nRetrieving repo information from gitcycle.\n".green
- repo = get('repo')
- remote = repo['owner']
- end
+ puts "\nRetrieving repo information from gitcycle.\n".green
+ repo = get('repo')
+ remote = repo['owner'] unless collab
- add_remote_and_fetch(
+ output = add_remote_and_fetch(
:owner => remote,
:repo => @git_repo
)
+
+ if output.include?('ERROR')
+ og_remote = remote
+ remote = repo["owner"]
+
+ add_remote_and_fetch(
+ :owner => remote,
+ :repo => @git_repo
+ )
+ end
puts "Creating branch '#{branch}' from '#{remote}/#{branch}'.\n".green
- run("git branch --no-track #{branch} #{remote}/#{branch}")
+ output = run("git branch --no-track #{branch} #{remote}/#{branch}")
+
+ if output.include?("fatal")
+ puts "Could not find branch #{"'#{og_remote}/#{branch}' or " if og_remote}'#{remote}/#{branch}'.\n".red
+ exit
+ end
if collab
puts "Sending branch information to gitcycle.".green
@@ -841,7 +855,7 @@ def run(cmd)
if ENV['RUN'] == '0'
puts cmd
else
- `#{cmd}`
+ `#{cmd} 2>&1`
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.