Search in sources :

Example 11 with SvnTarget

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

the class LatestExistentSearcher method getDeletionRevision.

public long getDeletionRevision() {
    if (!detectStartRevision())
        return -1;
    final Ref<Long> latest = new Ref<>(myStartNumber);
    try {
        if (myEndNumber == -1) {
            myEndNumber = getLatestRevision();
        }
        final SVNURL existingParent = getExistingParent(myUrl);
        if (existingParent == null) {
            return myStartNumber;
        }
        final SVNRevision startRevision = SVNRevision.create(myStartNumber);
        SvnTarget target = SvnTarget.fromURL(existingParent, startRevision);
        myVcs.getFactory(target).createHistoryClient().doLog(target, startRevision, SVNRevision.HEAD, false, true, false, 0, null, createHandler(latest));
    } catch (VcsException e) {
        LOG.info(e);
    }
    return latest.get().longValue();
}
Also used : Ref(com.intellij.openapi.util.Ref) SVNURL(org.tmatesoft.svn.core.SVNURL) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) VcsException(com.intellij.openapi.vcs.VcsException) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision)

Example 12 with SvnTarget

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

the class BranchMerger method mergeNext.

public void mergeNext() throws VcsException {
    myAtStart = false;
    File destination = new File(myTargetPath);
    MergeClient client = myVcs.getFactory(destination).createMergeClient();
    SvnTarget source = SvnTarget.fromURL(mySourceUrl);
    if (mySupportsMergeInfo) {
        client.merge(source, destination, false, myReintegrate, createDiffOptions(), myHandler);
    } else {
        mySourceLatestRevision = resolveSourceLatestRevision();
        SVNRevisionRange range = new SVNRevisionRange(SVNRevision.create(mySourceCopyRevision), mySourceLatestRevision);
        client.merge(source, range, destination, Depth.UNKNOWN, false, false, true, createDiffOptions(), myHandler);
    }
}
Also used : SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) SVNRevisionRange(org.tmatesoft.svn.core.wc.SVNRevisionRange) File(java.io.File)

Example 13 with SvnTarget

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

the class CmdRevertClient method revert.

@Override
public void revert(@NotNull Collection<File> paths, @Nullable Depth depth, @Nullable ProgressTracker handler) throws VcsException {
    if (!ContainerUtil.isEmpty(paths)) {
        Command command = newCommand(SvnCommandName.revert);
        command.put(depth);
        command.setTargets(paths);
        // TODO: handler should be called in parallel with command execution, but this will be in other thread
        // TODO: check if that is ok for current handler implementation
        // TODO: add possibility to invoke "handler.checkCancelled" - process should be killed
        SvnTarget target = SvnTarget.fromFile(ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(paths)));
        CommandExecutor executor = execute(myVcs, target, CommandUtil.getHomeDirectory(), command, null);
        FileStatusResultParser parser = new FileStatusResultParser(CHANGED_PATH, handler, new RevertStatusConvertor());
        parser.parse(executor.getOutput());
    }
}
Also used : Command(org.jetbrains.idea.svn.commandLine.Command) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor)

Example 14 with SvnTarget

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

the class SvnUtil method remoteFolderIsEmpty.

