Class Revision
- All Implemented Interfaces:
Comparable<Revision>
Commit
.
A revision number is an integer which refers to a specific point of repository history.
When a repository is created, it starts with an initial commit whose revision is 1
.
As new commits are added, each commit gets its own revision number, monotonically increasing from the
previous commit's revision. i.e. 1, 2, 3, ...
A revision number can also be represented as a negative integer. When a revision number is negative,
we start from -1
which refers to the latest commit in repository history, which is often called
'HEAD' of the repository. A smaller revision number refers to the older commit. e.g. -2 refers to the
commit before the latest commit, and so on.
A revision with a negative integer is called 'relative revision'. By contrast, a revision with a positive integer is called 'absolute revision'.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbackward
(int count) int
boolean
forward
(int count) int
hashCode()
boolean
Returns whether thisRevision
is relative.int
major()
Returns the revision number.int
minor()
Deprecated.Do not use.boolean
Deprecated.Do not use.text()
Returns the textual representation of the revision. e.g.toString()
-
Field Details
-
HEAD
Revision-1
, also known as 'HEAD'. -
INIT
Revision1
, also known as 'INIT'.
-
-
Constructor Details
-
Revision
public Revision(int major) Creates a new instance with the specified revision number. -
Revision
Deprecated.UseRevision(int)
instead. Minor revisions are not used anymore.Creates a new instance. -
Revision
Create a new instance from a string representation. e.g."42", "-1"
-
-
Method Details
-
major
public int major()Returns the revision number. -
minor
Deprecated.Do not use. Minor revisions are not used anymore.Returns0
. -
text
Returns the textual representation of the revision. e.g."42", "-1"
. -
onMainLane
Deprecated.Do not use. Minor revisions are not used anymore.Returnstrue
. -
backward
- Parameters:
count
- the number of commits to go backward
-
forward
- Parameters:
count
- the number of commits to go forward
-
hashCode
public int hashCode() -
equals
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Revision>
-
isRelative
public boolean isRelative()Returns whether thisRevision
is relative.
-
Revision(int)
instead.