com.intellij.openapi.vcs.versionBrowser.CommittedChangeList Java Examples
The following examples show how to use
com.intellij.openapi.vcs.versionBrowser.CommittedChangeList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpdateInfoTree.java From consulo with Apache License 2.0 | 6 votes |
public void setChangeLists(final List<CommittedChangeList> receivedChanges) { final boolean hasEmptyCaches = CommittedChangesCache.getInstance(myProject).hasEmptyCaches(); ApplicationManager.getApplication().invokeLater(() -> { if (myLoadingChangeListsLabel != null) { remove(myLoadingChangeListsLabel); myLoadingChangeListsLabel = null; } myCommittedChangeLists = receivedChanges; myTreeBrowser.setItems(myCommittedChangeLists, CommittedChangesBrowserUseCase.UPDATE); if (hasEmptyCaches) { final StatusText statusText = myTreeBrowser.getEmptyText(); statusText.clear(); statusText.appendText("Click ").appendText("Refresh", SimpleTextAttributes.LINK_ATTRIBUTES, new ActionListener() { public void actionPerformed(final ActionEvent e) { RefreshIncomingChangesAction.doRefresh(myProject); } }).appendText(" to initialize repository changes cache"); } }, myProject.getDisposed()); }
Example #2
Source File: ShowAllAffectedGenericAction.java From consulo with Apache License 2.0 | 6 votes |
public static CommittedChangeList getRemoteList(final AbstractVcs vcs, final VcsRevisionNumber revision, final VirtualFile nonLocal) throws VcsException { final CommittedChangesProvider provider = vcs.getCommittedChangesProvider(); final RepositoryLocation local = provider.getForNonLocal(nonLocal); if (local != null) { final String number = revision.asString(); final ChangeBrowserSettings settings = provider.createDefaultSettings(); final List<CommittedChangeList> changes = provider.getCommittedChanges(settings, local, provider.getUnlimitedCountValue()); if (changes != null) { for (CommittedChangeList change : changes) { if (number.equals(String.valueOf(change.getNumber()))) { return change; } } } } return null; }
Example #3
Source File: VcsCommittedListsZipperAdapter.java From consulo with Apache License 2.0 | 6 votes |
public CommittedChangeList zip(final RepositoryLocationGroup group, final List<CommittedChangeList> lists) { if (lists.size() == 1) { return lists.get(0); } final CommittedChangeList result = lists.get(0); for (int i = 1; i < lists.size(); i++) { final CommittedChangeList list = lists.get(i); for (Change change : list.getChanges()) { final Collection<Change> resultChanges = result.getChanges(); if (! resultChanges.contains(change)) { resultChanges.add(change); } } } return result; }
Example #4
Source File: StructureFilteringStrategy.java From consulo with Apache License 2.0 | 6 votes |
public void append(final List<CommittedChangeList> changeLists) { final TreeState localState = myState != null && myFilePaths.isEmpty() ? myState : TreeState.createOn(myStructureTree, (DefaultMutableTreeNode)myStructureTree.getModel().getRoot()); for (CommittedChangeList changeList : changeLists) { for (Change change : changeList.getChanges()) { final FilePath path = ChangesUtil.getFilePath(change); if (path.getParentPath() != null) { myFilePaths.add(path.getParentPath()); } } } myStructureTree.setModel(TreeModelBuilder.buildFromFilePaths(myProject, false, myFilePaths)); localState.applyTo(myStructureTree, (DefaultMutableTreeNode)myStructureTree.getModel().getRoot()); myStructureTree.revalidate(); myStructureTree.repaint(); initRenderer(); }
Example #5
Source File: CommittedChangesCache.java From consulo with Apache License 2.0 | 6 votes |
@Override public CommittedChangeList zip(final RepositoryLocationGroup group, final List<CommittedChangeList> lists) { if (lists.size() == 1) { return lists.get(0); } final CommittedChangeList victim = ReceivedChangeList.unwrap(lists.get(0)); final ReceivedChangeList result = new ReceivedChangeList(victim); result.setForcePartial(false); final Set<Change> baseChanges = new HashSet<Change>(); for (CommittedChangeList list : lists) { baseChanges.addAll(ReceivedChangeList.unwrap(list).getChanges()); final Collection<Change> changes = list.getChanges(); for (Change change : changes) { if (!result.getChanges().contains(change)) { result.addChange(change); } } } result.setForcePartial(baseChanges.size() != result.getChanges().size()); return result; }
Example #6
Source File: ChangesCacheFile.java From consulo with Apache License 2.0 | 6 votes |
public boolean processUpdatedFiles(UpdatedFiles updatedFiles, Collection<CommittedChangeList> receivedChanges) throws IOException { boolean haveUnaccountedUpdatedFiles = false; openStreams(); loadHeader(); ReceivedChangeListTracker tracker = new ReceivedChangeListTracker(); try { final List<IncomingChangeListData> incomingData = loadIncomingChangeListData(); for(FileGroup group: updatedFiles.getTopLevelGroups()) { haveUnaccountedUpdatedFiles |= processGroup(group, incomingData, tracker); } if (!haveUnaccountedUpdatedFiles) { for(IncomingChangeListData data: incomingData) { saveIncoming(data, false); } writeHeader(); } } finally { closeStreams(); } receivedChanges.addAll(tracker.getChangeLists()); return haveUnaccountedUpdatedFiles; }
Example #7
Source File: DetailsPanel.java From Crucible4IDEA with MIT License | 6 votes |
@NotNull private JComponent createRepositoryBrowserDetails() { myChangesBrowser = new MyChangesBrowser(myProject); myChangesBrowser.getDiffAction().registerCustomShortcutSet(CommonShortcuts.getDiff(), myCommitsTable); myChangesBrowser.getViewer().setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.TOP)); myCommitsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { final int[] indices = myCommitsTable.getSelectedRows(); List<Change> changes = new ArrayList<Change>(); for (int i : indices) { changes.addAll(((CommittedChangeList)myCommitsModel.getValueAt(i, 0)).getChanges()); } myChangesBrowser.setChangesToDisplay(changes); } }); return myChangesBrowser; }
Example #8
Source File: IncomingChangesViewProvider.java From consulo with Apache License 2.0 | 6 votes |
public IncomingChangesViewProvider(final Project project) { myProject = project; myBus = project.getMessageBus(); myListConsumer = new Consumer<List<CommittedChangeList>>() { @Override public void consume(final List<CommittedChangeList> lists) { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { myBrowser.getEmptyText().setText(VcsBundle.message("incoming.changes.empty.message")); myBrowser.setItems(lists, CommittedChangesBrowserUseCase.INCOMING); } }); } }; }
Example #9
Source File: ReviewItem.java From Crucible4IDEA with MIT License | 6 votes |
@NotNull public List<CommittedChangeList> loadChangeLists(@NotNull Project project, @NotNull AbstractVcs vcsFor, @NotNull Set<String> loadedRevisions, FilePath path) throws VcsException { final Set<String> revisions = getRevisions(); List<CommittedChangeList> changeLists = new ArrayList<CommittedChangeList>(); for (String revision : revisions) { if (!loadedRevisions.contains(revision)) { final VcsRevisionNumber revisionNumber = vcsFor.parseRevisionNumber(revision); if (revisionNumber != null) { final CommittedChangeList changeList = VcsUtils.loadRevisions(project, revisionNumber, path); if (changeList != null) changeLists.add(changeList); } loadedRevisions.add(revision); } } return changeLists; }
Example #10
Source File: VcsRevisionNumberArrayRule.java From consulo with Apache License 2.0 | 6 votes |
@Nullable public List<VcsRevisionNumber> getRevisionNumbers(@Nonnull DataProvider dataProvider) { VcsRevisionNumber revisionNumber = dataProvider.getDataUnchecked(VcsDataKeys.VCS_REVISION_NUMBER); if (revisionNumber != null) { return Collections.singletonList(revisionNumber); } ChangeList[] changeLists = dataProvider.getDataUnchecked(VcsDataKeys.CHANGE_LISTS); if (changeLists != null && changeLists.length > 0) { List<CommittedChangeList> committedChangeLists = ContainerUtil.findAll(changeLists, CommittedChangeList.class); if (!committedChangeLists.isEmpty()) { ContainerUtil.sort(committedChangeLists, CommittedChangeListByDateComparator.DESCENDING); return ContainerUtil.mapNotNull(committedChangeLists, CommittedChangeListToRevisionNumberFunction.INSTANCE); } } VcsFileRevision[] fileRevisions = dataProvider.getDataUnchecked(VcsDataKeys.VCS_FILE_REVISIONS); if (fileRevisions != null && fileRevisions.length > 0) { return ContainerUtil.mapNotNull(fileRevisions, FileRevisionToRevisionNumberFunction.INSTANCE); } return null; }
Example #11
Source File: IncomingChangesIndicator.java From consulo with Apache License 2.0 | 6 votes |
@Inject public IncomingChangesIndicator(Application application, Project project, CommittedChangesCache cache) { myProject = project; myCache = cache; if(project.isDefault()) { return; } final MessageBusConnection connection = project.getMessageBus().connect(); connection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesAdapter() { @Override public void incomingChangesUpdated(@Nullable final List<CommittedChangeList> receivedChanges) { application.invokeLater(() -> refreshIndicator()); } }); final VcsListener listener = () -> UIUtil.invokeLaterIfNeeded(this::updateIndicatorVisibility); connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, listener); connection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN, listener); }
Example #12
Source File: OutdatedVersionNotifier.java From consulo with Apache License 2.0 | 6 votes |
@Inject public OutdatedVersionNotifier(Provider<FileEditorManager> fileEditorManager, CommittedChangesCache cache, Project project) { myFileEditorManager = fileEditorManager; myCache = cache; myProject = project; MessageBusConnection busConnection = project.getMessageBus().connect(); busConnection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesAdapter() { @Override public void incomingChangesUpdated(@Nullable final List<CommittedChangeList> receivedChanges) { if (myCache.getCachedIncomingChanges() == null) { requestLoadIncomingChanges(); } else { updateAllEditorsLater(); } } @Override public void changesCleared() { updateAllEditorsLater(); } }); busConnection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyFileEditorManagerListener()); }
Example #13
Source File: CommittedChangesCache.java From consulo with Apache License 2.0 | 6 votes |
public void commitMessageChanged(final AbstractVcs vcs, final RepositoryLocation location, final long number, final String newMessage) { myTaskQueue.run(new Runnable() { @Override public void run() { final ChangesCacheFile file = myCachesHolder.haveCache(location); if (file != null) { try { if (file.isEmpty()) return; file.editChangelist(number, newMessage); loadIncomingChanges(true); fireChangesLoaded(location, Collections.<CommittedChangeList>emptyList()); } catch (IOException e) { VcsBalloonProblemNotifier.showOverChangesView(myProject, "Didn't update Repository changes with new message due to error: " + e.getMessage(), MessageType.ERROR); } } } }); }
Example #14
Source File: CommittedChangesPanel.java From consulo with Apache License 2.0 | 5 votes |
private void refreshChangesFromCache(final boolean cacheOnly) { final CommittedChangesCache cache = CommittedChangesCache.getInstance(myProject); cache.hasCachesForAnyRoot(new Consumer<Boolean>() { @Override public void consume(final Boolean notEmpty) { if (! notEmpty) { if (cacheOnly) { myBrowser.getEmptyText().setText(VcsBundle.message("committed.changes.not.loaded.message")); return; } if (!CacheSettingsDialog.showSettingsDialog(myProject)) return; } cache.getProjectChangesAsync(mySettings, myMaxCount, cacheOnly, new Consumer<List<CommittedChangeList>>() { @Override public void consume(final List<CommittedChangeList> committedChangeLists) { updateFilteredModel(committedChangeLists, false); } }, new Consumer<List<VcsException>>() { @Override public void consume(final List<VcsException> vcsExceptions) { AbstractVcsHelper.getInstance(myProject).showErrors(vcsExceptions, "Error refreshing VCS history"); } }); } }); }
Example #15
Source File: IncomingChangesIndicator.java From consulo with Apache License 2.0 | 5 votes |
private void refreshIndicator() { if (myIndicatorComponent == null) { return; } final List<CommittedChangeList> list = myCache.getCachedIncomingChanges(); if (list == null || list.isEmpty()) { debug("Refreshing indicator: no changes"); myIndicatorComponent.clear(); } else { debug("Refreshing indicator: " + list.size() + " changes"); myIndicatorComponent.setChangesAvailable(VcsBundle.message("incoming.changes.indicator.tooltip", list.size())); } }
Example #16
Source File: CommittedChangesCache.java From consulo with Apache License 2.0 | 5 votes |
private void pendingUpdateProcessed(@javax.annotation.Nullable Consumer<List<CommittedChangeList>> incomingChangesConsumer) { myPendingUpdateCount--; if (myPendingUpdateCount == 0) { notifyIncomingChangesUpdated(myNewIncomingChanges); if (incomingChangesConsumer != null) { incomingChangesConsumer.consume(ContainerUtil.newArrayList(myNewIncomingChanges)); } myNewIncomingChanges.clear(); } }
Example #17
Source File: ChangeListColumn.java From consulo with Apache License 2.0 | 5 votes |
public Comparator<CommittedChangeList> getComparator() { return new Comparator<CommittedChangeList>() { public int compare(final CommittedChangeList o1, final CommittedChangeList o2) { return o1.getName().compareTo(o2.getName()); } }; }
Example #18
Source File: ChangeListColumn.java From consulo with Apache License 2.0 | 5 votes |
public Comparator<CommittedChangeList> getComparator() { return new Comparator<CommittedChangeList>() { public int compare(final CommittedChangeList o1, final CommittedChangeList o2) { return (int)(o1.getNumber() - o2.getNumber()); } }; }
Example #19
Source File: CommittedChangesCache.java From consulo with Apache License 2.0 | 5 votes |
private List<CommittedChangeList> refreshCache(final ChangesCacheFile cacheFile) throws VcsException, IOException { final List<CommittedChangeList> newLists = new ArrayList<CommittedChangeList>(); final CachingCommittedChangesProvider provider = cacheFile.getProvider(); final RepositoryLocation location = cacheFile.getLocation(); final Pair<Long, List<CommittedChangeList>> externalLists = myExternallyLoadedChangeLists.get(location.getKey()); final long latestChangeList = getLatestListForFile(cacheFile); if ((externalLists != null) && (latestChangeList == externalLists.first.longValue())) { newLists.addAll(appendLoadedChanges(cacheFile, location, externalLists.second)); myExternallyLoadedChangeLists.clear(); } final ChangeBrowserSettings defaultSettings = provider.createDefaultSettings(); int maxCount = 0; if (provider.refreshCacheByNumber()) { final long number = cacheFile.getLastCachedChangelist(); debug("Refreshing cache for " + location + " since #" + number); if (number >= 0) { defaultSettings.CHANGE_AFTER = Long.toString(number); defaultSettings.USE_CHANGE_AFTER_FILTER = true; } else { maxCount = myState.getInitialCount(); } } else { final Date date = cacheFile.getLastCachedDate(); debug("Refreshing cache for " + location + " since " + date); defaultSettings.setDateAfter(date); defaultSettings.USE_DATE_AFTER_FILTER = true; } final List<CommittedChangeList> newChanges = provider.getCommittedChanges(defaultSettings, location, maxCount); debug("Loaded " + newChanges.size() + " new changelists"); newLists.addAll(appendLoadedChanges(cacheFile, location, newChanges)); return newLists; }
Example #20
Source File: ChangeListDetailsAction.java From consulo with Apache License 2.0 | 5 votes |
public void actionPerformed(AnActionEvent e) { final Project project = e.getData(CommonDataKeys.PROJECT); final ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS); if (changeLists != null && changeLists.length > 0 && changeLists [0] instanceof CommittedChangeList) { showDetailsPopup(project, (CommittedChangeList) changeLists [0]); } }
Example #21
Source File: ChangeListColumn.java From consulo with Apache License 2.0 | 5 votes |
public Comparator<CommittedChangeList> getComparator() { return new Comparator<CommittedChangeList>() { public int compare(final CommittedChangeList o1, final CommittedChangeList o2) { return o1.getCommitDate().compareTo(o2.getCommitDate()); } }; }
Example #22
Source File: SimiliarListsZipper.java From consulo with Apache License 2.0 | 5 votes |
private boolean usualStep() { while (! myLists.isEmpty()) { final SubSequence<CommittedChangeList> sequence = myLists.removeFirst(); myResult.add(sequence.getCurrentList()); if (sequence.hasNext()) { sequence.next(); insert(sequence); return true; } } return false; }
Example #23
Source File: ChangesCacheFile.java From consulo with Apache License 2.0 | 5 votes |
private void updateCachedRange(final CommittedChangeList list) { if (list.getCommitDate().getTime() > myLastCachedDate.getTime()) { myLastCachedDate = list.getCommitDate(); } if (list.getCommitDate().getTime() < myFirstCachedDate.getTime()) { myFirstCachedDate = list.getCommitDate(); } if (list.getNumber() < myFirstCachedChangelist) { myFirstCachedChangelist = list.getNumber(); } if (list.getNumber() > myLastCachedChangelist) { myLastCachedChangelist = list.getNumber(); } }
Example #24
Source File: CommittedChangesCache.java From consulo with Apache License 2.0 | 5 votes |
private List<CommittedChangeList> initCache(final ChangesCacheFile cacheFile) throws VcsException, IOException { debug("Initializing cache for " + cacheFile.getLocation()); final CachingCommittedChangesProvider provider = cacheFile.getProvider(); final RepositoryLocation location = cacheFile.getLocation(); final ChangeBrowserSettings settings = provider.createDefaultSettings(); int maxCount = 0; if (isMaxCountSupportedForProject()) { maxCount = myState.getInitialCount(); } else { settings.USE_DATE_AFTER_FILTER = true; Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -myState.getInitialDays()); settings.setDateAfter(calendar.getTime()); } //noinspection unchecked final List<CommittedChangeList> changes = provider.getCommittedChanges(settings, location, maxCount); // when initially initializing cache, assume all changelists are locally available writeChangesInReadAction(cacheFile, changes); // this sorts changes in chronological order if (maxCount > 0 && changes.size() < myState.getInitialCount()) { cacheFile.setHaveCompleteHistory(true); } if (changes.size() > 0) { fireChangesLoaded(location, changes); } return changes; }
Example #25
Source File: CommittedChangesPanel.java From consulo with Apache License 2.0 | 5 votes |
public void clearCaches() { final CommittedChangesCache cache = CommittedChangesCache.getInstance(myProject); cache.clearCaches(new Runnable() { @Override public void run() { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { updateFilteredModel(Collections.<CommittedChangeList>emptyList(), true); } }, ModalityState.NON_MODAL, myProject.getDisposed()); } }); }
Example #26
Source File: RevertSelectedChangesAction.java From consulo with Apache License 2.0 | 5 votes |
private static boolean allSelectedChangeListsAreRevertable(AnActionEvent e) { ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS); if (changeLists == null) { return true; } for (ChangeList list : changeLists) { if (list instanceof CommittedChangeList) { if (!((CommittedChangeList)list).isModifiable()) { return false; } } } return true; }
Example #27
Source File: ChangesCacheFile.java From consulo with Apache License 2.0 | 5 votes |
public List<CommittedChangeList> writeChanges(final List<CommittedChangeList> changes) throws IOException { // the list and index are sorted in direct chronological order Collections.sort(changes, new Comparator<CommittedChangeList>() { public int compare(final CommittedChangeList o1, final CommittedChangeList o2) { return Comparing.compare(o1.getCommitDate(), o2.getCommitDate()); } }); return writeChanges(changes, null); }
Example #28
Source File: CommittedChangesCache.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public Pair<CommittedChangeList, Change> getIncomingChangeList(final VirtualFile file) { if (myCachedIncomingChangeLists != null) { File ioFile = new File(file.getPath()); for (CommittedChangeList changeList : myCachedIncomingChangeLists) { for (Change change : changeList.getChanges()) { if (change.affectsFile(ioFile)) { return Pair.create(changeList, change); } } } } return null; }
Example #29
Source File: ChangeListGroupingStrategy.java From consulo with Apache License 2.0 | 5 votes |
public Comparator<CommittedChangeList> getComparator() { return new Comparator<CommittedChangeList>() { public int compare(final CommittedChangeList o1, final CommittedChangeList o2) { int rc = o1.getCommitterName().compareToIgnoreCase(o2.getCommitterName()); if (rc == 0) { return -o1.getCommitDate().compareTo(o2.getCommitDate()); } return rc; } }; }
Example #30
Source File: CommittedChangesTreeBrowser.java From consulo with Apache License 2.0 | 5 votes |
public static List<Change> collectChanges(final List<? extends CommittedChangeList> selectedChangeLists, final boolean withMovedTrees) { List<Change> result = new ArrayList<>(); Collections.sort(selectedChangeLists, new Comparator<CommittedChangeList>() { public int compare(final CommittedChangeList o1, final CommittedChangeList o2) { return o1.getCommitDate().compareTo(o2.getCommitDate()); } }); for (CommittedChangeList cl : selectedChangeLists) { final Collection<Change> changes = withMovedTrees ? cl.getChangesWithMovedTrees() : cl.getChanges(); for (Change c : changes) { addOrReplaceChange(result, c); } } return result; }