Java Code Examples for org.tigris.subversion.svnclientadapter.SVNStatusKind#ADDED
The following examples show how to use
org.tigris.subversion.svnclientadapter.SVNStatusKind#ADDED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SvnClientJavaHl.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * Checks the given {@link ISVNStatus} if modifications exist. * * @param status the {@link ISVNStatus} * @return {@code true} if modifications exist */ private static boolean isModified(ISVNStatus status) { final SVNStatusKind textStatus = status.getTextStatus(); if (textStatus == SVNStatusKind.ADDED || textStatus == SVNStatusKind.CONFLICTED || textStatus == SVNStatusKind.DELETED || textStatus == SVNStatusKind.MERGED || textStatus == SVNStatusKind.MODIFIED || textStatus == SVNStatusKind.REPLACED) { return true; } else { final SVNStatusKind propStatus = status.getPropStatus(); return propStatus == SVNStatusKind.ADDED || propStatus == SVNStatusKind.CONFLICTED || propStatus == SVNStatusKind.DELETED || propStatus == SVNStatusKind.MERGED || propStatus == SVNStatusKind.MODIFIED || propStatus == SVNStatusKind.REPLACED; } }
Example 2
Source File: AbstractCommandTestCase.java From netbeans with Apache License 2.0 | 5 votes |
private boolean isCommitted(File file) throws Exception { ISVNStatus[] statusValues = getFullWorkingClient().getStatus(new File[]{file}); if (statusValues.length == 1) { if (statusValues[0].getTextStatus() == SVNStatusKind.ADDED) { return false; } if (statusValues[0].getTextStatus() == SVNStatusKind.NORMAL) { return true; } } throw new IllegalStateException("Unexpected state of file " + file + ": " + statusValues); }
Example 3
Source File: ResourceWithStatusUtil.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public static SVNStatusKind getStatusKind(IResource resource) { ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource); SVNStatusKind statusKind = null; try { LocalResourceStatus status = svnResource.getStatus(); if (status.isTextConflicted()) statusKind = SVNStatusKind.CONFLICTED; else if (status.isAdded()) statusKind = SVNStatusKind.ADDED; else if (status.isDeleted()) statusKind = SVNStatusKind.DELETED; else if (status.isMissing()) statusKind = SVNStatusKind.MISSING; else if (status.isReplaced()) statusKind = SVNStatusKind.REPLACED; else if (status.isTextModified()) statusKind = SVNStatusKind.MODIFIED; else if (!status.isManaged()) statusKind = SVNStatusKind.UNVERSIONED; } catch (TeamException e) {} return statusKind; }
Example 4
Source File: JhlConverter.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public static SVNStatusKind convertStatusKind(Status.Kind kind) { if (kind == null) { return null; } switch (kind) { case none : return SVNStatusKind.NONE; case normal : return SVNStatusKind.NORMAL; case added : return SVNStatusKind.ADDED; case missing : return SVNStatusKind.MISSING; case incomplete : return SVNStatusKind.INCOMPLETE; case deleted : return SVNStatusKind.DELETED; case replaced : return SVNStatusKind.REPLACED; case modified : return SVNStatusKind.MODIFIED; case merged : return SVNStatusKind.MERGED; case conflicted : return SVNStatusKind.CONFLICTED; case obstructed : return SVNStatusKind.OBSTRUCTED; case ignored : return SVNStatusKind.IGNORED; case external: return SVNStatusKind.EXTERNAL; case unversioned : return SVNStatusKind.UNVERSIONED; default : { log.severe("unknown status kind :"+kind); return SVNStatusKind.NONE; } } }
Example 5
Source File: GenerateDiffFileSynchronizeOperation.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { IResource[] resources = set.getResources(); HashMap statusMap = new HashMap(); unaddedList = new ArrayList(); for (int i = 0; i < resources.length; i++) { ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]); SyncInfo syncInfo = set.getSyncInfo(resources[i]); SVNStatusKind statusKind = null; try { if (!svnResource.isManaged()) { statusKind = SVNStatusKind.UNVERSIONED; } else { switch (SyncInfo.getChange(syncInfo.getKind())) { case SyncInfo.ADDITION: statusKind = SVNStatusKind.ADDED; break; case SyncInfo.DELETION: statusKind = SVNStatusKind.DELETED; break; case SyncInfo.CONFLICTING: statusKind = SVNStatusKind.CONFLICTED; break; default: statusKind = SVNStatusKind.MODIFIED; break; } } statusMap.put(resources[i], statusKind); if (!svnResource.isManaged() && !svnResource.isIgnored()) unaddedList.add(resources[i]); } catch (SVNException e) { SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } } ArrayList dedupedList = new ArrayList(); Iterator iter = unaddedList.iterator(); while (iter.hasNext()) { IResource resource = (IResource)iter.next(); if (!isDupe(resource)) dedupedList.add(resource); } IResource[] unversionedResources = new IResource[dedupedList.size()]; dedupedList.toArray(unversionedResources); GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(new StructuredSelection(resources), unversionedResources, statusMap); wizard.setWindowTitle(Policy.bind("GenerateSVNDiff.title")); //$NON-NLS-1$ wizard.setSelectedResources(selectedResources); // final WizardDialog dialog = new WizardDialog(getShell(), wizard); // dialog.setMinimumPageSize(350, 250); final WizardDialog dialog = new WizardDialogWithPersistedLocation(getShell(), wizard, "GenerateDiffFileWizard"); //$NON-NLS-1$ dialog.setMinimumPageSize(350, 250); getShell().getDisplay().syncExec(new Runnable() { public void run() { dialog.open(); } }); }
Example 6
Source File: SVNLightweightDecorator.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * decorate the text label of the given resource. * This method assumes that only one thread will be accessing it at a time. */ protected void decorateTextLabel(ISVNLocalResource svnResource, LocalResourceStatus status, IDecoration decoration, boolean isDirty) { Map bindings = new HashMap(6); // if the resource does not have a location then return. This can happen if the resource // has been deleted after we where asked to decorate it. if (svnResource.getIResource().getLocation() == null) { return; } if (status.isUnversioned()) return; // get the format IDecoratorComponent[][] format; int type = svnResource.getIResource().getType(); if (type == IResource.FOLDER) { format = folderDecoratorFormat; } else if (type == IResource.PROJECT) { format = projectDecoratorFormat; } else { format = fileDecoratorFormat; } // fill the bindings if (isDirty & !status.isAdded()) { bindings.put(SVNDecoratorConfiguration.DIRTY_FLAG, dirtyFlag); } if (status.getUrlString() != null) { String label = null; ISVNRepositoryLocation repository = status.getRepository(); if (repository != null) { label = status.getRepository().getLabel(); } bindings.put( SVNDecoratorConfiguration.RESOURCE_LABEL, label == null ? status.getUrlString() : label); bindings.put( SVNDecoratorConfiguration.RESOURCE_URL, Util.unescape(status.getUrlString())); // short url is the path relative to root url of repository SVNUrl repositoryRoot = null; if (repository != null) { repositoryRoot = repository.getRepositoryRoot(); } if (repositoryRoot != null) { int urlLen = status.getUrlString().length(); int rootLen = repositoryRoot.toString().length()+1; String shortUrl; if (urlLen > rootLen) shortUrl = status.getUrlString().substring(rootLen); else shortUrl = status.getUrlString(); bindings.put( SVNDecoratorConfiguration.RESOURCE_URL_SHORT, Util.unescape(shortUrl)); } } if (status.isAdded()) { bindings.put(SVNDecoratorConfiguration.ADDED_FLAG, addedFlag); } else if (SVNStatusKind.EXTERNAL.equals(status.getTextStatus())) { bindings.put(SVNDecoratorConfiguration.EXTERNAL_FLAG, externalFlag); } else { if ((status.getTextStatus() != SVNStatusKind.UNVERSIONED) && (status.getTextStatus() != SVNStatusKind.ADDED)) { if (status.getLastChangedRevision() != null) { bindings.put( SVNDecoratorConfiguration.RESOURCE_REVISION, status.getLastChangedRevision().toString()); } if (status.getLastCommitAuthor() != null) { bindings.put( SVNDecoratorConfiguration.RESOURCE_AUTHOR, status.getLastCommitAuthor()); } } if (status.getLastChangedDate() != null) { bindings.put( SVNDecoratorConfiguration.RESOURCE_DATE, dateFormat.format(status.getLastChangedDate())); } } SVNDecoratorConfiguration.decorate(decoration, format, bindings); }
Example 7
Source File: SVNStatusSyncInfo.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
protected int calculateKind() throws TeamException { SVNStatusKind localKind = baseStatusInfo.getStatusKind(); SVNStatusKind repositoryKind = (remoteStatusInfo != null) ? remoteStatusInfo.getStatusKind() : SVNStatusKind.NORMAL; IResource local = getLocal(); if (local.getParent() != null && !local.getParent().exists()) { return SyncInfo.IN_SYNC; } // If resource is ignored through Eclipse project's resource filters property, IResource.exists() returns false, // even if the file/folder exists in the file system. So we need to check for the existence in the file system // so that these items aren't incorrectly shown as outgoing deletions. if (!local.exists() && !(local.getLocation() == null || local.getLocation().toFile().exists())) { if (isAddition(repositoryKind)) return SyncInfo.INCOMING | SyncInfo.ADDITION; if (localKind == SVNStatusKind.UNVERSIONED) return SyncInfo.IN_SYNC; if (isDeletion(repositoryKind)) return SyncInfo.IN_SYNC; if (!repositoryKind.equals(SVNStatusKind.ADDED)) { if (localKind == SVNStatusKind.NONE) { return SyncInfo.IN_SYNC; } if (isChange(repositoryKind)) return SyncInfo.CONFLICTING | SyncInfo.DELETION; return SyncInfo.OUTGOING | SyncInfo.DELETION; } else return SyncInfo.INCOMING | SyncInfo.ADDITION; } else if ( isDeletion(localKind)) { if (isNotModified(repositoryKind)) { if (isOutOfDate()) return SyncInfo.CONFLICTING | SyncInfo.DELETION; else return SyncInfo.OUTGOING | SyncInfo.DELETION; } else return SyncInfo.CONFLICTING | SyncInfo.DELETION; } else if( isChange(localKind) ) { if( isChange( repositoryKind ) || isAddition( repositoryKind ) || isDeletion( repositoryKind )) return SyncInfo.CONFLICTING | SyncInfo.CHANGE; else { if ((IResource.FOLDER == local.getType() || IResource.PROJECT == local.getType()) && isOutOfDate()) return SyncInfo.CONFLICTING | SyncInfo.CHANGE; else return SyncInfo.OUTGOING | SyncInfo.CHANGE; } } else if( isAddition( localKind ) ) { if( isAddition( repositoryKind ) ) return SyncInfo.CONFLICTING | SyncInfo.ADDITION; return SyncInfo.OUTGOING | SyncInfo.ADDITION; } else if( isNotModified(localKind) ) { if( isNotModified( repositoryKind) ) { if ((IResource.FOLDER == local.getType() || IResource.PROJECT == local.getType()) && isOutOfDate()) return SyncInfo.INCOMING | SyncInfo.CHANGE; return SyncInfo.IN_SYNC; } if ((localKind == SVNStatusKind.IGNORED) && (repositoryKind == SVNStatusKind.ADDED)) return SyncInfo.CONFLICTING | SyncInfo.ADDITION; if( repositoryKind == SVNStatusKind.DELETED ) return SyncInfo.INCOMING | SyncInfo.DELETION; if( repositoryKind == SVNStatusKind.ADDED ) return SyncInfo.INCOMING | SyncInfo.ADDITION; if( repositoryKind == SVNStatusKind.EXTERNAL) return SyncInfo.IN_SYNC; //TODO Is this really necessary here ? // if (getComparator().compare(getBase(), getRemote())) // return SyncInfo.IN_SYNC; return SyncInfo.INCOMING | SyncInfo.CHANGE; } else if( repositoryKind == SVNStatusKind.EXTERNAL ) { if (localKind == SVNStatusKind.EXTERNAL) return SyncInfo.IN_SYNC; } else if ((localKind == SVNStatusKind.EXTERNAL) && (remoteStatusInfo == null)) { return SyncInfo.IN_SYNC; } return super.calculateKind(); }
Example 8
Source File: SVNStatusSyncInfo.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private static boolean isAddition(SVNStatusKind kind) { return kind == SVNStatusKind.ADDED || kind == SVNStatusKind.UNVERSIONED; }