Search in sources :

Example 26 with ChangeBrowserSettings

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

the class SvnCommittedChangesProvider method getCommittedChanges.

@Override
@NotNull
public List<SvnChangeList> getCommittedChanges(@NotNull ChangeBrowserSettings settings, @NotNull RepositoryLocation location, int maxCount) throws VcsException {
    SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
    List<SvnChangeList> result = newArrayList();
    String repositoryRoot = getRepositoryRoot(svnLocation);
    Consumer<LogEntry> resultConsumer = logEntry -> result.add(new SvnChangeList(myVcs, svnLocation, logEntry, repositoryRoot));
    SvnTarget target = SvnTarget.fromURL(svnLocation.toSvnUrl(), createBeforeRevision(settings));
    getCommittedChangesImpl(settings, target, maxCount, resultConsumer, false, true);
    settings.filterChanges(result);
    return result;
}
Also used : AsynchConsumer(com.intellij.util.AsynchConsumer) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) VcsRevisionNumber(com.intellij.openapi.vcs.history.VcsRevisionNumber) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Date(java.util.Date) ProgressManager.progress(com.intellij.openapi.progress.ProgressManager.progress) VcsCommittedViewAuxiliary(com.intellij.openapi.vcs.changes.committed.VcsCommittedViewAuxiliary) VcsCommittedListsZipper(com.intellij.openapi.vcs.changes.committed.VcsCommittedListsZipper) PairConsumer(com.intellij.util.PairConsumer) SvnBundle.message(org.jetbrains.idea.svn.SvnBundle.message) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) ApplicationManager.getApplication(com.intellij.openapi.application.ApplicationManager.getApplication) Collections.singletonList(java.util.Collections.singletonList) ConfigureBranchesAction(org.jetbrains.idea.svn.branchConfig.ConfigureBranchesAction) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) MessageBusConnection(com.intellij.util.messages.MessageBusConnection) SvnUtil(org.jetbrains.idea.svn.SvnUtil) ProgressManager.progress2(com.intellij.openapi.progress.ProgressManager.progress2) SvnVcs(org.jetbrains.idea.svn.SvnVcs) FileUtil(com.intellij.openapi.util.io.FileUtil) Logger(com.intellij.openapi.diagnostic.Logger) com.intellij.openapi.vcs(com.intellij.openapi.vcs) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) VcsUtil(com.intellij.vcsUtil.VcsUtil) DataOutput(java.io.DataOutput) DecoratorManager(com.intellij.openapi.vcs.changes.committed.DecoratorManager) SVNException(org.tmatesoft.svn.core.SVNException) Collection(java.util.Collection) Set(java.util.Set) VcsConfigurationChangeListener(com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener) IOException(java.io.IOException) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) File(java.io.File) ContainerUtil.newArrayList(com.intellij.util.containers.ContainerUtil.newArrayList) Nullable(org.jetbrains.annotations.Nullable) StatusType(org.jetbrains.idea.svn.status.StatusType) Depth(org.jetbrains.idea.svn.api.Depth) List(java.util.List) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) SVNURL(org.tmatesoft.svn.core.SVNURL) ContainerUtil.newHashSet(com.intellij.util.containers.ContainerUtil.newHashSet) Pair(com.intellij.openapi.util.Pair) DataInput(java.io.DataInput) ChangesBrowserSettingsEditor(com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor) Registry(com.intellij.openapi.util.registry.Registry) NotNull(org.jetbrains.annotations.NotNull) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) Consumer(com.intellij.util.Consumer) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) NotNull(org.jetbrains.annotations.NotNull)

Example 27 with ChangeBrowserSettings

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

the class SvnCommittedViewTest method testCopyDir.

@Test
public void testCopyDir() throws Exception {
    final File trunk = new File(myTempDirFixture.getTempDirPath(), "trunk");
    trunk.mkdir();
    Thread.sleep(100);
    final File folder = new File(trunk, "folder");
    folder.mkdir();
    Thread.sleep(100);
    new File(folder, "f1.txt").createNewFile();
    new File(folder, "f2.txt").createNewFile();
    Thread.sleep(100);
    runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk");
    runInAndVerifyIgnoreOutput("copy", "-m", "test", myRepoUrl + "/trunk", myRepoUrl + "/branch");
    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 + "/branch"), 0);
    checkList(changeListList, 2, new Data[] { new Data(new File(myWorkingCopyDir.getPath(), "branch").getAbsolutePath(), FileStatus.ADDED, "- copied from /trunk") });
}
Also used : SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Test(org.junit.Test)

Example 28 with ChangeBrowserSettings

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

the class SvnCommittedViewTest method testCopyAndModify.

@Test
public void testCopyAndModify() throws Exception {
    final File trunk = new File(myTempDirFixture.getTempDirPath(), "trunk");
    trunk.mkdir();
    Thread.sleep(100);
    final File folder = new File(trunk, "folder");
    folder.mkdir();
    Thread.sleep(100);
    new File(folder, "f1.txt").createNewFile();
    new File(folder, "f2.txt").createNewFile();
    Thread.sleep(100);
    runInAndVerifyIgnoreOutput("import", "-m", "test", trunk.getAbsolutePath(), myRepoUrl + "/trunk");
    update();
    runInAndVerifyIgnoreOutput("copy", myWorkingCopyDir.getPath() + "/trunk", myWorkingCopyDir.getPath() + "/branch");
    runInAndVerifyIgnoreOutput("propset", "testprop", "testval", myWorkingCopyDir.getPath() + "/branch/folder");
    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 + "/branch"), 0);
    checkList(changeListList, 2, new Data[] { new Data(new File(myWorkingCopyDir.getPath(), "branch").getAbsolutePath(), FileStatus.ADDED, "- copied from /trunk"), new Data(new File(myWorkingCopyDir.getPath(), "branch/folder").getAbsolutePath(), FileStatus.MODIFIED, "- copied from /trunk/folder") });
}
Also used : SvnRepositoryLocation(org.jetbrains.idea.svn.history.SvnRepositoryLocation) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Test(org.junit.Test)

Example 29 with ChangeBrowserSettings

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

the class SvnCommittedViewTest method testMoveDir.

@Test
public void testMoveDir() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
    VirtualFile d1 = createDirInCommand(myWorkingCopyDir, "d1");
    VirtualFile d2 = createDirInCommand(myWorkingCopyDir, "d2");
    VirtualFile f11 = createFileInCommand(d1, "f11.txt", "123\n456");
    VirtualFile f12 = createFileInCommand(d1, "f12.txt", "----");
    // r1, addition without history
    checkin();
    final String oldPath = absPath(d1);
    moveFileInCommand(d1, d2);
    Thread.sleep(100);
    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(d1), FileStatus.MODIFIED, "- moved from .." + File.separatorChar + "d1") });
}
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)

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