Author: chatellier Date: 2009-02-26 13:49:06 +0000 (Thu, 26 Feb 2009) New Revision: 1890 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/AbstractVCS.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSActionEvent.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSException.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSFactory.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSNone.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties isis-fish/trunk/src/test/java/fr/ifremer/isisfish/vcs/VCSSVNTest.java Log: Add svn cleanup to fix svn update Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -366,6 +366,9 @@ // on s'arrete la si on est pas connecte if (vcs.isConnected()) { + // cleanup + vcs.cleanup(null); + // check protocol, user, host vcs.checkProtocol(); Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/AbstractVCS.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/AbstractVCS.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/AbstractVCS.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -1,5 +1,5 @@ -/* *##% GeSi - * Copyright (C) 2008 CodeLutin +/* *##% Isis-Fish + * Copyright (C) 2007 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -28,10 +28,10 @@ * Abstract VCS implementation. * * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ + * @version $Revision: 1.0 $ + * + * Last update : $Date: 1 déc. 2008 $ + * By : $Author: chatellier $ */ public abstract class AbstractVCS implements VCS { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCS.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -1,5 +1,5 @@ -/* *##% GeSi - * Copyright (C) 2008 CodeLutin +/* *##% Isis-Fish + * Copyright (C) 2007 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -13,8 +13,7 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* - */ + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ package fr.ifremer.isisfish.vcs; @@ -29,10 +28,10 @@ * Version control system. * * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ + * @version $Revision: 1.0 $ + * + * Last update : $Date: 1 déc. 2008 $ + * By : $Author: chatellier $ */ public interface VCS extends FileFilter { @@ -126,6 +125,14 @@ void setWriteable(boolean value); /** + * Cleanup a directory, removing all lock. + * + * @param path path to cleanup + * @throws VCSException + */ + void cleanup(File path) throws VCSException; + + /** * Commit specified files, if files is null, all files are committed. * * @param files files to commit Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSActionEvent.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSActionEvent.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSActionEvent.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -1,5 +1,5 @@ -/* *##% GeSi - * Copyright (C) 2008 CodeLutin +/* *##% Isis-Fish + * Copyright (C) 2007 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -21,10 +21,10 @@ * Représente une action VCS que l'on souhaite faire * * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ + * @version $Revision: 1.0 $ + * + * Last update : $Date: 1 déc. 2008 $ + * By : $Author: chatellier $ */ public enum VCSActionEvent { Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSException.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSException.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSException.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -1,31 +1,31 @@ /* *##% -* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Code Lutin, -* Benjamin Poussin, Tony Chemit -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*##%*/ + * Copyright (C) 2002 - 2009 Code Lutin, Benjamin Poussin, Tony Chemit + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ package fr.ifremer.isisfish.vcs; - /** * A generic vcs exception. * * @author chemit + * @version $Revision: 1.0 $ + * + * Last update : $Date: 1 déc. 2008 $ + * By : $Author: chatellier $ */ - public class VCSException extends Exception { private static final long serialVersionUID = -2665066202505740998L; @@ -47,5 +47,3 @@ } } - - Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSFactory.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSFactory.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSFactory.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -1,5 +1,5 @@ /* *##% - * Copyright (C) 2002-2008 Code Lutin, Benjamin Poussin + * Copyright (C) 2002-2009 Code Lutin, Benjamin Poussin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,15 +33,15 @@ * Permet de recupere le bon VCS en fonction de la configuration * * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ + * @version $Revision: 1.0 $ + * + * Last update : $Date: 1 déc. 2008 $ + * By : $Author: chatellier $ */ public class VCSFactory { /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(VCSFactory.class); + private static Log log = LogFactory.getLog(VCSFactory.class); private VCSFactory() {} Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSNone.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSNone.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSNone.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -1,5 +1,5 @@ -/* *##% GeSi - * Copyright (C) 2008 CodeLutin +/* *##% Isis-Fish + * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -30,16 +30,13 @@ * VCSNone if not valid VCSNone found. * * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ + * @version $Revision: 1.0 $ + * + * Last update : $Date: 1 déc. 2008 $ + * By : $Author: chatellier $ */ public class VCSNone extends AbstractVCS { - /* Class logger */ - //private static Log log = LogFactory.getLog(VCSNone.class); - public VCSNone(File localRepository, String protocol, String host, String path, File sshKeyFile, String login, String password) { super(localRepository, protocol, host, path, sshKeyFile, login, @@ -85,6 +82,14 @@ return new HashMap<File, String>(); } + /* + * @see fr.ifremer.isisfish.vcs.VCS#cleanup() + */ + @Override + public void cleanup(File path) throws VCSException { + + } + public void commit(List<File> files, String msg) throws VCSException { throw new VCSException("Can't commit file with dummy VCS"); } @@ -183,7 +188,7 @@ public void checkProtocol() throws VCSException { // nothing to do } - + public void checkPath() throws VCSException { // nothing to do } Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -1,5 +1,5 @@ -/* *##% GeSi - * Copyright (C) 2008 CodeLutin +/* *##% Isis-Fish + * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -67,11 +67,13 @@ /** * SVN VCS. * + * Based on SVNKit. + * * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ + * @version $Revision: 1.0 $ + * + * Last update : $Date: 1 déc. 2008 $ + * By : $Author: chatellier $ */ public class VCSSVN extends AbstractVCS { @@ -142,7 +144,7 @@ // log for private key if (log.isInfoEnabled()) { - log.info("Unsing ssh private key : " + log.info("Using ssh private key : " + sshKeyFile.getAbsolutePath()); } @@ -373,10 +375,33 @@ return result; } - /* - * @see org.codelutin.isisfish.vcs.VCS#commit(java.util.List, java.lang.String) + /** + * {@inheritDoc} + * + * Perform a "svn cleanup" command. */ @Override + public void cleanup(File path) throws VCSException { + + File localFile = path; + + if (localFile == null) { + localFile = getLocalRepository(); + } + + SVNWCClient wcClient = getSVNManager().getWCClient(); + try { + wcClient.doCleanup(localFile); + } catch (SVNException e) { + throw new VCSException(_("isisfish.vcs.vcssvn.cleanup.error"), e); + } + + } + + /** + * {@inheritDoc} + */ + @Override public void commit(List<File> files, String msg) throws VCSException { // if can't commit @@ -627,10 +652,9 @@ || acceptedStatusType.contains(status .getRemoteContentsStatus())) { File statusFile = status.getFile(); - if (statusFile.exists() - && (!statusFile.isDirectory() + if (!statusFile.isDirectory() || status.getRemoteContentsStatus() == SVNStatusType.STATUS_ADDED || status - .getRemoteContentsStatus() == SVNStatusType.STATUS_DELETED)) { + .getRemoteContentsStatus() == SVNStatusType.STATUS_DELETED) { // on ne met pas les repertoires pere dans le status // car en fait ca veut dire qu'un fichier/rep dans ce // repertoire a ete ajout/modifier/delete, et on l'aura @@ -1191,7 +1215,6 @@ return filesInConflict; } - } /** @@ -1236,7 +1259,7 @@ SVNAuthentication auth = null; if (kind.equals(ISVNAuthenticationManager.SSH) && keyFile != null) { - + String passphrase = JOptionPane.showInputDialog(null, _( "isisfish.vcs.vcssvn.connection.message", keyFile .getAbsolutePath()), _( Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties =================================================================== --- isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/resources/i18n/isis-fish-en_GB.properties 2009-02-26 13:49:06 UTC (rev 1890) @@ -940,6 +940,7 @@ isisfish.vcs.vcssvn.checkProtocol.error=Can't get address on serveur of local repository isisfish.vcs.vcssvn.checkProtocol.relocate=Relocate repository %s from %s to %s isisfish.vcs.vcssvn.checkout.error=Can't checkout +isisfish.vcs.vcssvn.cleanup.error=Can't cleanup working copy isisfish.vcs.vcssvn.commit.error=Can't commit files isisfish.vcs.vcssvn.commit.errorreadonly=You can't commit file, this repository is readonly isisfish.vcs.vcssvn.connection.message=Passphrase for key %s Modified: isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties =================================================================== --- isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/main/resources/i18n/isis-fish-fr_FR.properties 2009-02-26 13:49:06 UTC (rev 1890) @@ -940,6 +940,7 @@ isisfish.vcs.vcssvn.checkProtocol.error=Impossible d'obtenir l'adresse correspondant au d\u00E9p\u00F4t local isisfish.vcs.vcssvn.checkProtocol.relocate=Transfert du d\u00E9p\u00F4t %s de %s vers %s isisfish.vcs.vcssvn.checkout.error=Impossible de mettre \u00E0 jour +isisfish.vcs.vcssvn.cleanup.error=Impossible de d\u00E9verrouiller la copie locale isisfish.vcs.vcssvn.commit.error=Impossible de commiter isisfish.vcs.vcssvn.commit.errorreadonly=Vous ne pouvez pas commiter, le d\u00E9p\u00F4t est en lecture seule isisfish.vcs.vcssvn.connection.message=Passphrase pour la cl\u00E9 %s Modified: isis-fish/trunk/src/test/java/fr/ifremer/isisfish/vcs/VCSSVNTest.java =================================================================== --- isis-fish/trunk/src/test/java/fr/ifremer/isisfish/vcs/VCSSVNTest.java 2009-02-26 13:47:31 UTC (rev 1889) +++ isis-fish/trunk/src/test/java/fr/ifremer/isisfish/vcs/VCSSVNTest.java 2009-02-26 13:49:06 UTC (rev 1890) @@ -1,5 +1,5 @@ -/* *##% GeSi - * Copyright (C) 2008 CodeLutin +/* *##% IsisFish + * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -47,6 +47,7 @@ import org.tmatesoft.svn.core.wc.SVNUpdateClient; import org.tmatesoft.svn.core.wc.SVNWCClient; +import fr.ifremer.TestUtils; import fr.ifremer.isisfish.IsisFish; /** @@ -65,7 +66,7 @@ /** Class logger */ private static Log log = LogFactory.getLog(VCSSVNTest.class); - public static final String TMPDIR = System.getProperty("java.io.tmpdir"); + public static final File TMPDIR = TestUtils.getTargetdir(); public static final String FILECONTENTTAG = "Version 3.1.0"; public static final String FILECONTENTTRUNK = "Version 3.2.0"; @@ -431,7 +432,20 @@ vcs.checkProtocol(); } + + /** + * Test cleanup. + * + * @throws VCSException + */ + @Test + public void testCleanup() throws VCSException { + vcs.checkout(null, false); + + vcs.cleanup(null); + } + /** * Return all changelog between local file version and remote repository * file version.