Reformated project's code
@ -11,7 +11,7 @@ fun Date.toSmartSystemString(): String {
|
||||
val sdf = DateFormat.getDateInstance(DateFormat.MEDIUM, locale)
|
||||
|
||||
val zoneId = ZoneId.systemDefault()
|
||||
val localDate = this.toInstant().atZone(zoneId).toLocalDate();
|
||||
val localDate = this.toInstant().atZone(zoneId).toLocalDate()
|
||||
val currentTime = LocalDate.now(zoneId)
|
||||
|
||||
var result = sdf.format(this)
|
||||
|
@ -4,6 +4,7 @@ import org.eclipse.jgit.lib.Constants
|
||||
import org.eclipse.jgit.lib.ObjectIdRef
|
||||
import org.eclipse.jgit.lib.Ref
|
||||
|
||||
// Remotes can have slashes in the name, but we won't care about it, known issue
|
||||
private const val REMOTE_PREFIX_LENGTH = 3
|
||||
private const val LOCAL_PREFIX_LENGTH = 2
|
||||
|
||||
@ -54,7 +55,6 @@ val Ref.isLocal: Boolean
|
||||
val Ref.isRemote: Boolean
|
||||
get() = this.name.startsWith(Constants.R_REMOTES)
|
||||
|
||||
|
||||
fun Ref.isSameBranch(otherRef: Ref?): Boolean {
|
||||
if (this.name == Constants.HEAD && otherRef == null)
|
||||
return true
|
||||
|
@ -25,7 +25,7 @@ class BranchesManager @Inject constructor() {
|
||||
it.name == branchName
|
||||
}
|
||||
|
||||
if(branchFound == null) {
|
||||
if (branchFound == null) {
|
||||
branchFound = branchList.firstOrNull {
|
||||
it.objectId.name == branchName // Try to get the HEAD
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class LogManager @Inject constructor(
|
||||
val log = git.log().setMaxCount(1).call()
|
||||
val latestCommitNode = log.firstOrNull()
|
||||
|
||||
return@withContext if(latestCommitNode == null)
|
||||
return@withContext if (latestCommitNode == null)
|
||||
""
|
||||
else
|
||||
latestCommitNode.fullMessage
|
||||
|
@ -15,7 +15,6 @@ import org.eclipse.jgit.treewalk.WorkingTreeIterator
|
||||
import org.eclipse.jgit.util.LfsFactory
|
||||
import java.io.FileOutputStream
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.absolutePathString
|
||||
import kotlin.io.path.createTempFile
|
||||
|
||||
|
||||
@ -105,7 +104,7 @@ sealed class EntryContent {
|
||||
object Missing : EntryContent()
|
||||
object InvalidObjectBlob : EntryContent()
|
||||
data class Text(val rawText: RawText) : EntryContent()
|
||||
sealed class BinaryContent() : EntryContent()
|
||||
sealed class BinaryContent : EntryContent()
|
||||
data class ImageBinary(val tempFilePath: Path) : BinaryContent()
|
||||
object Binary : BinaryContent()
|
||||
object TooLargeEntry : EntryContent()
|
||||
|
@ -36,8 +36,8 @@ class RemoteOperationsManager @Inject constructor(
|
||||
if (!pullResult.isSuccessful) {
|
||||
var message = "Pull failed"
|
||||
|
||||
if(rebase) {
|
||||
message = when(pullResult.rebaseResult.status) {
|
||||
if (rebase) {
|
||||
message = when (pullResult.rebaseResult.status) {
|
||||
RebaseResult.Status.UNCOMMITTED_CHANGES -> "The pull with rebase has failed because you have got uncommited changes"
|
||||
RebaseResult.Status.CONFLICTS -> "Pull with rebase has conflicts, fix them to continue"
|
||||
else -> message
|
||||
|
@ -321,7 +321,7 @@ class StatusManager @Inject constructor(
|
||||
|
||||
val addedEntries = diffEntries.filter { it.changeType == DiffEntry.ChangeType.ADD }
|
||||
|
||||
if(addedEntries.isNotEmpty()) {
|
||||
if (addedEntries.isNotEmpty()) {
|
||||
val addCommand = git
|
||||
.add()
|
||||
|
||||
|
@ -14,7 +14,6 @@ import app.extensions.simpleName
|
||||
import app.ui.components.SideMenuPanel
|
||||
import app.ui.components.SideMenuSubentry
|
||||
import app.ui.context_menu.branchContextMenuItems
|
||||
import app.ui.context_menu.remoteContextMenu
|
||||
import app.ui.dialogs.MergeDialog
|
||||
import app.ui.dialogs.RebaseDialog
|
||||
import app.viewmodels.BranchesViewModel
|
||||
|
@ -11,8 +11,6 @@ import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.IconButton
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
|
@ -42,7 +42,7 @@ fun Stashes(
|
||||
},
|
||||
onDelete = {
|
||||
stashesViewModel.deleteStash(stash)
|
||||
},
|
||||
},
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.RectangleShape
|
||||
import androidx.compose.ui.graphics.Shape
|
||||
import androidx.compose.ui.input.key.Key
|
||||
import androidx.compose.ui.input.key.isCtrlPressed
|
||||
|
@ -1,7 +1,6 @@
|
||||
package app.ui.components
|
||||
|
||||
import androidx.compose.foundation.LocalScrollbarStyle
|
||||
import androidx.compose.foundation.ScrollbarStyle
|
||||
import androidx.compose.foundation.VerticalScrollbar
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
@ -15,7 +14,6 @@ import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.theme.scrollbarHover
|
||||
import app.theme.scrollbarUnhover
|
||||
|
@ -2,14 +2,15 @@ package app.ui.components
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.hoverable
|
||||
import androidx.compose.foundation.interaction.HoverInteraction
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.interaction.collectIsHoveredAsState
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
@ -60,7 +61,7 @@ fun SideMenuEntry(
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
|
||||
if(hoverIcon != null && isHovered) {
|
||||
if (hoverIcon != null && isHovered) {
|
||||
hoverIcon()
|
||||
} else
|
||||
Text(
|
||||
|
@ -1,7 +1,5 @@
|
||||
package app.ui.context_menu
|
||||
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
|
||||
data class DropDownContentData(
|
||||
val label: String,
|
||||
val icon: String? = null,
|
||||
|
@ -14,7 +14,8 @@ fun logContextMenu(
|
||||
) = listOf(
|
||||
ContextMenuItem(
|
||||
label = "Checkout commit",
|
||||
onClick = onCheckoutCommit),
|
||||
onClick = onCheckoutCommit
|
||||
),
|
||||
ContextMenuItem(
|
||||
label = "Create branch",
|
||||
onClick = onCreateNewBranch
|
||||
|
@ -17,9 +17,9 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.theme.borderColor
|
||||
import app.theme.primaryTextColor
|
||||
import app.theme.secondaryTextColor
|
||||
import app.theme.borderColor
|
||||
import app.viewmodels.RemotesViewModel
|
||||
import org.eclipse.jgit.transport.RemoteConfig
|
||||
|
||||
@ -115,7 +115,7 @@ fun EditRemotesDialog(
|
||||
modifier = Modifier.weight(1f)
|
||||
) {
|
||||
items(remotesEditorData.listRemotes) { remote ->
|
||||
val background = if(remote == selectedRemote) {
|
||||
val background = if (remote == selectedRemote) {
|
||||
MaterialTheme.colors.background
|
||||
} else
|
||||
MaterialTheme.colors.surface
|
||||
|
@ -123,10 +123,10 @@ class LogViewModel @Inject constructor(
|
||||
|
||||
val previousLogStatusValue = _logStatus.value
|
||||
|
||||
if(previousLogStatusValue is LogStatus.Loaded) {
|
||||
if (previousLogStatusValue is LogStatus.Loaded) {
|
||||
val newLogStatusValue = LogStatus.Loaded(
|
||||
hasUncommitedChanges = hasUncommitedChanges,
|
||||
plotCommitList = previousLogStatusValue.plotCommitList,
|
||||
plotCommitList = previousLogStatusValue.plotCommitList,
|
||||
currentBranch = currentBranch,
|
||||
statusSummary = statsSummary,
|
||||
)
|
||||
|
@ -53,7 +53,7 @@ class MenuViewModel @Inject constructor(
|
||||
|
||||
fun refresh() = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
){
|
||||
) {
|
||||
// Nothing to do here
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import kotlinx.coroutines.withContext
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.api.RemoteSetUrlCommand
|
||||
import org.eclipse.jgit.lib.Ref
|
||||
import org.eclipse.jgit.transport.URIish
|
||||
import javax.inject.Inject
|
||||
|
||||
class RemotesViewModel @Inject constructor(
|
||||
@ -68,7 +67,7 @@ class RemotesViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
fun deleteRemote(remoteName: String, isNew: Boolean) = tabState.safeProcessing(
|
||||
refreshType = if(isNew) RefreshType.REMOTES else RefreshType.ALL_DATA,
|
||||
refreshType = if (isNew) RefreshType.REMOTES else RefreshType.ALL_DATA,
|
||||
showError = true,
|
||||
) { git ->
|
||||
remotesManager.deleteRemote(git, remoteName)
|
||||
@ -88,11 +87,11 @@ class RemotesViewModel @Inject constructor(
|
||||
refreshType = RefreshType.REMOTES,
|
||||
showError = true,
|
||||
) { git ->
|
||||
if(selectedRemoteConfig.fetchUri.isBlank()) {
|
||||
if (selectedRemoteConfig.fetchUri.isBlank()) {
|
||||
throw InvalidRemoteUrlException("Invalid empty fetch URI")
|
||||
}
|
||||
|
||||
if(selectedRemoteConfig.pushUri.isBlank()) {
|
||||
if (selectedRemoteConfig.pushUri.isBlank()) {
|
||||
throw InvalidRemoteUrlException("Invalid empty push URI")
|
||||
}
|
||||
|
||||
@ -101,16 +100,16 @@ class RemotesViewModel @Inject constructor(
|
||||
updateRemote(selectedRemoteConfig) // Sets both, fetch and push uri
|
||||
}
|
||||
|
||||
fun updateRemote(selectedRemoteConfig: RemoteWrapper) = tabState.runOperation(
|
||||
fun updateRemote(selectedRemoteConfig: RemoteWrapper) = tabState.runOperation(
|
||||
refreshType = RefreshType.REMOTES,
|
||||
showError = true,
|
||||
) { git ->
|
||||
|
||||
if(selectedRemoteConfig.fetchUri.isBlank()) {
|
||||
if (selectedRemoteConfig.fetchUri.isBlank()) {
|
||||
throw InvalidRemoteUrlException("Invalid empty fetch URI")
|
||||
}
|
||||
|
||||
if(selectedRemoteConfig.pushUri.isBlank()) {
|
||||
if (selectedRemoteConfig.pushUri.isBlank()) {
|
||||
throw InvalidRemoteUrlException("Invalid empty push URI")
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ class StatusViewModel @Inject constructor(
|
||||
fun commit(message: String, amend: Boolean) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
val commitMessage = if(amend && message.isBlank()) {
|
||||
val commitMessage = if (amend && message.isBlank()) {
|
||||
logManager.latestMessage(git)
|
||||
} else
|
||||
message
|
||||
|
@ -1 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 203 B |
@ -1 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 313 B |
@ -1 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 370 B |
@ -1 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 13H5v-2h14v2z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M19 13H5v-2h14v2z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 185 B |