dvcs: clarify branches sync settings enabled, introduce a pure "sync option enabled" method

GitOrigin-RevId: f8cb922d78e11229b82f08507828a5da59054e13
This commit is contained in:
Dmitry Zhuravlev
2025-02-04 14:14:54 +01:00
committed by intellij-monorepo-bot
parent 536f131b89
commit db8903b926
4 changed files with 16 additions and 32 deletions

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2011 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.dvcs.repo;
import com.intellij.openapi.vcs.AbstractVcs;
@@ -104,6 +90,12 @@ public interface RepositoryManager<T extends Repository> {
/**
* Returns true if repositories under this repository manager are controlled synchronously.
* <p/>
* <b>Note:</b>
* <p/>
* Implementation may return a state different from the actual value stored in "DvcsSyncSettings"
* To get only sync settings enabled,
* use "com.intellij.dvcs.MultiRootBranches#isSyncOptionEnabled(com.intellij.dvcs.branch.DvcsSyncSettings)"
*/
boolean isSyncEnabled();

View File

@@ -67,6 +67,7 @@ f:com.intellij.dvcs.MultiRootBranches
- sf:diverged(java.util.Collection):Z
- sf:getCommonCurrentBranch(java.util.Collection):java.lang.String
- sf:getCommonName(java.util.Collection,kotlin.jvm.functions.Function1):java.lang.String
- sf:isSyncOptionEnabled(com.intellij.dvcs.branch.DvcsSyncSettings):Z
f:com.intellij.dvcs.MultiRootMessage
- com.intellij.dvcs.MultiMessage
- <init>(com.intellij.openapi.project.Project,java.util.Collection,Z,Z):V

View File

@@ -1,7 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:JvmName("MultiRootBranches")
package com.intellij.dvcs
import com.intellij.dvcs.branch.DvcsSyncSettings
import com.intellij.dvcs.repo.Repository
fun <T> getCommonName(repositories: Collection<T>, nameSupplier: (T) -> String?): String? {
@@ -17,4 +18,6 @@ fun Collection<Repository>.getCommonCurrentBranch(): String? {
return getCommonName(this, Repository::getCurrentBranchName)
}
fun Collection<Repository>.diverged() = getCommonCurrentBranch() == null
fun Collection<Repository>.diverged() = getCommonCurrentBranch() == null
fun DvcsSyncSettings.isSyncOptionEnabled(): Boolean = getSyncSetting() == DvcsSyncSettings.Value.SYNC

View File

@@ -1,24 +1,12 @@
/*
* Copyright 2000-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.dvcs.branch;
import com.intellij.dvcs.MultiRootBranches;
import com.intellij.dvcs.repo.RepositoryManager;
import org.jetbrains.annotations.NotNull;
/**
* @see MultiRootBranches#isSyncOptionEnabled(DvcsSyncSettings)
* @see RepositoryManager#isSyncEnabled()
*/
public interface DvcsSyncSettings {