Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use git info only when Expand to Working Set is enabled #6944

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.idea.blaze.base.logging.utils.querysync.SyncQueryStats;
import com.google.idea.blaze.base.logging.utils.querysync.SyncQueryStatsScope;
import com.google.idea.blaze.base.scope.BlazeContext;
import com.google.idea.blaze.base.settings.BlazeUserSettings;
import com.google.idea.blaze.base.vcs.BlazeVcsHandlerProvider.BlazeVcsHandler;
import com.google.idea.blaze.common.vcs.VcsState;
import com.google.idea.blaze.exception.BuildException;
Expand Down Expand Up @@ -120,15 +121,17 @@ public PostQuerySyncData update(
ProjectDefinition currentProjectDef, PostQuerySyncData previousState, BlazeContext context)
throws IOException, BuildException {

Optional<VcsState> vcsState = getVcsState(context);
SyncQueryStatsScope.fromContext(context)
.ifPresent(stats -> stats.setSyncMode(SyncQueryStats.SyncMode.DELTA));
logger.info(
String.format(
"Starting partial query update; upstream rev=%s; snapshot path=%s",
vcsState.map(s -> s.upstreamRevision).orElse("<unknown>"),
vcsState.flatMap(s -> s.workspaceSnapshotPath).map(Object::toString).orElse("<none>")));

Optional<VcsState> vcsState = Optional.empty();
if (BlazeUserSettings.getInstance().getExpandSyncToWorkingSet()) {
Copy link
Contributor Author

@dkashyn-sfdc dkashyn-sfdc Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably other option should be added for QS yet even QS-relevant delta calculation will be taxing in some cases.

Also Sync to Working Set is enabled by default, iirc. So default QS behavior won't change.

vcsState = getVcsState(context);
SyncQueryStatsScope.fromContext(context)
.ifPresent(stats -> stats.setSyncMode(SyncQueryStats.SyncMode.DELTA));
logger.info(
String.format(
"Starting partial query update; upstream rev=%s; snapshot path=%s",
vcsState.map(s -> s.upstreamRevision).orElse("<unknown>"),
vcsState.flatMap(s -> s.workspaceSnapshotPath).map(Object::toString).orElse("<none>")));
}
RefreshOperation refresh =
projectRefresher.startPartialRefresh(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.google.idea.blaze.base.settings.Blaze;
import com.google.idea.blaze.base.settings.BlazeImportSettings;
import com.google.idea.blaze.base.settings.BlazeImportSettingsManager;
import com.google.idea.blaze.base.settings.BlazeUserSettings;
import com.google.idea.blaze.base.sync.SyncScope.SyncCanceledException;
import com.google.idea.blaze.base.sync.SyncScope.SyncFailedException;
import com.google.idea.blaze.base.sync.projectview.LanguageSupport;
Expand Down Expand Up @@ -125,7 +126,7 @@ private SyncProjectState getProjectState(BlazeContext context, BlazeSyncParams p
createBazelInfoFuture(context, syncFlags, params.syncMode());

ListenableFuture<WorkingSet> workingSetFuture;
if (params.addWorkingSet() || params.syncMode() == SyncMode.FULL) {
if (params.addWorkingSet() || (BlazeUserSettings.getInstance().getExpandSyncToWorkingSet() && params.syncMode() == SyncMode.FULL)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know when this one is used but it is bad to ignore the setting anyway so we need to double check here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, params.addWorkingSet already checks for that, but I'll merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to avoid unconditional params.syncMode() == SyncMode.FULL this is quite recent change from September

workingSetFuture = vcsHandler.getWorkingSet(context, executor);
} else {
workingSetFuture = Futures.immediateFuture(null);
Expand Down
Loading