diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index 86c8cbb97ac1..ebb20d291a7b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -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, diff --git a/plugins/settings-repository/lib/jgit-sources.jar b/plugins/settings-repository/lib/jgit-sources.jar index 41fa537ab271..9083f1cb5096 100644 Binary files a/plugins/settings-repository/lib/jgit-sources.jar and b/plugins/settings-repository/lib/jgit-sources.jar differ diff --git a/plugins/settings-repository/lib/jgit.jar b/plugins/settings-repository/lib/jgit.jar index 7ce335b92686..816ba0511da6 100644 Binary files a/plugins/settings-repository/lib/jgit.jar and b/plugins/settings-repository/lib/jgit.jar differ diff --git a/plugins/settings-repository/settings-repository.iml b/plugins/settings-repository/settings-repository.iml index d8735e076bba..fb5e91f4f794 100644 --- a/plugins/settings-repository/settings-repository.iml +++ b/plugins/settings-repository/settings-repository.iml @@ -1,6 +1,6 @@ - + diff --git a/plugins/settings-repository/src/actions/CommitToIcsAction.kt b/plugins/settings-repository/src/actions/CommitToIcsAction.kt index 795d7662f27b..04b22d792592 100644 --- a/plugins/settings-repository/src/actions/CommitToIcsAction.kt +++ b/plugins/settings-repository/src/actions/CommitToIcsAction.kt @@ -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, project: Project) = roots as Array + override fun prepareRootsForCommit(roots: Array, project: Project) = roots override fun performCheckIn(context: VcsContext, project: Project, roots: Array) { - 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()) { diff --git a/plugins/settings-repository/src/git/GitEx.kt b/plugins/settings-repository/src/git/GitEx.kt index ba00fc954bd8..f62e344381ea 100644 --- a/plugins/settings-repository/src/git/GitEx.kt +++ b/plugins/settings-repository/src/git/GitEx.kt @@ -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 -} \ No newline at end of file +} + +inline fun 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() + } + } +} diff --git a/plugins/settings-repository/src/git/GitRepositoryManager.kt b/plugins/settings-repository/src/git/GitRepositoryManager.kt index 510443aac713..e76ab13f894b 100644 --- a/plugins/settings-repository/src/git/GitRepositoryManager.kt +++ b/plugins/settings-repository/src/git/GitRepositoryManager.kt @@ -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