Package org.tmatesoft.svn.core.wc
Class SVNRevision
java.lang.Object
org.tmatesoft.svn.core.wc.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.
- Since:
- 1.2
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SVNRevision
Denotes the 'pristine' revision of a Working Copy item.static final SVNRevision
Denotes the last revision in which an item was changed before (or at) BASE.static final SVNRevision
Denotes the latest repository revision.private static Pattern
private static Pattern
private static Pattern
private static Pattern
private static Pattern
private static Pattern
private static Pattern
private Date
private int
private String
private long
private static final Collection
private static final Map
static final SVNRevision
Denotes the revision just before the one when an item was last changed (technically, COMMITTED - 1).private static Pattern
private static Pattern
static final SVNRevision
Used to denote that a revision is undefined (not available or not valid).static final SVNRevision
Denotes an item's working (current) revision. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
SVNRevision
(long number) private
SVNRevision
(String name, int id) private
SVNRevision
(Date date) -
Method Summary
Modifier and TypeMethodDescriptionstatic SVNRevision
create
(long revisionNumber) Creates an SVNRevision object given a revision number.static SVNRevision
Creates an SVNRevision object given a particular timestamp.boolean
Compares this object with another SVNRevision object.getDate()
Gets the timestamp used to specify a revision.int
getID()
Gets the identifier of the revision information kind this object represents.getName()
Gets the revision keyword name.long
Gets the revision number represented by this object.int
hashCode()
Evaluates the hash code for this object.boolean
isLocal()
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
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.toString()
Gives a string representation of this object.
-
Field Details
-
HEAD
Denotes the latest repository revision. SVN's analogue keyword: HEAD. -
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). -
PREVIOUS
Denotes the revision just before the one when an item was last changed (technically, COMMITTED - 1). SVN's analogue keyword: PREV. -
BASE
Denotes the 'pristine' revision of a Working Copy item. SVN's analogue keyword: BASE. -
COMMITTED
Denotes the last revision in which an item was changed before (or at) BASE. SVN's analogue keyword: COMMITTED. -
UNDEFINED
Used to denote that a revision is undefined (not available or not valid). -
ourValidRevisions
-
ISO_8601_EXTENDED_DATE_ONLY_PATTERN
-
ISO_8601_EXTENDED_UTC_PATTERN
-
ISO_8601_EXTENDED_OFFSET_PATTERN
-
ISO_8601_BASIC_DATE_ONLY_PATTERN
-
ISO_8601_BASIC_UTC_PATTERN
-
ISO_8601_BASIC_OFFSET_PATTERN
-
ISO_8601_GNU_FORMAT_PATTERN
-
SVN_LOG_DATE_FORMAT_PATTERN
-
TIME_ONLY_PATTERN
-
ourTimeFormatPatterns
-
myRevision
private long myRevision -
myName
-
myDate
-
myID
private int myID
-
-
Constructor Details
-
SVNRevision
private SVNRevision(long number) -
SVNRevision
-
SVNRevision
-
-
Method Details
-
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.
-
getDate
Gets the timestamp used to specify a revision.- Returns:
- a timestamp if any specified for this object
-
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
-
getID
public int getID()Gets the identifier of the revision information kind this object represents.- Returns:
- this object's id
-
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;
- if this object represents revision info as a revision number
then
-
equals
Compares this object with another SVNRevision object. -
isValidRevisionNumber
public static boolean isValidRevisionNumber(long revision) Checks whether a revision number is valid.- Parameters:
revision
- a revision number- Returns:
- true if valid (
>=0
), otherwise false
-
create
Creates an SVNRevision object given a revision number.- Parameters:
revisionNumber
- a definite revision number- Returns:
- the constructed SVNRevision object
-
create
Creates an SVNRevision object given a particular timestamp.- Parameters:
date
- a timestamp represented as a Date instance- Returns:
- the constructed SVNRevision object
-
isLocal
public boolean isLocal()Determines if the revision represented by this abstract object is Working Copy specific - that is one ofBASE
orWORKING
.- Returns:
- true if this object represents a kind of a local revision, otherwise false
-
parse
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 isUNDEFINED
-
toString
Gives a string representation of this object.
-