Search in sources :

Example 11 with ChangeBrowserSettings

use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings in project intellij-community by JetBrains.

the class SvnCommittedViewTest method testDelete.

@Test
public void testDelete() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    final VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");
    final VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
    final VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");
    // r1, addition without history
    checkin();
    deleteFileInCommand(f11);
    checkin();
    update();
    deleteFileInCommand(d1);
    checkin();
    final SvnVcs vcs = SvnVcs.getInstance(myProject);
    vcs.invokeRefreshSvnRoots();
    final CommittedChangesProvider<SvnChangeList, ChangeBrowserSettings> committedChangesProvider = vcs.getCommittedChangesProvider();
    final List<SvnChangeList> changeListList = committedChangesProvider.getCommittedChanges(committedChangesProvider.createDefaultSettings(), new SvnRepositoryLocation(myRepoUrl), 0);
    checkList(changeListList, 2, new Data[] { new Data(absPath(f11), FileStatus.DELETED, null) });
    checkList(changeListList, 3, new Data[] { new Data(absPath(d1), FileStatus.DELETED, null) });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Test(org.junit.Test)

Example 12 with ChangeBrowserSettings

use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings in project intellij-community by JetBrains.

the class MergeFromTheirsResolver method loadSvnChangeListsForPatch.

@NotNull
private List<SvnChangeList> loadSvnChangeListsForPatch(@NotNull TreeConflictDescription description) throws VcsException {
    long max = description.getSourceRightVersion().getPegRevision();
    long min = description.getSourceLeftVersion().getPegRevision();
    SvnRepositoryLocation location = new SvnRepositoryLocation(description.getSourceRightVersion().getRepositoryRoot().toString());
    ChangeBrowserSettings settings = new ChangeBrowserSettings();
    settings.USE_CHANGE_BEFORE_FILTER = settings.USE_CHANGE_AFTER_FILTER = true;
    settings.CHANGE_BEFORE = String.valueOf(max);
    settings.CHANGE_AFTER = String.valueOf(min);
    //noinspection unchecked
    List<SvnChangeList> committedChanges = notNull(myVcs.getCachingCommittedChangesProvider()).getCommittedChanges(settings, location, 0);
    return filter(committedChanges, changeList -> changeList.getNumber() != min);
}
Also used : SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with ChangeBrowserSettings

use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings in project intellij-community by JetBrains.

the class MergeCalculatorTask method getChangeListsAfter.

@NotNull
private List<Pair<SvnChangeList, LogHierarchyNode>> getChangeListsAfter(long revision) throws VcsException {
    ChangeBrowserSettings settings = new ChangeBrowserSettings();
    settings.CHANGE_AFTER = Long.toString(revision);
    settings.USE_CHANGE_AFTER_FILTER = true;
    return getChangeLists(myMergeContext, settings, revision, -1, Pair::create);
}
Also used : ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) Pair(com.intellij.openapi.util.Pair) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with ChangeBrowserSettings

use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings in project intellij-community by JetBrains.

the class MergeCalculatorTask method loadChangeLists.

@NotNull
public static Pair<List<SvnChangeList>, Boolean> loadChangeLists(@NotNull MergeContext mergeContext, long beforeRevision, int size) throws VcsException {
    ChangeBrowserSettings settings = new ChangeBrowserSettings();
    if (beforeRevision > 0) {
        settings.CHANGE_BEFORE = String.valueOf(beforeRevision);
        settings.USE_CHANGE_BEFORE_FILTER = true;
    }
    List<SvnChangeList> changeLists = getChangeLists(mergeContext, settings, beforeRevision, size, (changeList, tree) -> changeList);
    return Pair.create(changeLists.subList(0, min(size, changeLists.size())), changeLists.size() < size + 1);
}
Also used : ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with ChangeBrowserSettings

use of com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings in project intellij-community by JetBrains.

the class CommittedChangesCache method initCache.

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
    // this sorts changes in chronological order
    writeChangesInReadAction(cacheFile, changes);
    if (maxCount > 0 && changes.size() < myState.getInitialCount()) {
        cacheFile.setHaveCompleteHistory(true);
    }
    if (changes.size() > 0) {
        fireChangesLoaded(location, changes);
    }
    return changes;
}
Also used : ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)

Aggregations

ChangeBrowserSettings (com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)29 VirtualFile (com.intellij.openapi.vfs.VirtualFile)19 SvnChangeList (org.jetbrains.idea.svn.history.SvnChangeList)16 SvnRepositoryLocation (org.jetbrains.idea.svn.history.SvnRepositoryLocation)15 Test (org.junit.Test)14 CommittedChangeList (com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)9 SvnVcs (org.jetbrains.idea.svn.SvnVcs)9 File (java.io.File)7 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)5 Pair (com.intellij.openapi.util.Pair)4 NotNull (org.jetbrains.annotations.NotNull)4 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)3 ChangesBrowserSettingsEditor (com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor)3 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)2 ApplicationManager.getApplication (com.intellij.openapi.application.ApplicationManager.getApplication)2 Logger (com.intellij.openapi.diagnostic.Logger)2 ProgressManager.progress (com.intellij.openapi.progress.ProgressManager.progress)2 ProgressManager.progress2 (com.intellij.openapi.progress.ProgressManager.progress2)2 FileUtil (com.intellij.openapi.util.io.FileUtil)2 Registry (com.intellij.openapi.util.registry.Registry)2