Class: Braid::Commands::Add
- Inherits:
-
Braid::Command
- Object
- Braid::Command
- Braid::Commands::Add
- Defined in:
- lib/braid/commands/add.rb
Instance Method Summary collapse
Methods inherited from Braid::Command
Methods included from Operations::Git
#git_checkout, #git_commit, #git_fetch, #git_merge_base, #git_merge_ours, #git_merge_subtree, #git_read_tree, #git_remote_add, #git_reset_hard, #git_rev_parse, #git_rm_r, #local_changes?
Methods included from Operations::Helpers
#clean_svn_revision, #determine_target_commit, #display_revision, #extract_version, #find_git_revision, #validate_revision_option, #validate_svn_revision, #verify_version
Methods included from Operations::Mirror
#add_config_file, #check_merge_status, #create_work_branch, #fetch_remote, #find_remote, #get_current_branch, #get_work_head
Instance Method Details
#run(remote, options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/braid/commands/add.rb', line 4 def run(remote, = {}) raise Braid::Git::LocalChangesPresent if invoke(:local_changes?) in_work_branch do mirror, params = config.(remote, ) local_branch = get_local_branch_name(mirror, params) config.update(mirror, { "local_branch" => local_branch }) params["local_branch"] = local_branch # TODO check msg "Adding #{params["type"]} mirror of '#{params["remote"]}'" + (params["type"] == "git" ? ", branch '#{params["branch"]}'" : "") + "." # these commands are explained in the subtree merge guide # http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html setup_remote(mirror) fetch_remote(params["type"], local_branch) validate_revision_option(params, ) target = determine_target_commit(params, ) msg "Merging code into '#{mirror}/'." unless params["squash"] invoke(:git_merge_ours, target) end invoke(:git_read_tree, target, mirror) config.update(mirror, { "revision" => ["revision"] }) add_config_file = ["revision"] ? " at #{display_revision(params["type"], ["revision"])}" : "" = "Add mirror '#{mirror}/'#{}." invoke(:git_commit, ) end end |