All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tmatesoft.svn.core.SVNCommitInfo Maven / Gradle / Ivy

Go to download

The only pure Java Subversion library in the world, formerly known as JavaSVN

The newest version!
/*
 * ====================================================================
 * Copyright (c) 2004-2006 TMate Software Ltd.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://svnkit.com/license.html
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 * ====================================================================
 */

package org.tmatesoft.svn.core;

import java.util.Date;


/**
 * The SVNCommitInfo class represents information about a committed 
 * revision. Commit information includes:
 * 
    *
  1. a revision number; *
  2. a datestamp when the revision was committed; *
  3. the name of the revision author. *
* In addition, this class provides anexception that, if a commit has failed, * has got a description of a failure reason. * * @version 1.1.0 * @author TMate Software Ltd. */ public class SVNCommitInfo { /** * Denotes an unsuccessful commit. */ public static final SVNCommitInfo NULL = new SVNCommitInfo(-1, null, null, null); private long myNewRevision; private Date myDate; private String myAuthor; private SVNErrorMessage myErrorMessage; /** * * Constructs an SVNCommitInfo object. * * @param revision a revision number * @param author the name of the author who committed the revision * @param date the datestamp when the revision was committed */ public SVNCommitInfo(long revision, String author, Date date) { this(revision, author, date, null); } /** * Constructs an SVNCommitInfo object. * * @param revision a revision number * @param author the name of the author who committed the revision * @param date the datestamp when the revision was committed * @param error if a commit failed - this is an error description * containing details on the failure */ public SVNCommitInfo(long revision, String author, Date date, SVNErrorMessage error) { myNewRevision = revision; myAuthor = author; myDate = date; myErrorMessage = error; } /** * Gets the revision number the repository was committed to. * * @return a revision number */ public long getNewRevision() { return myNewRevision; } /** * Gets the name of the revision author * * @return a revision author's name */ public String getAuthor() { return myAuthor; } /** * Gets the datestamp when the revision was committed. * * @return a revision datestamp */ public Date getDate() { return myDate; } /** * Gets an error message for a failed commit (if it * has failed). This message will usually keep the entire * stack trace of all the error messages as of results of errors * occurred. * * @return an error messages or null. */ public SVNErrorMessage getErrorMessage() { return myErrorMessage; } /** * @deprecated use {@link #getErrorMessage() } instead */ public SVNException getError() { if (myErrorMessage != null) { return new SVNException(getErrorMessage()); } return null; } /** * Gives a string representation of this object. * * @return a string describing commit info */ public String toString() { if (this == NULL) { return "EMPTY COMMIT"; } else if (myErrorMessage == null) { StringBuffer sb = new StringBuffer(); sb.append("r"); sb.append(myNewRevision); if (myAuthor != null) { sb.append(" by '"); sb.append(myAuthor); sb.append("'"); } if (myDate != null) { sb.append(" at "); sb.append(myDate); } return sb.toString(); } else { return myErrorMessage.getFullMessage(); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy