org.tmatesoft.svn.core.wc

Class SVNRevision

public class SVNRevision extends Object

SVNRevision is a revision wrapper used for an abstract representation of revision information.

Most of high-level API classes' methods receive revision parameters as SVNRevision objects to get information on SVN revisions and use it in version control operations.

This class provides advantages of specifying revisions either as just long numbers or dated revisions (when a revision is determined according to a particular timestamp) or SVN compatible keywords denoting the latest revision (HEAD), Working Copy pristine revision (BASE) and so on. And one more feature is that SVNRevision can parse strings (that can be anything: string representations of numbers, dates, keywords) to construct an SVNRevision to use.

Version: 1.1.1

Author: TMate Software Ltd.

Field Summary
static SVNRevisionBASE
Denotes the 'pristine' revision of a Working Copy item.
static SVNRevisionCOMMITTED
Denotes the last revision in which an item was changed before (or at) BASE.
static SVNRevisionHEAD
Denotes the latest repository revision.
static SVNRevisionPREVIOUS
Denotes the revision just before the one when an item was last changed (technically, COMMITTED - 1).
static SVNRevisionUNDEFINED
Used to denote that a revision is undefined (not available or not valid).
static SVNRevisionWORKING
Denotes an item's working (current) revision.
Method Summary
static SVNRevisioncreate(long revisionNumber)
Creates an SVNRevision object given a revision number.
static SVNRevisioncreate(Date date)
Creates an SVNRevision object given a particular timestamp.
booleanequals(Object o)
Compares this object with another SVNRevision object.
DategetDate()
Gets the timestamp used to specify a revision.
intgetID()
Gets the identifier of the revision information kind this object represents.
StringgetName()
Gets the revision keyword name.
longgetNumber()
Gets the revision number represented by this object.
inthashCode()
Evaluates the hash code for this object.
booleanisLocal()
Determines if the revision represented by this abstract object is Working Copy specific - that is one of BASE or WORKING.
booleanisValid()
Checks if the revision information represented by this object is valid.
static booleanisValidRevisionNumber(long revision)
Checks whether a revision number is valid.
static SVNRevisionparse(String value)
Parses an input string and be it a representation of either a revision number, or a timestamp, or a revision keyword, constructs an SVNRevision representation of the revision.
StringtoString()
Gives a string representation of this object.

Field Detail

BASE

public static final SVNRevision BASE
Denotes the 'pristine' revision of a Working Copy item. SVN's analogue keyword: BASE.

COMMITTED

public static final SVNRevision COMMITTED
Denotes the last revision in which an item was changed before (or at) BASE. SVN's analogue keyword: COMMITTED.

HEAD

public static final SVNRevision HEAD
Denotes the latest repository revision. SVN's analogue keyword: HEAD.

public static final SVNRevision PREVIOUS
Denotes the revision just before the one when an item was last changed (technically, COMMITTED - 1). SVN's analogue keyword: PREV.

UNDEFINED

public static final SVNRevision UNDEFINED
Used to denote that a revision is undefined (not available or not valid).

WORKING

public static final SVNRevision WORKING
Denotes an item's working (current) revision. This is a SVNKit constant that should be provided to mean working revisions (what the native SVN client assumes by default).

Method Detail

create

public static SVNRevision create(long revisionNumber)
Creates an SVNRevision object given a revision number.

Parameters: revisionNumber a definite revision number

Returns: the constructed SVNRevision object

create

public static SVNRevision create(Date date)
Creates an SVNRevision object given a particular timestamp.

Parameters: date a timestamp represented as a Date instance

Returns: the constructed SVNRevision object

equals

public boolean equals(Object o)
Compares this object with another SVNRevision object.

Parameters: o an object to be compared with; if it's not an SVNRevision then this method certainly returns false

Returns: true if equal, otherwise false

getDate

public Date getDate()
Gets the timestamp used to specify a revision.

Returns: a timestamp if any specified for this object

getID

public int getID()
Gets the identifier of the revision information kind this object represents.

Returns: this object's id

getName

public String getName()
Gets the revision keyword name. Each of SVNRevision's constant fields that represent revision keywords also have its own name.

Returns: a revision keyword name

getNumber

public long getNumber()
Gets the revision number represented by this object.

Returns: a revision number; -1 is returned when this object represents a revision information not using a revision number.

hashCode

public int hashCode()
Evaluates the hash code for this object. A hash code is evaluated in this way:

Returns: this object's hash code

isLocal

public boolean isLocal()
Determines if the revision represented by this abstract object is Working Copy specific - that is one of BASE or WORKING.

Returns: true if this object represents a kind of a local revision, otherwise false

isValid

public boolean isValid()
Checks if the revision information represented by this object is valid.

UNDEFINED is not a valid revision.

Returns: true if valid, otherwise false

isValidRevisionNumber

public static boolean isValidRevisionNumber(long revision)
Checks whether a revision number is valid.

Parameters: revision a revision number

Returns: true if valid, otherwise false

parse

public static SVNRevision parse(String value)
Parses an input string and be it a representation of either a revision number, or a timestamp, or a revision keyword, constructs an SVNRevision representation of the revision.

Parameters: value a string to be parsed

Returns: an SVNRevision object that holds the revision information parsed from value; however if an input string is not a valid one which can be successfully transformed to an SVNRevision the return value is UNDEFINED

toString

public String toString()
Gives a string representation of this object.

Returns: a string representing this object

Copyright © 2004-2007 TMate Software Ltd. All Rights Reserved.