org.tmatesoft.svn.core.wc
Class SVNRevision
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.
static SVNRevision | BASE- Denotes the 'pristine' revision of a Working Copy item.
|
static SVNRevision | COMMITTED- Denotes the last revision in which an item was changed before (or
at) BASE.
|
static SVNRevision | HEAD- Denotes the latest repository revision.
|
static SVNRevision | PREVIOUS- Denotes the revision just before the one when an item was last
changed (technically, COMMITTED - 1).
|
static SVNRevision | UNDEFINED- Used to denote that a revision is undefined (not available or not
valid).
|
static SVNRevision | WORKING- Denotes an item's working (current) revision.
|
static SVNRevision | create(Date date)- Creates an SVNRevision object given a particular timestamp.
|
static SVNRevision | create(long revisionNumber)- Creates an SVNRevision object given a revision number.
|
boolean | equals(Object o)- Compares this object with another SVNRevision object.
|
Date | getDate()- Gets the timestamp used to specify a revision.
|
int | getID()- Gets the identifier of the revision information kind this
object represents.
|
String | getName()- Gets the revision keyword name.
|
long | getNumber()- Gets the revision number represented by this object.
|
int | hashCode()- Evaluates the hash code for this object.
|
boolean | isLocal()- Determines if the revision represented by this abstract object is
Working Copy specific - that is one of
BASE or WORKING.
|
boolean | isValid()- Checks if the revision information represented by this object
is valid.
|
static boolean | isValidRevisionNumber(long revision)- Checks whether a revision number is valid.
|
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.
|
String | toString()- Gives a string representation of this object.
|
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.
PREVIOUS
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).
create
public static SVNRevision create(Date date)
Creates an SVNRevision object given a particular timestamp.
date - a timestamp represented as a Date instance
- the constructed SVNRevision object
create
public static SVNRevision create(long revisionNumber)
Creates an SVNRevision object given a revision number.
revisionNumber - a definite revision number
- the constructed SVNRevision object
equals
public boolean equals(Object o)
Compares this object with another SVNRevision object.
o - an object to be compared with; if it's not an
SVNRevision then this method certainly returns
false
- true if equal, otherwise
false
getDate
public Date getDate()
Gets the timestamp used to specify a revision.
- a timestamp if any specified for this object
getID
public int getID()
Gets the identifier of the revision information kind this
object represents.
getName
public String getName()
Gets the revision keyword name. Each of SVNRevision's
constant fields that represent revision keywords also have
its own name.
getNumber
public long getNumber()
Gets the revision number represented by this object.
- 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:
- if this object represents revision info as a revision number
then
hash code = (int) revisionNumber & 0xFFFFFFFF;
- if this object represents revision info as a timestamp then
Date.hashCode() is used;
- if this object represents revision info as a keyword
then
String.hashCode() is used for the keyword name;
isLocal
public boolean isLocal()
Determines if the revision represented by this abstract object is
Working Copy specific - that is one of
BASE or
WORKING.
- 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.
- true if valid, otherwise
false
isValidRevisionNumber
public static boolean isValidRevisionNumber(long revision)
Checks whether a revision number is valid.
revision - a revision number
- 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.
value - a string to be parsed
- 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.
- a string representing this object
Copyright © 2004-2006 TMate Software Ltd. All Rights Reserved.