0
@@ -14,9 +14,9 @@ class RemoteController < ApplicationController
0
branch = git.branch.current_branch
0
branch_remote = branch && branch_remote
0
- for_each_selected_remote(:title => "Fetch", :prompt => "Fetch from which shared repository?", :items => git.sources, :default => branch.remote) do |source|
0
- puts "<h2>Fetching from #{source}</h2>"
0
- output = run_fetch(source)
0
+ for_each_selected_remote(:title => "Fetch", :prompt => "Fetch from which shared repository?", :items => git.remotes, :default => branch.remote) do |remote|
0
+ puts "<h2>Fetching from #{remote}</h2>"
0
+ output = run_fetch(remote)
0
puts htmlize(output[:text])
0
unless output[:fetches].empty?
0
@@ -24,8 +24,8 @@ class RemoteController < ApplicationController
0
output_branch_logs(output[:fetches])
0
- puts "<h2>Pruning stale branches from #{source}</h2>"
0
- puts git.command('remote', 'prune', source)
0
+ puts "<h2>Pruning stale branches from #{remote}</h2>"
0
+ puts git.command('remote', 'prune', remote)
0
@@ -36,20 +36,20 @@ class RemoteController < ApplicationController
0
output_show_html and return
0
-
sources = git.sources.with_this_at_front(branch.remote)
0
+
remotes = git.remotes.with_this_at_front(branch.remote)
0
- TextMate::UI.request_item(:title => "Push", :prompt => "Pull from where?", :items => sources) do |source|
0
- # check to see if the branch has a pull source set up. if not, prompt them for which branch to pull from
0
- if (source != branch.remote) || branch.merge.nil?
0
+ TextMate::UI.request_item(:title => "Push", :prompt => "Pull from where?", :items => remotes) do |remote|
0
+ # check to see if the branch has a pull remote set up. if not, prompt them for which branch to pull from
0
+ if (remote != branch.remote) || branch.merge.nil?
0
# select a branch to merge from
0
- remote_branch_name = setup_auto_merge(
source, branch)
0
+ remote_branch_name = setup_auto_merge(
remote, branch)
0
return false unless remote_branch_name
0
- puts "<p>Pulling from remote source '#{
source}'\n</p>"
0
+ puts "<p>Pulling from remote source '#{
remote}'\n</p>"
0
with_submodule_cacheing do
0
- output = run_pull(
source, remote_branch_name)
0
+ output = run_pull(
remote, remote_branch_name)
0
puts "<pre>#{output[:text]}</pre>"
0
if ! output[:pulls].empty?
0
@@ -66,23 +66,23 @@ class RemoteController < ApplicationController
0
current_name = git.branch.current.name
0
- for_each_selected_remote(:title => "Push", :prompt => "Select a remote source to push the branch #{current_name} to:", :items => git.sources) do |source_name|
0
- puts "<p>Pushing to remote source '#{source_name}'\n</p>"
0
- display_push_output(run_push(source_name, :branch => current_name))
0
+ for_each_selected_remote(:title => "Push", :prompt => "Select a remote source to push the branch #{current_name} to:", :items => git.remotes) do |remote|
0
+ puts "<p>Pushing to remote source '#{remote}'\n</p>"
0
+ display_push_output(run_push(remote, :branch => current_name))
0
tag = params[:tag] || (raise "select tag not yet implemented")
0
- for_each_selected_remote(:title => "Push", :prompt => "Select a remote source to push the tag #{tag} to:", :items => git.sources) do |source_name|
0
- puts "<p>Pushing tag #{tag} to '#{source_name}'\n</p>"
0
- display_push_output(run_push(source_name, :tag => tag))
0
+ for_each_selected_remote(:title => "Push", :prompt => "Select a remote source to push the tag #{tag} to:", :items => git.remotes) do |remote|
0
+ puts "<p>Pushing tag #{tag} to '#{remote}'\n</p>"
0
+ display_push_output(run_push(remote, :tag => tag))
0
- def setup_auto_merge(source, branch)
0
- remote_branches = git.branch.list_names(:remote, :remote_name => source ).with_this_at_front(/(\/|^)#{branch.name}$/)
0
+ def setup_auto_merge(remote, branch)
0
+ remote_branches = git.branch.list_names(:remote, :remote => remote ).with_this_at_front(/(\/|^)#{branch.name}$/)
0
remote_branch_name = TextMate::UI.request_item(:title => "Branch to merge from?", :prompt => "Merge which branch to '#{branch.name}'?", :items => remote_branches, :force_pick => true)
0
if remote_branch_name.nil? || remote_branch_name.empty?
0
@@ -90,7 +90,7 @@ class RemoteController < ApplicationController
0
if TextMate::UI.alert(:warning, "Setup automerge for these branches?", "Would you like me to tell git to always merge:\n #{remote_branch_name} -> #{branch.name}?", 'Yes', 'No') == "Yes"
0
- branch.remote =
source
0
+ branch.remote =
remote
0
branch.merge = "refs/heads/" + remote_branch_name.split("/").last
0
@@ -117,53 +117,53 @@ class RemoteController < ApplicationController
0
- def run_pull(
source, remote_branch_name)
0
+ def run_pull(
remote, remote_branch_name)
0
- pulls = git.pull(source, remote_branch_name,
0
- :start => lambda { |state, count| progress_start(state, count) },
0
- :progress => lambda { |state, percentage, index, count| progress(state, percentage, index, count)},
0
- :end => lambda { |state, count| progress_end(state, count) }
0
+ pulls = git.pull(remote, remote_branch_name,
0
+ :start => lambda { |state, count| progress_start(remote, state, count) },
0
+ :progress => lambda { |state, percentage, index, count| progress(remote, state, percentage, index, count)},
0
+ :end => lambda { |state, count| progress_end(remote, state, count) }
0
- def run_push(
source_name, options = {})
0
+ def run_push(
remote, options = {})
0
- git.push(source_name, options.merge(
0
- :start => lambda { |state, count| progress_start(state, count) },
0
- :progress => lambda { |state, percentage, index, count| progress(state, percentage, index, count)},
0
- :end => lambda { |state, count| progress_end(state, count) }
0
+ git.push(remote, options.merge(
0
+ :start => lambda { |state, count| progress_start(remote, state, count) },
0
+ :progress => lambda { |state, percentage, index, count| progress(remote, state, percentage, index, count)},
0
+ :end => lambda { |state, count| progress_end(remote, state, count) }
0
- :start => lambda { |state, count| progress_start(state, count) },
0
- :progress => lambda { |state, percentage, index, count| progress(state, percentage, index, count)},
0
- :end => lambda { |state, count| progress_end(state, count) }
0
+ :start => lambda { |state, count| progress_start(remote, state, count) },
0
+ :progress => lambda { |state, percentage, index, count| progress(remote, state, percentage, index, count)},
0
+ :end => lambda { |state, count| progress_end(remote, state, count) }
0
- def progress_start(state, count)
0
- puts("<div>#{state} #{count} objects. <span id='#{state}_progress'>0% 0 / #{count}</span></div>")
0
+ def progress_start(remote, state, count)
0
+ puts("<div>#{remote}_#{state} #{count} objects. <span id='#{state}_progress'>0% 0 / #{count}</span></div>")
0
- def progress(
state, percentage, index, count)
0
+ def progress(
remote, state, percentage, index, count)
0
<script language='JavaScript'>
0
- $('#{
state}_progress').update('#{percentage}% #{index} / #{count}')
0
+ $('#{
remote}_#{state}_progress').update('#{percentage}% #{index} / #{count}')
0
- def progress_end(
state, count)
0
+ def progress_end(
remote, state, count)
0
<script language='JavaScript'>
0
- $('#{
state}_progress').update('Done')
0
+ $('#{
remote}_#{state}_progress').update('Done')
0
@@ -172,15 +172,15 @@ class RemoteController < ApplicationController
0
def for_each_selected_remote(options, &block)
0
options = {:title => "Select remote", :prompt => "Select a remote...", :force_pick => true}.merge(options)
0
default = options.delete(:default)
0
-
sources = options[:items]
0
+
remotes = options[:items]
0
- sources.unshift(default)
0
+ remotes.unshift(default)
0
-
sources << ALL_REMOTES if sources.length > 1
0
+
remotes << ALL_REMOTES if remotes.length > 1
0
TextMate::UI.request_item(options) do |selections|
0
- ((selections == ALL_REMOTES) ? (
sources-[ALL_REMOTES]) : [selections]).each do |selection|
0
+ ((selections == ALL_REMOTES) ? (
remotes-[ALL_REMOTES]) : [selections]).each do |selection|
Comments
No one has commented yet.