Record Class VcsState
java.lang.Object
java.lang.Record
network.ike.plugin.ws.vcs.VcsState
- Record Components:
timestamp- UTC timestamp of the actionmachine- short hostname of the machine that performed the actionbranch- the branch name at the time of the actionsha- the 8-character short SHA at the time of the actionaction- the action performed (e.g.,VcsState.Action.COMMIT)
public record VcsState(String timestamp, String machine, String branch, String sha, VcsState.Action action)
extends Record
The VCS state file (
.ike/vcs-state) records the last VCS action
performed in a repository. Written by git hooks and plugin goals,
delivered between machines by Syncthing.
Format is a plain properties file — trivial to parse in both bash (grep/cut) and Java (Properties.load).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumActions written to the state file by hooks and plugin goals. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.branch()Returns the value of thebranchrecord component.static VcsStatecreate(String branch, String sha, VcsState.Action action) Create a VcsState with the current timestamp and local hostname.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static booleanisIkeManaged(Path dir) Check whether the.ike/directory exists in the given path, indicating the repo is IKE-managed.machine()Returns the value of themachinerecord component.Read the VCS state file from the given directory.sha()Returns the value of thesharecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.static voidWrite the VCS state file to the given directory.
-
Constructor Details
-
VcsState
public VcsState(String timestamp, String machine, String branch, String sha, VcsState.Action action) Creates an instance of aVcsStaterecord class.
-
-
Method Details
-
readFrom
-
writeTo
Write the VCS state file to the given directory.- Parameters:
dir- the repository root directory (must contain.ike/)state- the state to write- Throws:
IOException- if the file cannot be written
-
create
Create a VcsState with the current timestamp and local hostname.- Parameters:
branch- the current branch namesha- the current HEAD SHA (8-character short form)action- the action being performed- Returns:
- a new VcsState
-
isIkeManaged
Check whether the.ike/directory exists in the given path, indicating the repo is IKE-managed.- Parameters:
dir- the repository root directory- Returns:
- true if the repo has an
.ike/directory
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
timestamp
-
machine
-
branch
-
sha
-
action
-