private void updateVcsMappings(@NotNull List<VcsDirectoryMapping> mappings, boolean updateRootsImmediately) {
    myRootUpdateQueue.cancelAllUpdates();

    List<VcsDirectoryMapping> newMappings = List.copyOf(ContainerUtil.sorted(removeDuplicates(mappings), MAPPINGS_COMPARATOR));
    synchronized (myUpdateLock) {
      boolean mappingsChanged = !myMappings.equals(newMappings);
      if (!mappingsChanged) return; // mappings are up-to-date

      myMappings = newMappings;

      dumpMappingsToLog();
    }

    updateActiveVcses(false);

    if (updateRootsImmediately) {
      boolean fireMappingsChangedEvent = false;
      if (ApplicationManager.getApplication().isDispatchThread() &&
          ContainerUtil.exists(newMappings, it -> it.isDefaultMapping())) {
        updateMappedRootsFast(fireMappingsChangedEvent);
        scheduleMappedRootsUpdateWithoutDelay();
      }
      else {
        updateMappedRoots(fireMappingsChangedEvent);
      }
    }
    else {
      scheduleMappedRootsUpdateWithoutDelay();
    }

    // do not fire event from ProjectLevelVcsManager service initialization
    if (updateRootsImmediately || isActivated()) {
      notifyMappingsChanged();
    }
  }
private void updateVcsMappings(@NotNull List<VcsDirectoryMapping> mappings, boolean updateRootsImmediately)