Class: Loca::Git::BranchCreator
- Inherits:
-
Object
- Object
- Loca::Git::BranchCreator
show all
- Includes:
- Common, Utils
- Defined in:
- lib/loca/git/branch_creator.rb
Instance Method Summary
collapse
Methods included from Utils
non_empty_string?
Methods included from Common
#branches, #git, #git_urls_match?, #run_git_checkers
Constructor Details
#initialize(pull_num, branch_name, remote_name, remote_url) ⇒ BranchCreator
Returns a new instance of BranchCreator.
7
8
9
|
# File 'lib/loca/git/branch_creator.rb', line 7
def initialize(pull_num, branch_name, remote_name, remote_url)
@pull_num, @branch_name, @remote_name, @remote_url = pull_num, branch_name, remote_name, remote_url
end
|
Instance Method Details
#checkout ⇒ Object
25
26
27
|
# File 'lib/loca/git/branch_creator.rb', line 25
def checkout
git "checkout #{@branch_name}" end
|
#create ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/loca/git/branch_creator.rb', line 11
def create
run_git_checkers
add_remote
delete unless first_time_creating?
fetch
checkout
end
|
#fetch ⇒ Object
20
21
22
23
|
# File 'lib/loca/git/branch_creator.rb', line 20
def fetch
git "fetch #{@remote_name} pull/#{@pull_num}/head:#{@branch_name}" end
|