Search in sources :

Example 1 with ChangeBrowserSettings

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

the class HgBrowseChangesTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    myVcs = HgVcs.getInstance(myProject);
    assert myVcs != null;
    mySettings = new ChangeBrowserSettings();
    cd(myRepository);
    touch("f2.txt");
    hg("add");
    hg("commit -m add");
    java.util.Calendar now = java.util.Calendar.getInstance();
    now.add(YEAR, 1);
    dateBefore = ChangeBrowserSettings.DATE_FORMAT.format(now.getTime());
    now.set(YEAR, 1970);
    dateAfter = ChangeBrowserSettings.DATE_FORMAT.format(now.getTime());
}
Also used : ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)

Example 2 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 3 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 4 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 5 with ChangeBrowserSettings

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

the class HgCachingCommittedChangesProvider method getOneList.

@Override
public Pair<CommittedChangeList, FilePath> getOneList(VirtualFile file, VcsRevisionNumber number) throws VcsException {
    final ChangeBrowserSettings settings = createDefaultSettings();
    settings.USE_CHANGE_AFTER_FILTER = true;
    settings.USE_CHANGE_BEFORE_FILTER = true;
    settings.CHANGE_AFTER = number.asString();
    settings.CHANGE_BEFORE = number.asString();
    // todo implement in proper way
    VirtualFile localVirtualFile = HgUtil.convertToLocalVirtualFile(file);
    if (localVirtualFile == null) {
        return null;
    }
    final FilePath filePath = VcsUtil.getFilePath(localVirtualFile);
    final CommittedChangeList list = getCommittedChangesForRevision(getLocationFor(filePath), number.asString());
    if (list != null) {
        return new Pair<>(list, filePath);
    }
    return null;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Pair(com.intellij.openapi.util.Pair)

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