Class VCSSVN

All Implemented Interfaces:
VCS, FileFilter

public class VCSSVN extends AbstractVCS
SVN VCS. Based on SVNKit.
Version:
$Revision$ Last update : $Date$ By : $Author$
Author:
poussin
  • Field Details

    • log

      protected static org.apache.commons.logging.Log log
      to use log facility, just put in your code: log.info(\"...\");
    • svnManager

      protected org.tmatesoft.svn.core.wc.SVNClientManager svnManager
      Svn client manager instance.
    • connectionState

      protected VCSSVN.ConnectionState connectionState
      Current connection state.
  • Constructor Details

    • VCSSVN

      public VCSSVN(File localRepository, String protocol, String host, String path, File sshKeyFile, String login, String password)
      Constructor.
      Parameters:
      localRepository -
      protocol -
      host -
      path -
      sshKeyFile -
      login -
      password -
  • Method Details

    • getSVNManager

      protected org.tmatesoft.svn.core.wc.SVNClientManager getSVNManager()
      Return svnkit SVNManager.
      Returns:
      SVNManager instance
      See Also:
      • SVNClientManager
    • isValidLocalRepository

      public boolean isValidLocalRepository()
      Return true, if local repository is valid repository for actual vcs.
      Returns:
      validity
    • isConnected

      public boolean isConnected()
      Get connection state.
      Returns:
      true if server is connected
    • checkProtocol

      public void checkProtocol() throws VCSException
      Verifie la connexion et si le protocole a change, switch le repository pour utiliser le nouveau protocole. Si on est en mode interface (mode graphique) et que le switch se passe mal, demande a l'utilisateur de nouvelle valeur pour le protocole (+ identifiant, ...)
      Throws:
      VCSException
    • checkFileStatus

      public List<File> checkFileStatus() throws VCSException
      Vérifie si tous les fichiers du repository local sont les dernieres version par rapport au serveur. Si ce n'est pas le cas et que l'on est en mode interactif (mode graphique), on lui propose de mettre a jour les fichiers, avec la possibilite de voir les changements sur les fichiers
      Returns:
      list of file with unresolved conflict
      Throws:
      VCSException
    • getRemoteURL

      protected org.tmatesoft.svn.core.SVNURL getRemoteURL() throws org.tmatesoft.svn.core.SVNException
      Retourne l'url dans un objet SVNURL (svnkit).
      Returns:
      l'url distante
      Throws:
      org.tmatesoft.svn.core.SVNException
      See Also:
      • SVNURL
    • getRemoteRepository

      public String getRemoteRepository()
      Retourne l'url du repository distant. ex: ssh+svn://labs.le.org/svnroot/isis-fish/data/branches/3.2
      Returns:
      remote repository url
    • isVersionnableFile

      public boolean isVersionnableFile(File file)
      Description copied from interface: VCS
      Check if file can be put in vcs repository. For example when you used CVS, you must not put CVS file.

      default refused .svn, CVS and ~ filename Must be override, this default implementation return true.

      Specified by:
      isVersionnableFile in interface VCS
      Overrides:
      isVersionnableFile in class AbstractVCS
      Returns:
      true if file is versionnable
    • cleanup

      public void cleanup(File path) throws VCSException
      Cleanup a directory, removing all lock. Perform a "svn cleanup" command.
      Parameters:
      path - path to cleanup
      Throws:
      VCSException
    • commit

      public void commit(List<File> files, String msg) throws VCSException
      Commit specified files, if files is null, all files are committed.
      Parameters:
      files - files to commit
      msg - message used to commit
      Throws:
      VCSException
    • commitWithoutCheck

      protected void commitWithoutCheck(List<File> files, String msg) throws VCSException
      Commit without ask for registred listeners.
      Parameters:
      files - files to commit
      msg - message for commit
      Throws:
      VCSException
    • add

      public void add(List<File> files, String msg) throws VCSException
      Perform : - svn add - commit
      Parameters:
      files - list of file to add
      msg - message for commit
      Throws:
      VCSException
    • checkout

      public void checkout(org.nuiton.version.Version tag, boolean recurse) throws VCSException
      Description copied from interface: VCS
      get repository on server and put it in localdir.
      Parameters:
      tag - tag to used, null = /trunk other is tags/[tag]
      recurse - if file is directory checkout sub file
      Throws:
      VCSException
    • delete

      public void delete(List<File> files, String msg) throws VCSException
      Description copied from interface: VCS
      Delete and commit files in server repository.
      Parameters:
      files - file to delete
      msg - message for commit
      Throws:
      VCSException
    • getLocalStatus

      public VCS.Status getLocalStatus(File file) throws VCSException
      Description copied from interface: VCS
      Get file local status.
      Parameters:
      file - file to get status
      Returns:
      file status
      Throws:
      VCSException
    • getLocalStatus

      protected Map<File,org.tmatesoft.svn.core.wc.SVNStatus> getLocalStatus(File file, boolean recurse, org.tmatesoft.svn.core.wc.SVNStatusType... wanted) throws VCSException
      Recherche le statut des fichiers locaux, ne retourne jamais les fichiers NORMAL ou NONE sauf si demandé explicitement via wanted
      Parameters:
      file - le repertoire a partir duquel on souhaite le status
      recurse - si l'on souhaite le faire recursivement
      wanted - l'ensemble des status type que l'on recheche, si vide recherche tous les statuts
      Returns:
      une map avec comme cle le File local et en valeur le status
      Throws:
      VCSException
    • getRemoteStatus

      protected Map<File,org.tmatesoft.svn.core.wc.SVNStatus> getRemoteStatus(File file, boolean recurse) throws VCSException
      Retourne la liste des fichiers qui ont été mis à jour sur le serveur. Le status des fichiers retourné est :
      • SVNStatusType.STATUS_ADDED (remote) pour ajout local
      • SVNStatusType.STATUS_DELETED (remote) pour suppression locale
      Parameters:
      file -
      recurse -
      Returns:
      remote status
      Throws:
      VCSException
    • getChanglog

      public Map<File,String> getChanglog(List<File> files) throws VCSException
      Return all changelog between local file version and remote repository file version.
      Parameters:
      files -
      Returns:
      changelog for each file
      Throws:
      VCSException
    • getDiff

      public String getDiff(File file) throws VCSException
      show diff between local file and repository file.
      Parameters:
      file - file to get diff
      Returns:
      string diff
      Throws:
      VCSException
    • getFileList

      public List<String> getFileList(File directory) throws VCSException
      Description copied from interface: VCS
      Return list of all file on directory on remote server.
      Returns:
      files list
      Throws:
      VCSException
    • getUpdatedFile

      public List<File> getUpdatedFile() throws VCSException
      get list of new or modified files on server.
      Returns:
      list of modified or new files
      Throws:
      VCSException
    • haveUpdate

      public boolean haveUpdate() throws VCSException
      Ask if there are some new or modified files on server.
      Returns:
      true if new file available
      Throws:
      VCSException
    • isOnRemote

      public boolean isOnRemote(File file) throws VCSException
      Check if file is available on server.
      Parameters:
      file - file to check
      Returns:
      true if file available
      Throws:
      VCSException
    • isUpToDate

      public boolean isUpToDate(File file) throws VCSException
      Check if file is uptodate.
      Parameters:
      file - file to check
      Returns:
      true if file is in last version
      Throws:
      VCSException
    • update

      public List<File> update(File file, boolean recurse) throws VCSException
      Description copied from interface: VCS
      Update file.
      Parameters:
      file - files to update
      Returns:
      true if there are some merging conflict, false otherwise
      Throws:
      VCSException
    • isWriteable

      public boolean isWriteable() throws VCSException
      Description copied from interface: VCS
      Return true, if local repository is writable. (use trunk and is not anonymous)
      Returns:
      writable
      Throws:
      VCSException
    • isTag

      public boolean isTag(org.nuiton.version.Version version) throws VCSException
      Description copied from interface: VCS
      Look on server if version is tag repository.
      Parameters:
      version - version number like 3.2
      Returns:
      true if tag found with this name
      Throws:
      VCSException
    • getTag

      public String getTag() throws VCSException
      Description copied from interface: VCS
      Retourne le tag reellement utilise, par exemple si on a fait un setTag(3.2.0) cette methode retourne "/tags/3.2.0", pour setTag(null) on retourne "/trunk"
      Returns:
      tag
      Throws:
      VCSException
    • setTag

      public List<File> setTag(org.nuiton.version.Version version) throws VCSException
      Description copied from interface: VCS
      Change repository tag, used when we use some tag and we want to go to trunk.
      Parameters:
      version - version to go, if null trunk is used, otherwize tags/version is used
      Returns:
      a list of all file in conflict
      Throws:
      VCSException