Package org.tigris.subversion.svnclientadapter

Examples of org.tigris.subversion.svnclientadapter.ISVNClientAdapter


      ISVNRepositoryLocation location = SubclipseUtils.getRepositoryLocation(svnUrl);
      if(location == null) {
        location = SubclipseUtils.createRepositoryLocation(svnUrl);
      }

      ISVNClientAdapter client = location.getSVNClient();

      // TODO follow svn:externals property
      // ISVNProperty[] properties = client.getProperties(folderUrl);

      SVNUrl folderUrl = new SVNUrl(svnUrl);
      SVNUrl pomUrl = folderUrl.appendPath("/" + IMavenConstants.POM_FILE_NAME);

      return client.getContent(pomUrl, SVNRevision.getRevision(revision));
     
    } catch(SVNException ex) {
      throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, 0, ex.getMessage(), ex));

    } catch(SVNClientException ex) {
View Full Code Here


  public void checkoutProject(MavenProjectScmInfo info, File dest, IProgressMonitor monitor) throws CoreException,
      InterruptedException {
    ISVNRemoteFolder folder = getRemoteFolder(info);
   
    ISVNClientAdapter svnClient = folder.getRepository().getSVNClient();
   
    try {
      OperationManager.getInstance().beginOperation(svnClient, new OperationProgressNotifyListener(monitor));
     
      svnClient.checkout(folder.getUrl(), dest, //
          SVNRevision.getRevision(info.getRevision()), true);
     
//      RepositoryProvider.map(project, SVNProviderPlugin.getTypeId());
//      RepositoryProvider.getProvider(project, SVNProviderPlugin.getTypeId());
     
View Full Code Here

                        throw new InvocationTargetException(e);
                    }
                }
            }

            ISVNClientAdapter svnClient = svnResource.getRepository().getSVNClient();
            Set<IResource> includedResources = new HashSet<IResource>();
            if ( null != resources && resources.length > 0) {
                includedResources.addAll(Arrays.asList(resources));
            }
            //将includedResources按照project进行分组
            Map<IProject, List<IResource>> projectToResources = new HashMap<IProject, List<IResource>>();
            for( IResource resourceTmp : includedResources ){
                IProject project = resourceTmp.getProject();
                List<IResource> resources = projectToResources.get(project);
                if (resources == null) {
                    resources = new ArrayList<IResource>();
                    projectToResources.put(project, resources);
                }
                resources.add(resourceTmp);
            }
           
            //确保所有的project都在同一个Repository Root里(否则,无法正常生成ReviewBoard能够识别的diff)
            if( !RbSVNUrlUtils.isProjectWithSameSVNRepository( projectToResources.keySet() ) ){
                throw new Exception( RbSubclipseMessages.getString("ERROR_PROJECT_NOTSAME_REPOSITORY") );
            }
           
            //再逐个生成resources的diff
            SVNRevision toRevision = SVNRevision.WORKING;
            monitor.worked(200);
            for ( Iterator<Entry<IProject, List<IResource>>> iEntry = projectToResources.entrySet().iterator(); iEntry.hasNext(); ) {
                monitor.worked(100)
                Entry<IProject, List<IResource>> entry = (Entry<IProject, List<IResource>>) iEntry.next();
                IProject project = (IProject) entry.getKey();
                List<IResource> resources = (List<IResource>) entry.getValue();
               
                String repositoryRootUrl = RbSVNUrlUtils.getRepositoryRootUrlForResource( project );
                String projectSVNUrl = RbSVNUrlUtils.getSVNUrlForProject( project );
                if( !repositoryRootUrl.endsWith("/") ){
                    repositoryRootUrl += "/";
                }
                if( !projectSVNUrl.endsWith("/") ){
                    projectSVNUrl += "/";
                }
                String relativeRepositoryRootUrl = projectSVNUrl.replaceFirst( repositoryRootUrl, EMPTY_STRING );
               
                for( IResource resourceTmp : resources ){
                    if( ! (resourceTmp instanceof IFile) ){
                        continue;
                    }
                    File tempDiffFile = IOUtils.generateTmpFile( FOLDER_TMP_DIFF, DIFF_SUFFIX);
                    File resourceFileTmp = ((IFile)resourceTmp).getLocation().toFile();
                    SVNRevision compareVersionReal = compareVersion;
                    //修复版本号
                    if( compareVersionReal instanceof SVNRevision.Number ){
                        compareVersionReal = RbSVNUrlUtils.reviseSVNRevisionAdaptByMaxOrMin( resourceTmp, (SVNRevision.Number)compareVersion, false, null );
                        if( null == compareVersionReal ){
                            compareVersionReal = compareVersion;
                        }
                    }
                    svnClient.diff(resourceFileTmp, compareVersionReal, resourceFileTmp, toRevision,
                            tempDiffFile, false, false, false, false);
                   
                    if( null == tempDiffFile || !tempDiffFile.exists() ){
                        continue;
                    }
View Full Code Here

     */
    public static void diff(SVNUrl fromUrl, SVNRevision fromRevision,
            SVNUrl toUrl, SVNRevision toRevision, File fileDiff,
            boolean localNewVersionFlag,ISVNResource localResource) throws DiffGenerateException {
        try {
            ISVNClientAdapter client = null;
            ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(fromUrl.toString());
            if (repository != null){
                client = repository.getSVNClient();
            }
           
            if( null == client ){
                return ;
            }
            SVNRevision pegRevision = null;
            if ( localNewVersionFlag && fromUrl.toString().equals(toUrl.toString()) && localResource != null) {
                if (localResource.getResource() == null) pegRevision = SVNRevision.HEAD;
                else {
                    IResource resource = localResource.getResource();
                    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
                    pegRevision = svnResource.getRevision();
                }
            }
            if (pegRevision == null){
                client.diff(fromUrl, fromRevision, toUrl, toRevision, fileDiff, true);
            }
            else{
                client.diff(fromUrl, pegRevision, fromRevision, toRevision, fileDiff, true);
            }
           
        }catch (SVNClientException e) {
            throw new DiffGenerateException(e);
        }catch ( SVNException e2 ) {
View Full Code Here

                Entry entry = (Entry) iEntry.next();
               
                IResource project = (IResource) entry.getKey();
                List files = (List) entry.getValue();
               
                ISVNClientAdapter client = SVNWorkspaceRoot.getSVNResourceFor(project).getRepository().getSVNClient();

                os.write(ECLIPSE_PROJECT_MARKER.getBytes());
                os.write(project.getName().getBytes());
                os.write(EOL.getBytes());
               
                File tempFile = File.createTempFile("tempDiff" + getRandomNumber() , DIFF_SUFFIX);
                client.createPatch((File[]) files.toArray(new File[files.size()]), project.getLocation().toFile(), tempFile, recurse);
               
                try {
                    is = new FileInputStream(tempFile);
                   
                    int bytes_read;
View Full Code Here

    public static SVNDiffSummary[] diffSummarize(SVNUrl fromUrl, SVNRevision fromRevision,
            SVNUrl toUrl, SVNRevision toRevision,
            boolean localNewVersionFlag,ISVNResource localResource) throws DiffGenerateException {
        SVNDiffSummary[] sVNDiffSummarys = null;
        try {
            ISVNClientAdapter client = null;
            ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(fromUrl.toString());
            if (repository != null){
                client = repository.getSVNClient();
            }
            if( null == client ){
                return sVNDiffSummarys;
            }
            SVNRevision pegRevision = null;
            if ( localNewVersionFlag && fromUrl.toString().equals(toUrl.toString()) && localResource != null) {
                if (localResource.getResource() == null){
                    pegRevision = SVNRevision.HEAD;
                }
                else {
                    IResource resource = localResource.getResource();
                    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
                    pegRevision = svnResource.getRevision();
                }
            }
            if (pegRevision == null){
                sVNDiffSummarys = client.diffSummarize(fromUrl, fromRevision, toUrl, toRevision, 40, false);
            }else{
                sVNDiffSummarys = client.diffSummarize(fromUrl, pegRevision, fromRevision, toRevision, 40, false);
            }
        }catch (SVNClientException e) {
            throw new DiffGenerateException(e);
        }catch ( SVNException e2 ) {
            throw new DiffGenerateException(e2);
View Full Code Here

     * @throws ReviewboardException
     */
    public static ISVNLogMessage[] getPriorSVNRevision( SVNUrl url, SVNRevision revisionStart,
            SVNRevision revisionEnd ) throws ReviewboardException{
        ISVNLogMessage[] svnLogMessages = null;
        ISVNClientAdapter client = null;
        try {
            ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(url.toString());
            if (repository != null){
                client = repository.getSVNClient();
            }
            if( null == client ){
                return svnLogMessages;
            }
            svnLogMessages = client.getLogMessages(url, revisionStart, revisionEnd);
        } catch (SVNException e) {
            throw new ReviewboardException(e);
        } catch (SVNClientException e) {
            throw new ReviewboardException(e);
        }
View Full Code Here

TOP

Related Classes of org.tigris.subversion.svnclientadapter.ISVNClientAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.