Class RepoState
java.lang.Object
io.github.jbastgen.stemma.app.model.RepoState
State of one open repository as the views see it. Real repositories are filled from the Git backend
(
SnapshotMapper) and changed only through it; the mutating methods below belong to the sample (demo)
repositories, which live in memory.-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe commit a Shift-click extends the selection from.intThe commit HEAD points to when it is on no branch; empty otherwise.final Map<String, CommitDetail> Message body and changed files per commit id, loaded on demand (real repositories only).Diff lines per<commit id or "wip">:<path>, loaded on demand (real repositories only).Paths of the selected working-tree files; useselectedFiles()for the ones that are still there.intWhat the last load looked like in short (changed files, branches, HEAD): a cheap check whether anything changed.booleanGit Flow is set up (production and development branch exist).Identifies the repository in the label index (its first commit); empty until known or without commits.Keys of loads that are running, so each is started once.booleanA merge is in progress: conflicts wait to be resolved, then committed (real repositories only).final LinkedHashSet<String> Labels (ids) chosen in the commit form for the next commit.booleantrueif loaded from a real repository,falsefor sample data.booleanA rebase waits for conflicts to be resolved (real repositories only).The tags thattagsRemotehad when it was asked, kept up to date by the pushes of this window; null = unknown.The URL of each remote by its name (whatgit remote -vshows).Selected commit id, or "wip" for the uncommitted changes row.final LinkedHashSet<String> All selected commit ids when the user selected several (Ctrl/Cmd-click, Shift-click).io.github.jbastgen.stemma.git.api.SequenceKindA cherry-pick or a revert waits for conflicts to be resolved (real repositories only).The remote whose tags were last asked for; empty = never asked.The branch the message template was last put into the commit form for;null= not yet.intNumber of commits the Git backend returned (real repositories only).Upstream branch of the current branch, e.g. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDemo repositories only: adds a commit on the current branch.branchCommit(String name) The commit a local branch points to.The commit with this id, ornull.intCommits the staged files (or all if none is staged).booleancreateBranch(String name, String atId, boolean checkout) voiddiscard()Demo repositories only: throws the working tree changes away.firstParentChain(Commit target) The commits from HEAD down to and includingtarget, newest first, if they follow each other as first parents and none is a merge commit; empty otherwise.booleanWhether the working tree row is selected and has something to show.The commit HEAD is on: that of the current branch, or the detached one.booleanisSelected(String commitId) Whether the commit is part of the selection.booleanCreates a merge commit ofnameintointo(default: current branch).booleanWhether more than one commit is selected.The commits that the upstream branch has and the current branch has not (what a forced push would overwrite), newest first.voidpopStash(int index) Demo repositories only: brings a stash back into the working tree.intpush()Moves theorigin/<head>marker to the head commit.remoteBranchCommit(String remote, String branch) The latest commit of a branch of a remote (branchwithout the remote's name), if it is in the loaded history.voidselectCommit(String id, List<String> visibleOrder, boolean toggle, boolean range) A click on a commit row.The selected commits, newest first: several if the user selected several, one otherwise, none for the working tree.The selected files that are in the working tree list, in the order of the list.voidselectFile(String path, List<String> order, boolean toggle, boolean range) A click on a file of the working tree list.voidThe row of the uncommitted changes: a plain selection of it.booleanWhether a cherry-pick or revert is waiting for its conflicts.voidsetAllStaged(boolean staged) Stages every file of the working tree, or unstages them all.voidsetStaged(Collection<String> paths, boolean staged) Stages or unstages these files.squashChain(Commit target) The commits from HEAD down to and includingtarget, newest first, if they can be squashed into one: they follow each other as first parents and none of them is a merge commit.voidstash()Demo repositories only: puts the working tree changes on the stash.voidDemo repositories only: tags a commit.target()The commit that branch/tag actions apply to: the selection, or HEAD for the working tree.voidtoggleStaged(String path) Demo repositories only: stages or unstages a file.
-
Field Details
-
commits
-
wip
-
branches
-
remotes
-
remoteUrls
The URL of each remote by its name (whatgit remote -vshows). -
tags
-
stashes
-
head
-
ahead
public int ahead -
behind
public int behind -
sel
Selected commit id, or "wip" for the uncommitted changes row. With several commits selected: the one clicked last. -
selection
All selected commit ids when the user selected several (Ctrl/Cmd-click, Shift-click). Only counts while it containsseland has more than one entry, so settingselalone always means "this one". -
anchor
The commit a Shift-click extends the selection from. -
msg
-
desc
-
templateBranch
The branch the message template was last put into the commit form for;null= not yet. -
diff
-
real
public boolean realtrueif loaded from a real repository,falsefor sample data. -
totalCommits
public int totalCommitsNumber of commits the Git backend returned (real repositories only). -
mergeInProgress
public boolean mergeInProgressA merge is in progress: conflicts wait to be resolved, then committed (real repositories only). -
rebaseInProgress
public boolean rebaseInProgressA rebase waits for conflicts to be resolved (real repositories only). -
tagsRemote
The remote whose tags were last asked for; empty = never asked. -
remoteTagNames
The tags thattagsRemotehad when it was asked, kept up to date by the pushes of this window; null = unknown. -
sequence
public io.github.jbastgen.stemma.git.api.SequenceKind sequenceA cherry-pick or a revert waits for conflicts to be resolved (real repositories only). -
fingerprint
public int fingerprintWhat the last load looked like in short (changed files, branches, HEAD): a cheap check whether anything changed. -
labelRepoKey
Identifies the repository in the label index (its first commit); empty until known or without commits. -
pendingLabels
Labels (ids) chosen in the commit form for the next commit. -
detachedHeadId
The commit HEAD points to when it is on no branch; empty otherwise. -
upstream
Upstream branch of the current branch, e.g.origin/main; empty if there is none. -
flowReady
public boolean flowReadyGit Flow is set up (production and development branch exist). -
flowProduction
-
flowDevelopment
-
details
Message body and changed files per commit id, loaded on demand (real repositories only). -
diffs
Diff lines per<commit id or "wip">:<path>, loaded on demand (real repositories only). -
loading
Keys of loads that are running, so each is started once. -
fileSel
Paths of the selected working-tree files; useselectedFiles()for the ones that are still there.
-
-
Constructor Details
-
RepoState
public RepoState()
-
-
Method Details
-
sequenceInProgress
public boolean sequenceInProgress()Whether a cherry-pick or revert is waiting for its conflicts. -
branchCommit
The commit a local branch points to. -
remoteBranchCommit
The latest commit of a branch of a remote (branchwithout the remote's name), if it is in the loaded history. -
squashChain
The commits from HEAD down to and includingtarget, newest first, if they can be squashed into one: they follow each other as first parents and none of them is a merge commit. Empty otherwise, and for HEAD alone (one commit cannot be squashed). -
firstParentChain
The commits from HEAD down to and includingtarget, newest first, if they follow each other as first parents and none is a merge commit; empty otherwise. UnlikesquashChain(io.github.jbastgen.stemma.app.model.Commit)one commit is enough. -
onlyOnUpstream
The commits that the upstream branch has and the current branch has not (what a forced push would overwrite), newest first. Only those in the loaded history are found; empty when there is no upstream or its tip is not loaded. -
headCommit
The commit HEAD is on: that of the current branch, or the detached one. -
commit
The commit with this id, ornull. -
target
The commit that branch/tag actions apply to: the selection, or HEAD for the working tree. -
selectedCommits
The selected commits, newest first: several if the user selected several, one otherwise, none for the working tree. -
multiSelected
public boolean multiSelected()Whether more than one commit is selected. -
isSelected
Whether the commit is part of the selection. -
selectCommit
A click on a commit row.- Parameters:
visibleOrder- the ids of the rows as shown, top to bottom (for Shift-click ranges)toggle- Ctrl/Cmd was held: add the commit to the selection, or remove itrange- Shift was held: select everything between the anchor and this commit
-
selectWorkingTree
public void selectWorkingTree()The row of the uncommitted changes: a plain selection of it. -
hasWipSelected
public boolean hasWipSelected()Whether the working tree row is selected and has something to show. -
addCommit
Demo repositories only: adds a commit on the current branch. -
createBranch
- Returns:
- false if the branch already exists
-
merge
Creates a merge commit ofnameintointo(default: current branch). -
commitWip
Commits the staged files (or all if none is staged). @return number of committed files -
push
public int push()Moves theorigin/<head>marker to the head commit. @return number of pushed commits -
stash
public void stash()Demo repositories only: puts the working tree changes on the stash. -
discard
public void discard()Demo repositories only: throws the working tree changes away. -
popStash
public void popStash(int index) Demo repositories only: brings a stash back into the working tree. -
tag
Demo repositories only: tags a commit. -
toggleStaged
Demo repositories only: stages or unstages a file. -
setAllStaged
public void setAllStaged(boolean staged) Stages every file of the working tree, or unstages them all. -
setStaged
Stages or unstages these files. -
selectFile
A click on a file of the working tree list.- Parameters:
order- the paths as listed, top to bottom (for Shift-click ranges)toggle- Ctrl/Cmd was held: add the file to the selection, or remove itrange- Shift was held: select everything between the anchor and this file
-
selectedFiles
The selected files that are in the working tree list, in the order of the list.
-