public static boolean remoteFolderIsEmpty(@NotNull SvnVcs vcs, @NotNull String url) throws VcsException {
    SvnTarget target = SvnTarget.fromURL(createUrl(url));
    Ref<Boolean> result = new Ref<>(true);
    DirectoryEntryConsumer handler = entry -> {
        if (entry != null) {
            result.set(false);
        }
    };
    vcs.getFactory(target).createBrowseClient().list(target, null, Depth.IMMEDIATES, handler);
    return result.get();
}
Also used : FileUtilRt(com.intellij.openapi.util.io.FileUtilRt) SvnBranchConfigurationNew(org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationNew) SqlJetException(org.tmatesoft.sqljet.core.SqlJetException) Connection(java.sql.Connection) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) SqlJetDb(org.tmatesoft.sqljet.core.table.SqlJetDb) VirtualFileManager(com.intellij.openapi.vfs.VirtualFileManager) Matcher(java.util.regex.Matcher) SqlJetSchema(org.tmatesoft.sqljet.core.internal.schema.SqlJetSchema) ResultSet(java.sql.ResultSet) SVNErrorMessage(org.tmatesoft.svn.core.SVNErrorMessage) FileUtil(com.intellij.openapi.util.io.FileUtil) URI(java.net.URI) Logger(com.intellij.openapi.diagnostic.Logger) VcsException(com.intellij.openapi.vcs.VcsException) ProgressEvent(org.jetbrains.idea.svn.api.ProgressEvent) SqlJetEngine(org.tmatesoft.sqljet.core.table.engine.SqlJetEngine) MultiMap(com.intellij.util.containers.MultiMap) FilePath(com.intellij.openapi.vcs.FilePath) ProgressManager(com.intellij.openapi.progress.ProgressManager) SvnBranchConfigurationManager(org.jetbrains.idea.svn.branchConfig.SvnBranchConfigurationManager) Collections.emptyList(java.util.Collections.emptyList) SVNFileUtil(org.tmatesoft.svn.core.internal.wc.SVNFileUtil) Collection(java.util.Collection) LockDialog(org.jetbrains.idea.svn.dialogs.LockDialog) Set(java.util.Set) SVNErrorCode(org.tmatesoft.svn.core.SVNErrorCode) NonWritableChannelException(java.nio.channels.NonWritableChannelException) Status(org.jetbrains.idea.svn.status.Status) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) NotificationType(com.intellij.notification.NotificationType) Nullable(org.jetbrains.annotations.Nullable) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) Contract(org.jetbrains.annotations.Contract) List(java.util.List) SqlJetBtreeSchemaTable(org.tmatesoft.sqljet.core.internal.table.SqlJetBtreeSchemaTable) ContainerUtil.map2Array(com.intellij.util.containers.ContainerUtil.map2Array) ApplicationManager(com.intellij.openapi.application.ApplicationManager) Registry(com.intellij.openapi.util.registry.Registry) Pattern(java.util.regex.Pattern) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SVNWCUtil(org.tmatesoft.svn.core.wc.SVNWCUtil) ISqlJetBtreeSchemaTable(org.tmatesoft.sqljet.core.internal.table.ISqlJetBtreeSchemaTable) ArrayUtil(com.intellij.util.ArrayUtil) ProgressTracker(org.jetbrains.idea.svn.api.ProgressTracker) NonNls(org.jetbrains.annotations.NonNls) Computable(com.intellij.openapi.util.Computable) ContainerUtil(com.intellij.util.containers.ContainerUtil) ArrayList(java.util.ArrayList) VcsBalloonProblemNotifier(com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) StatusBarUtil(com.intellij.openapi.wm.impl.status.StatusBarUtil) ISqlJetOptions(org.tmatesoft.sqljet.core.table.ISqlJetOptions) SvnOperationFactory(org.tmatesoft.svn.core.wc2.SvnOperationFactory) SQLException(java.sql.SQLException) ChangesUtil(com.intellij.openapi.vcs.changes.ChangesUtil) Project(com.intellij.openapi.project.Project) EventAction(org.jetbrains.idea.svn.api.EventAction) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) VfsUtilCore(com.intellij.openapi.vfs.VfsUtilCore) SVNException(org.tmatesoft.svn.core.SVNException) StringUtil(com.intellij.openapi.util.text.StringUtil) Convertor(com.intellij.util.containers.Convertor) SvnWcGeneration(org.tmatesoft.svn.core.internal.wc2.SvnWcGeneration) Info(org.jetbrains.idea.svn.info.Info) File(java.io.File) Depth(org.jetbrains.idea.svn.api.Depth) AbstractVcsHelper(com.intellij.openapi.vcs.AbstractVcsHelper) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) SVNURL(org.tmatesoft.svn.core.SVNURL) SVNPathUtil(org.tmatesoft.svn.core.internal.util.SVNPathUtil) ContainerUtil.newHashSet(com.intellij.util.containers.ContainerUtil.newHashSet) Pair(com.intellij.openapi.util.Pair) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) DirectoryEntryConsumer(org.jetbrains.idea.svn.browse.DirectoryEntryConsumer) DriverManager(java.sql.DriverManager) Ref(com.intellij.openapi.util.Ref) DirectoryEntryConsumer(org.jetbrains.idea.svn.browse.DirectoryEntryConsumer) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget)

Example 15 with SvnTarget

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

the class ShareProjectAction method createFolderStructure.

@NotNull
private static SvnTarget createFolderStructure(@NotNull SvnVcs vcs, @NotNull VirtualFile file, @NotNull ShareDialog.ShareTarget shareTarget, boolean createStandardStructure, @NotNull SVNURL parentUrl, @NotNull String commitText) throws VcsException {
    switch(shareTarget) {
        case useSelected:
            return SvnTarget.fromURL(parentUrl, SVNRevision.HEAD);
        case useProjectName:
            return createRemoteFolder(vcs, parentUrl, file.getName(), commitText);
        default:
            SvnTarget projectRoot = createRemoteFolder(vcs, parentUrl, file.getName(), commitText);
            SvnTarget trunk = createRemoteFolder(vcs, projectRoot.getURL(), "trunk", commitText);
            if (createStandardStructure) {
                createRemoteFolder(vcs, projectRoot.getURL(), "branches", commitText);
                createRemoteFolder(vcs, projectRoot.getURL(), "tags", commitText);
            }
            return trunk;
    }
}
Also used : SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) NotNull(org.jetbrains.annotations.NotNull)

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