Package org.tigris.subversion.svnclientadapter

Examples of org.tigris.subversion.svnclientadapter.SVNRevision


   * @param scmRevision
   * @return
   */
  public boolean isValidRevision(ScmUrl scmUrl, String scmRevision) {
    try {
      SVNRevision revision = SVNRevision.getRevision(scmRevision);
      int kind = revision.getKind();
      return kind == SVNRevision.Kind.head || kind == SVNRevision.Kind.number || kind == SVNRevision.Kind.date;
    } catch(ParseException ex) {
      return false;
    }
  }
View Full Code Here


                    IStructuredSelection sel = (IStructuredSelection)event.getSelection();
                    Object sel0 = sel.getFirstElement();
                    if (sel0 instanceof IFile) {
                        IFile ifile = (IFile)sel0;
                        final ISVNLocalResource localResource= SVNWorkspaceRoot.getSVNResourceFor( ifile );
                        SVNRevision compareVersion = SVNRevision.BASE;
                        //compareVersion = SVNRevision.START;
                        ISVNRemoteResource svnRemoteResource = null;
                        int compareVersionInt = 0;
                        if( null != txtStart ){
                            compareVersionInt = getStartVersion();
View Full Code Here

                if(!isAcceptCharset){
                    return false;
                }
            }
           
            SVNRevision compareVersion = null;
            if( mainPage.getStartVersion() > 0 ){
                compareVersion = new SVNRevision.Number(mainPage.getStartVersion());
            }
            GeneratePreCommitDiffOperation generateDiffFileOperation = new GeneratePreCommitDiffOperation(
                    mainPageSelectedResources, unaddedAllResourceList, null, getShell(), compareVersion );
View Full Code Here

                    ISVNRemoteResource svnRemoteResource2 = null;
                    final ISVNLocalResource localResource= SVNWorkspaceRoot.getSVNResourceFor(resource);
                    String[] startAndStopVersion = getStartAndStopVersion();
                    SVNRevision[] fromAndToRevision = RbSVNUrlUtils.formateSVNRevisionUnify(startAndStopVersion[0], startAndStopVersion[1]);
                   
                    SVNRevision startVersion = fromAndToRevision[0];
                    SVNRevision stopVersion = fromAndToRevision[1];
                    //修复版本号
                    if( stopVersion instanceof SVNRevision.Number ){
                        stopVersion = RbSVNUrlUtils.reviseSVNRevision( resource, (SVNRevision.Number)fromAndToRevision[1], true, true, null );
                    }
                    if( startVersion instanceof SVNRevision.Number ){
View Full Code Here

                    String startUrl = baseSVNUrl[2];
                    SVNUrl fromUrl = new SVNUrl(stopUrl);
                    SVNUrl toUrl = new SVNUrl(startUrl);
                    try {
                        SVNRevision[] fromAndToRevision = RbSVNUrlUtils.formateSVNRevisionUnify(start, stop);
                        SVNRevision startVersion = fromAndToRevision[0];
                        SVNRevision stopVersion = fromAndToRevision[1];
                        //修复版本号
                        if( stopVersion instanceof SVNRevision.Number ){
                            stopVersion = RbSVNUrlUtils.reviseSVNRevision( resourceTmp,
                                    (SVNRevision.Number)fromAndToRevision[1], true, true, null );
                        }
View Full Code Here

            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;
View Full Code Here

        //先初始化变量
        startVersion = 0;
        stopVersion = 0;
        reviewboardClient = null;
       
        SVNRevision fromRevision = null;
        SVNRevision toRevision = null;
        Object[] selectedObjects = selection.toArray();
       
        //请求方式:(1)右键Team,显示资源历史记录
        if (selectedObjects[0] instanceof ILogEntry) {
            selectedSVNResources = new ISVNResource[2];
            selectedSVNResources[0] = ((ILogEntry)selectedObjects[0]).getResource();
            toRevision = ((ILogEntry)selectedObjects[0]).getRevision();
           
            if (selectedObjects.length > 1) {
                selectedSVNResources[1] = ((ILogEntry)selectedObjects[1]).getResource();
                fromRevision = ((ILogEntry)selectedObjects[1]).getRevision();                 
            }
        }
       
        //请求方式:(2)从SVN资源库直接打开历史记录的情况(这种情况下无法获得IResource)
        if ( null == selectedSVNResources || selectedSVNResources.length == 0) {
            selectedSVNResources = getSelectedRemoteResources();
            if ( null != selectedSVNResources && selectedSVNResources.length > 0 ) {
                if (selectedSVNResources[0] instanceof ISVNRemoteResource)
                    toRevision = ((ISVNRemoteResource)selectedSVNResources[0]).getRevision();
                if (selectedSVNResources.length > 1 && selectedSVNResources[1] instanceof ISVNRemoteResource)
                    fromRevision = ((ISVNRemoteResource)selectedSVNResources[1]).getRevision()
            }
        }
       
        if( null == selectedSVNResources || selectedSVNResources.length == 0 ){
            return ;
        }

        ArrayList<IResource> selectedResourceList = new ArrayList<IResource>();
        for( ISVNResource svnResourceTmp : selectedSVNResources ){
            if( null == svnResourceTmp ){
                continue;
            }
            IResource resource = svnResourceTmp.getResource();
            if( null == resource ){
                continue;
            }
            //确认resourceList已经不包含重复值
            boolean isExsit = false;
            for( IResource resourceTmp : selectedResourceList){
                if( resourceTmp.getLocation().toString().equals(resource.getLocation().toString())){
                    isExsit = true;
                    break;
                }
            }
            if( !isExsit ){
                selectedResourceList.add( resource );
            }
       
        }
        selectedResources = selectedResourceList.toArray( new IResource[selectedResourceList.size()] );

        final IReviewboardClientRepository reviewboardClientRepository = SVNClientRepositoryAwair.getReviewboardClientRepository();
       
        //友好化用户体验
        if( null == reviewboardClientRepository.getClientFromUrlToClientMap()){
            run(new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    if( null != reviewboardClientRepository ){
                        if( null != monitor ){
                            monitor.setTaskName(RbSubclipseMessages.getString("PROGRESS_READINGCACHE")); //$NON-NLS-1$
                            monitor.worked(1);
                        }
                        try {
                            reviewboardClient = reviewboardClientRepository.getClient(false, monitor);
                        } catch (OperationCanceledException e) {
                            return ;
                        }
                    }
                }
            }, true, PROGRESS_DIALOG);
        }else{
            try {
                reviewboardClient = reviewboardClientRepository.getClient(false, null);
            } catch (OperationCanceledException e) {
                return ;
            }
        }
       
        if( null == reviewboardClient ){
            MessageDialog.openError(getShell(),
                    RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
                    RbSubclipseMessages.getString("ERROR_SERVER_NOT_CONFIFIGURED")); //$NON-NLS-1$
            return;
        }
       
        if( null != fromRevision ){
            try {
                startVersion = Integer.parseInt(fromRevision.toString());
            } catch (NumberFormatException e) {
            }
        }
        if( null != toRevision ){
            try {
                stopVersion = Integer.parseInt(toRevision.toString());
            } catch (NumberFormatException e) {
            }
        }
       
        if( startVersion > stopVersion ){
View Full Code Here

            }
           
            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);
View Full Code Here

                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 {
View Full Code Here

    }
    /**
     * 本插件读取SVNRevision均遵循该规范
     */
    public static SVNRevision[] formateSVNRevisionUnify(String start, String stop ){
        SVNRevision fromRevision;
        SVNRevision toRevision;
        if(start.trim().isEmpty()){
            fromRevision = SVNRevision.HEAD;
        }
        else {
            try {
View Full Code Here

TOP

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

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.