Return-Path: Delivered-To: apmail-continuum-commits-archive@www.apache.org Received: (qmail 98334 invoked from network); 20 Mar 2009 15:21:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2009 15:21:46 -0000 Received: (qmail 37980 invoked by uid 500); 20 Mar 2009 15:21:45 -0000 Delivered-To: apmail-continuum-commits-archive@continuum.apache.org Received: (qmail 37963 invoked by uid 500); 20 Mar 2009 15:21:45 -0000 Mailing-List: contact commits-help@continuum.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@continuum.apache.org Delivered-To: mailing list commits@continuum.apache.org Received: (qmail 37954 invoked by uid 99); 20 Mar 2009 15:21:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2009 08:21:45 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2009 15:21:45 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E4903238896C; Fri, 20 Mar 2009 15:21:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r756523 - /continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Date: Fri, 20 Mar 2009 15:21:24 -0000 To: commits@continuum.apache.org From: ctan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090320152124.E4903238896C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ctan Date: Fri Mar 20 15:21:24 2009 New Revision: 756523 URL: http://svn.apache.org/viewvc?rev=756523&view=rev Log: [CONTINUUM-2126] also move project scm root when moving a project to another group Submitted By: Jose Morales Martinez Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=756523&r1=756522&r2=756523&view=diff ============================================================================== --- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original) +++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Fri Mar 20 15:21:24 2009 @@ -111,6 +111,7 @@ import org.codehaus.plexus.util.dag.CycleDetectedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; /** * @author Jason van Zyl @@ -2764,10 +2765,17 @@ boolean removeWorkingDirectory = false; Project p = projectDao.getProject( project.getId() ); + ProjectScmRoot projectScmRoot = null; if ( !p.getScmUrl().equals( project.getScmUrl() ) ) { removeWorkingDirectory = true; + projectScmRoot = getProjectScmRootByProject( project.getId() ); + } + + if ( !p.getProjectGroup().equals( project.getProjectGroup() ) ) + { + projectScmRoot = getProjectScmRootByProject( project.getId() ); } if ( StringUtils.isEmpty( p.getScmTag() ) && !StringUtils.isEmpty( project.getScmTag() ) ) @@ -2796,6 +2804,11 @@ } projectDao.updateProject( project ); + + if ( projectScmRoot != null ) + { + updateProjectScmRoot( projectScmRoot, project ); + } } catch ( ContinuumStoreException ex ) { @@ -3585,6 +3598,36 @@ } } + private void updateProjectScmRoot( ProjectScmRoot oldScmRoot, Project project ) + throws ContinuumException + { + try + { + removeProjectScmRoot( oldScmRoot ); + ProjectScmRoot scmRoot = + projectScmRootDao.getProjectScmRootByProjectGroupAndScmRootAddress( project.getProjectGroup().getId(), + project.getScmUrl() ); + if ( scmRoot == null ) + { + ProjectScmRoot newScmRoot = new ProjectScmRoot(); + if ( project.getScmUrl().equals( oldScmRoot.getScmRootAddress() ) ) + { + BeanUtils.copyProperties( oldScmRoot, newScmRoot, new String[] { "id", "projectGroup" } ); + } + else + { + newScmRoot.setScmRootAddress( project.getScmUrl() ); + } + newScmRoot.setProjectGroup( project.getProjectGroup() ); + projectScmRootDao.addProjectScmRoot( newScmRoot ); + } + } + catch ( ContinuumStoreException ex ) + { + throw logAndCreateException( "Error while updating project.", ex ); + } + } + private boolean isProjectInReleaseStage( Project project ) throws ContinuumException {