mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
update jgit to 4.2, use original unmodified — we can use Java 8 now
cleanup
This commit is contained in:
@@ -36,7 +36,6 @@ import com.intellij.openapi.components.ServiceKt;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.components.impl.PlatformComponentManagerImpl;
|
||||
import com.intellij.openapi.components.impl.ServiceManagerImpl;
|
||||
import com.intellij.openapi.components.impl.stores.IComponentStore;
|
||||
import com.intellij.openapi.components.impl.stores.StoreUtil;
|
||||
import com.intellij.openapi.diagnostic.Attachment;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -166,12 +165,6 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public IComponentStore getStateStore() {
|
||||
return ServiceKt.getStateStore(this);
|
||||
}
|
||||
|
||||
public ApplicationImpl(boolean isInternal,
|
||||
boolean isUnitTestMode,
|
||||
boolean isHeadless,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module relativePaths="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -74,14 +74,10 @@ class CommitToIcsAction : CommonCheckinFilesAction() {
|
||||
return project is ProjectEx && (project.stateStore as IProjectStore).storageScheme == StorageScheme.DIRECTORY_BASED && super.isApplicableRoot(file, status, dataContext) && !file.isDirectory && isProjectConfigFile(file, dataContext.project!!)
|
||||
}
|
||||
|
||||
override fun prepareRootsForCommit(roots: Array<out FilePath>, project: Project) = roots as Array<FilePath>
|
||||
override fun prepareRootsForCommit(roots: Array<FilePath>, project: Project) = roots
|
||||
|
||||
override fun performCheckIn(context: VcsContext, project: Project, roots: Array<out FilePath>) {
|
||||
val projectId = getProjectId(project)
|
||||
if (projectId == null) {
|
||||
return
|
||||
}
|
||||
|
||||
val projectId = getProjectId(project) ?: return
|
||||
val changes = context.selectedChanges
|
||||
val collectConsumer = ProjectChangeCollectConsumer(project)
|
||||
if (changes != null && changes.isNotEmpty()) {
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.openapi.util.text.StringUtil
|
||||
import org.eclipse.jgit.api.CommitCommand
|
||||
import org.eclipse.jgit.api.ResetCommand
|
||||
import org.eclipse.jgit.dircache.DirCacheCheckout
|
||||
import org.eclipse.jgit.dircache.DirCacheEntry
|
||||
import org.eclipse.jgit.errors.TransportException
|
||||
import org.eclipse.jgit.internal.JGitText
|
||||
import org.eclipse.jgit.lib.*
|
||||
@@ -107,7 +106,7 @@ fun createRepository(dir: File): Repository {
|
||||
fun Repository.commit(message: String? = null, reflogComment: String? = null, author: PersonIdent? = null, committer: PersonIdent? = null): RevCommit {
|
||||
val commitCommand = CommitCommand(this).setAuthor(author).setCommitter(committer)
|
||||
if (message != null) {
|
||||
commitCommand.setMessage(message)
|
||||
commitCommand.message = message
|
||||
}
|
||||
if (reflogComment != null) {
|
||||
commitCommand.setReflogComment(reflogComment)
|
||||
@@ -322,17 +321,15 @@ private class InputStreamWrapper(private val delegate: InputStream, private val
|
||||
}
|
||||
}
|
||||
|
||||
fun ObjectReader.getCachedBytes(dirCacheEntry: DirCacheEntry) = open(dirCacheEntry.objectId, Constants.OBJ_BLOB).cachedBytes
|
||||
|
||||
fun Repository.getAheadCommitsCount(): Int {
|
||||
val config = config
|
||||
val shortBranchName = Repository.shortenRefName(config.getRemoteBranchFullName())
|
||||
val trackingBranch = BranchConfig(config, shortBranchName).trackingBranch ?: return -1
|
||||
val local = getRef("${Constants.R_HEADS}$shortBranchName") ?: return -1
|
||||
val local = exactRef("${Constants.R_HEADS}$shortBranchName") ?: return -1
|
||||
val walk = RevWalk(this)
|
||||
val localCommit = walk.parseCommit(local.objectId)
|
||||
|
||||
val trackingCommit = getRef(trackingBranch)?.let { walk.parseCommit(it.objectId) }
|
||||
val trackingCommit = findRef(trackingBranch)?.let { walk.parseCommit(it.objectId) }
|
||||
|
||||
walk.revFilter = RevFilter.MERGE_BASE
|
||||
if (trackingCommit == null) {
|
||||
@@ -356,4 +353,27 @@ fun Repository.getAheadCommitsCount(): Int {
|
||||
num++
|
||||
}
|
||||
return num
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T : AutoCloseable, R> T.use(block: (T) -> R): R {
|
||||
var closed = false
|
||||
try {
|
||||
return block(this)
|
||||
}
|
||||
catch (e: Exception) {
|
||||
closed = true
|
||||
try {
|
||||
close()
|
||||
}
|
||||
catch (closeException: Exception) {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
(e as java.lang.Throwable).addSuppressed(closeException)
|
||||
}
|
||||
throw e
|
||||
}
|
||||
finally {
|
||||
if (!closed) {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -166,7 +166,7 @@ class GitRepositoryManager(private val credentialsStore: NotNullLazyValue<Creden
|
||||
|
||||
val refSpecs = SmartList(RemoteConfig(repository.config, Constants.DEFAULT_REMOTE_NAME).pushRefSpecs)
|
||||
if (refSpecs.isEmpty()) {
|
||||
val head = repository.getRef(Constants.HEAD)
|
||||
val head = repository.findRef(Constants.HEAD)
|
||||
if (head != null && head.isSymbolic) {
|
||||
refSpecs.add(RefSpec(head.leaf.name))
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ open internal class Pull(val manager: GitRepositoryManager, val indicator: Progr
|
||||
commitMessage: String? = null): MergeResultEx {
|
||||
indicator?.checkCanceled()
|
||||
|
||||
val head = repository.getRef(Constants.HEAD) ?: throw NoHeadException(JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported)
|
||||
val head = repository.findRef(Constants.HEAD) ?: throw NoHeadException(JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported)
|
||||
|
||||
// handle annotated tags
|
||||
val ref = repository.peel(unpeeledRef)
|
||||
|
||||
@@ -55,7 +55,7 @@ internal class Reset(manager: GitRepositoryManager, indicator: ProgressIndicator
|
||||
val fetchRefSpecs = remoteConfig.fetchRefSpecs
|
||||
assert(fetchRefSpecs.size == 1)
|
||||
|
||||
val latestUpstreamCommit = repository.getRef(fetchRefSpecs[0].destination!!)
|
||||
val latestUpstreamCommit = repository.findRef(fetchRefSpecs[0].destination!!)
|
||||
if (latestUpstreamCommit == null) {
|
||||
if (toTheirs) {
|
||||
repository.deleteAllFiles(result.deleted)
|
||||
|
||||
Reference in New Issue
Block a user