Skip to content

Commit

Permalink
Branch Package.rb retains url when creating a new project
Browse files Browse the repository at this point in the history
  • Loading branch information
vishaldeepak committed Jul 26, 2021
1 parent f1ab0b4 commit 7e0f59f
Show file tree
Hide file tree
Showing 4 changed files with 1,469 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/api/app/models/branch_package.rb
Expand Up @@ -183,7 +183,7 @@ def create_branch_packages(tprj)
raise DoubleBranchPackageError.new(tprj.name, tpkg.name), "branch target package already exists: #{tprj.name}/#{tpkg.name}" unless params[:force]
else
if pac.is_a?(Package)
tpkg = tprj.packages.new(name: pack_name, title: pac.title, description: pac.description)
tpkg = tprj.packages.new(name: pack_name, title: pac.title, description: pac.description, url: pac.url)
tpkg.bcntsynctag = pac.bcntsynctag
else
tpkg = tprj.packages.new(name: pack_name)
Expand Down Expand Up @@ -273,12 +273,13 @@ def create_branch_project

title = "Branch project for package #{params[:package]}"
description = "This project was created for package #{params[:package]} via attribute #{@attribute}"
base_project_url = Project.find_by_name(params[:project]).try(:url)
if params[:request]
title = "Branch project based on request #{params[:request]}"
description = "This project was created as a clone of request #{params[:request]}"
end
@add_repositories = true # new projects shall get repositories
tprj = Project.new(name: @target_project, title: title, description: description)
tprj = Project.new(name: @target_project, title: title, description: description, url: base_project_url)
tprj.relationships.new(user: User.session!, role: Role.find_by_title!('maintainer'))
tprj.flags.new(flag: 'build', status: 'disable') if @extend_names
tprj.flags.new(flag: 'access', status: 'disable') if @noaccess
Expand Down

0 comments on commit 7e0f59f

Please sign in to comment.