Skip to content

Commit

Permalink
Use git info only when Expand to Working Set is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
dkashyn-sfdc committed Oct 30, 2024
1 parent 0f0f910 commit 087553f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 12 additions & 9 deletions base/src/com/google/idea/blaze/base/qsync/ProjectQuerierImpl.java
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()) {
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)) {
workingSetFuture = vcsHandler.getWorkingSet(context, executor);
} else {
workingSetFuture = Futures.immediateFuture(null);
Expand Down

0 comments on commit 087553f

Please sign in to comment.