Search in sources :

Example 16 with SvnTarget

use of org.tmatesoft.svn.core.wc2.SvnTarget in project intellij-community by JetBrains.

the class ShareProjectAction method createRemoteFolder.

@NotNull
private static SvnTarget createRemoteFolder(@NotNull SvnVcs vcs, @NotNull SVNURL parent, @NotNull String folderName, @NotNull String commitText) throws VcsException {
    SVNURL url = append(parent, folderName);
    String message = message("share.directory.commit.message", folderName, ApplicationNamesInfo.getInstance().getFullProductName(), commitText);
    SvnTarget target = SvnTarget.fromURL(url);
    progress(message("share.directory.create.dir.progress.text", url.toString()));
    long revision = vcs.getFactoryFromSettings().createBrowseClient().createDirectory(target, message, false);
    return SvnTarget.fromURL(url, SVNRevision.create(revision));
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) NotNull(org.jetbrains.annotations.NotNull)

Example 17 with SvnTarget

use of org.tmatesoft.svn.core.wc2.SvnTarget in project intellij-community by JetBrains.

the class SvnCommittedChangesProvider method loadCommittedChanges.

@Override
public void loadCommittedChanges(@NotNull ChangeBrowserSettings settings, @NotNull RepositoryLocation location, int maxCount, @NotNull AsynchConsumer<CommittedChangeList> consumer) throws VcsException {
    try {
        SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
        String repositoryRoot = getRepositoryRoot(svnLocation);
        ChangeBrowserSettings.Filter filter = settings.createFilter();
        Consumer<LogEntry> resultConsumer = logEntry -> {
            SvnChangeList list = new SvnChangeList(myVcs, svnLocation, logEntry, repositoryRoot);
            if (filter.accepts(list)) {
                consumer.consume(list);
            }
        };
        SvnTarget target = SvnTarget.fromURL(svnLocation.toSvnUrl(), createBeforeRevision(settings));
        getCommittedChangesImpl(settings, target, maxCount, resultConsumer, false, true);
    } finally {
        consumer.finished();
    }
}
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) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget)

Example 18 with SvnTarget

use of org.tmatesoft.svn.core.wc2.SvnTarget 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 19 with SvnTarget

use of org.tmatesoft.svn.core.wc2.SvnTarget in project intellij-community by JetBrains.

the class CmdDiffClient method createChange.

@NotNull
private Change createChange(@NotNull SvnTarget target1, @NotNull SvnTarget target2, @NotNull DiffPath diffPath) throws SvnBindException {
    // TODO: 1) Unify logic of creating Change instance with SvnDiffEditor and SvnChangeProviderContext
    // TODO: 2) If some directory is switched, files inside it are returned as modified in "svn diff --summarize", even if they are equal
    // TODO: to branch files by content - possibly add separate processing of all switched files
    // TODO: 3) Properties change is currently not added as part of result change like in SvnChangeProviderContext.patchWithPropertyChange
    SvnTarget subTarget1 = SvnUtil.append(target1, diffPath.path, true);
    String relativePath = SvnUtil.getRelativeUrl(SvnUtil.toDecodedString(target1), SvnUtil.toDecodedString(subTarget1));
    if (relativePath == null) {
        throw new SvnBindException("Could not get relative path for " + target1 + " and " + subTarget1);
    }
    SvnTarget subTarget2 = SvnUtil.append(target2, FileUtil.toSystemIndependentName(relativePath));
    FilePath target1Path = createFilePath(subTarget1, diffPath.isDirectory());
    FilePath target2Path = createFilePath(subTarget2, diffPath.isDirectory());
    FileStatus status = SvnStatusConvertor.convertStatus(SvnStatusHandler.getStatus(diffPath.itemStatus), SvnStatusHandler.getStatus(diffPath.propertiesStatus));
    // statuses determine changes needs to be done to "target1" to get "target2" state
    ContentRevision beforeRevision = status == FileStatus.ADDED ? null : createRevision(target1Path, target2Path, target1.getPegRevision(), status);
    ContentRevision afterRevision = status == FileStatus.DELETED ? null : createRevision(target2Path, target1Path, target2.getPegRevision(), status);
    return createChange(status, beforeRevision, afterRevision);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) FileStatus(com.intellij.openapi.vcs.FileStatus) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) CurrentContentRevision(com.intellij.openapi.vcs.changes.CurrentContentRevision) SvnRepositoryContentRevision(org.jetbrains.idea.svn.history.SvnRepositoryContentRevision) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) NotNull(org.jetbrains.annotations.NotNull)

Example 20 with SvnTarget

use of org.tmatesoft.svn.core.wc2.SvnTarget in project intellij-community by JetBrains.

the class DirectoryWithBranchComparer method compare.

@Override
protected void compare() throws SVNException, VcsException {
    titleBuilder.append(SvnBundle.message("repository.browser.compare.title", myElementUrl, FileUtil.toSystemDependentName(myVirtualFile.getPresentableUrl())));
    SvnTarget target1 = SvnTarget.fromURL(myElementUrl);
    SvnTarget target2 = SvnTarget.fromFile(virtualToIoFile(myVirtualFile));
    changes.addAll(getClientFactory().createDiffClient().compare(target1, target2));
}
Also used : SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget)

Aggregations

SvnTarget (org.tmatesoft.svn.core.wc2.SvnTarget)29 NotNull (org.jetbrains.annotations.NotNull)15 File (java.io.File)10 SVNURL (org.tmatesoft.svn.core.SVNURL)10 VcsException (com.intellij.openapi.vcs.VcsException)7 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)7 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 SvnVcs (org.jetbrains.idea.svn.SvnVcs)5 Logger (com.intellij.openapi.diagnostic.Logger)4 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)4 Pair (com.intellij.openapi.util.Pair)4 Ref (com.intellij.openapi.util.Ref)4 FilePath (com.intellij.openapi.vcs.FilePath)4 Nullable (org.jetbrains.annotations.Nullable)4 SVNException (org.tmatesoft.svn.core.SVNException)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 FileUtil (com.intellij.openapi.util.io.FileUtil)3 Registry (com.intellij.openapi.util.registry.Registry)3 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)3