Java Code Examples for org.tigris.subversion.svnclientadapter.SVNRevision#getKind()

The following examples show how to use org.tigris.subversion.svnclientadapter.SVNRevision#getKind() . 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: JhlConverter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
* Convert clientAdapter's {@link SVNRevision} into JavaHL's {@link Revision}
* @param svnRevision
* @return a {@link Revision} representing suppplied SVNRevision
*/
  public static Revision convert(SVNRevision svnRevision) {
  	if (svnRevision == null)
  		return null;
      switch(svnRevision.getKind()) {
          case SVNRevision.Kind.base : return Revision.BASE;
          case SVNRevision.Kind.committed : return Revision.COMMITTED;
          case SVNRevision.Kind.date : return new Revision.DateSpec(((SVNRevision.DateSpec)svnRevision).getDate());
          case SVNRevision.Kind.head : return Revision.HEAD;
          case SVNRevision.Kind.number : return new Revision.Number(((SVNRevision.Number)svnRevision).getNumber());
          case SVNRevision.Kind.previous : return Revision.PREVIOUS;
          case SVNRevision.Kind.unspecified : return Revision.START;
          case SVNRevision.Kind.working : return Revision.WORKING;
          default: {
      		log.severe("unknown revision kind :"+svnRevision.getKind());
          	return Revision.START; // should never go here
          }
      }
  }
 
Example 2
Source File: RevertModifications.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected boolean validateRevision(SVNRevision revision) {
    boolean valid = revision == null || revision.equals(SVNRevision.HEAD) || revision.getKind() == SVNRevision.Kind.number;
    RevertModifications.this.okButton.setEnabled(valid);
    return valid;
}
 
Example 3
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void diff(SVNUrl oldUrl, SVNRevision oldUrlRevision, SVNUrl newUrl,
		SVNRevision newUrlRevision, File outFile, boolean recurse,
		boolean ignoreAncestry, boolean noDiffDeleted, boolean force)
		throws SVNClientException {
	try {
		notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);

		if (newUrl == null)
			newUrl = oldUrl;
		if (oldUrlRevision == null)
			oldUrlRevision = SVNRevision.HEAD;
		if (newUrlRevision == null)
			newUrlRevision = SVNRevision.HEAD;

		String svnOutFile = fileToSVNPath(outFile, false);

		String commandLine = "diff ";
		if ((oldUrlRevision.getKind() != Revision.Kind.head.ordinal())
				|| (newUrlRevision.getKind() != Revision.Kind.head
						.ordinal())) {
			commandLine += "-r " + oldUrlRevision.toString();
			if (newUrlRevision.getKind() != Revision.Kind.head.ordinal())
				commandLine += ":" + newUrlRevision.toString();
			commandLine += " ";
		}
		commandLine += oldUrl + " ";
		if (!newUrl.equals(oldUrl))
			commandLine += newUrl + " ";

		notificationHandler.logCommandLine(commandLine);
		notificationHandler.setBaseDir();
		svnClient.diff(oldUrl.toString(),
				JhlConverter.convert(oldUrlRevision), newUrl.toString(),
				JhlConverter.convert(newUrlRevision), null, svnOutFile,
				Depth.infinityOrEmpty(recurse), null, ignoreAncestry,
				noDiffDeleted, force, false);
	} catch (ClientException e) {
		notificationHandler.logException(e);
		throw new SVNClientException(e);
	}
}