[refs #90] project fullname
This commit is contained in:
parent
944c6fc0e2
commit
25bdbb01d6
|
@ -96,7 +96,7 @@ class Projects::PullRequestsController < Projects::BaseController
|
|||
items << PullRequest.default_base_project(@project)
|
||||
items.select! {|e| Regexp.new(params[:term].downcase).match(e.name.downcase) && e.repo.branches.count > 0}
|
||||
items.uniq!
|
||||
render :json => json_for_autocomplete_base(items)#, :full_name, [:branches])
|
||||
render :json => json_for_autocomplete_base(items)#, :fullname, [:branches])
|
||||
|
||||
end
|
||||
|
||||
|
@ -108,7 +108,7 @@ class Projects::PullRequestsController < Projects::BaseController
|
|||
|
||||
def json_for_autocomplete_base items
|
||||
items.collect do |project|
|
||||
hash = {"id" => project.id.to_s, "label" => project.full_name, "value" => project.full_name}
|
||||
hash = {"id" => project.id.to_s, "label" => project.fullname, "value" => project.fullname}
|
||||
hash[:refs] = project.repo.branches_and_tags.map &:name
|
||||
hash
|
||||
end
|
||||
|
|
|
@ -138,6 +138,10 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def fullname
|
||||
@fullname ||= "#{owner.uname}/#{name}"
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def attach_to_personal_repository
|
||||
|
|
|
@ -161,7 +161,7 @@ class PullRequest < ActiveRecord::Base
|
|||
|
||||
def merge
|
||||
clone
|
||||
message = "Merge pull request ##{serial_id} from #{head_project.full_name}:#{head_ref}\r\n #{title}"
|
||||
message = "Merge pull request ##{serial_id} from #{head_project.fullname}:#{head_ref}\r\n #{title}"
|
||||
%x(cd #{path} && git checkout #{base_ref} && git merge --no-ff #{head_branch} -m '#{message}')
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
- else
|
||||
= image_tag("lock.png")
|
||||
%td
|
||||
= link_to "#{project.owner.uname}/#{project.name}", project_path(project)
|
||||
= link_to project.fullname, project_path(project)
|
||||
%tr
|
||||
%td
|
||||
\
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
- is_group = owner.class == Group ? "(#{t 'activerecord.models.group'})" : ''
|
||||
%p.center
|
||||
=t 'layout.projects.already_exists'
|
||||
=link_to "#{owner.uname}/#{@project.name} #{is_group}", project_path(owner, @project.name)
|
||||
=link_to "#{@project.fullname} #{is_group}", project_path(owner, @project.name)
|
||||
- else
|
||||
= form_for @project, :url => fork_project_path(@project), :html => { :class => :form, :multipart => true, :method => :post } do |f|
|
||||
= hidden_field_tag :group, owner.id if owner.class == Group
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
=hidden_field_tag :update_action, new_project_pull_requests_path
|
||||
.leftlist=f.label :base_project, t("#{ar}.base_project"), :class => :label
|
||||
.rightlist
|
||||
=f.autocomplete_field :base_project, autocomplete_base_project_project_pull_requests_path, :value => @pull.base_project.full_name, :id_element => '#pull_request_base_project_id', :name => 'base_project'
|
||||
=f.autocomplete_field :base_project, autocomplete_base_project_project_pull_requests_path, :value => @pull.base_project.fullname, :id_element => '#pull_request_base_project_id', :name => 'base_project'
|
||||
=f.hidden_field :base_project_id, :name => 'base_project_id'
|
||||
.both
|
||||
.leftlist=f.label :base_ref, "#{t "#{ar}.base_ref"} #{t "#{ar}.refs"}", :class => :label
|
||||
|
@ -18,7 +18,7 @@
|
|||
%input{:id => 'base_refs', :value => @pull.base_ref, :name => 'pull_request[base_ref]'}
|
||||
.both
|
||||
.leftlist=f.label :head_project, t("#{ar}.head_project"), :class => :label
|
||||
.rightlist=@pull.head_project.full_name
|
||||
.rightlist=@pull.head_project.fullname
|
||||
.both
|
||||
.leftlist=f.label :head_ref, "#{t "#{ar}.head_ref"} #{t "#{ar}.refs"}", :class => :label
|
||||
.rightlist
|
||||
|
|
|
@ -99,20 +99,20 @@ namespace :import do
|
|||
if version != project_import.version.to_s and File.mtime(srpm_file) > project_import.file_mtime
|
||||
unless project = project_import.project
|
||||
if project = repository.projects.find_by_name(name) || repository.projects.by_name(name).first # fallback to speedup
|
||||
say "Found project '#{project.owner.uname}/#{project.name}'"
|
||||
say "Found project '#{project.fullname}'"
|
||||
elsif scoped = Project.where(:owner_id => owner.id, :owner_type => owner.class) and
|
||||
project = scoped.find_by_name(name) || scoped.by_name(name).first
|
||||
repository.projects << project
|
||||
say "Add project '#{project.owner.uname}/#{project.name}' to '#{platform.name}/#{repository.name}'"
|
||||
say "Add project '#{project.fullname}' to '#{platform.name}/#{repository.name}'"
|
||||
else
|
||||
description = ::Iconv.conv('UTF-8//IGNORE', 'UTF-8', `rpm -q --qf '[%{Description}]' -p #{srpm_file}`)
|
||||
project = Project.create!(:name => name, :description => description) {|p| p.owner = owner}
|
||||
repository.projects << project
|
||||
say "Create project #{project.owner.uname}/#{project.name} in #{platform.name}/#{repository.name}"
|
||||
say "Create project #{project.fullname} in #{platform.name}/#{repository.name}"
|
||||
end
|
||||
end
|
||||
project.import_srpm(srpm_file, branch)
|
||||
say "New version (#{version}) for '#{project.owner.uname}/#{project.name}' successfully imported to branch '#{branch}'!"
|
||||
say "New version (#{version}) for '#{project.fullname}' successfully imported to branch '#{branch}'!"
|
||||
|
||||
project_import.project = project
|
||||
# project_import.platform = platform
|
||||
|
|
Loading…
Reference in New Issue