Search in sources :

Example 26 with SvnTarget

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

the class Merger method doMerge.

protected void doMerge() throws VcsException {
    SvnTarget source = SvnTarget.fromURL(myCurrentBranchUrl);
    MergeClient client = myVcs.getFactory(myTarget).createMergeClient();
    client.merge(source, myMergeChunk.revisionRange(), myTarget, Depth.INFINITY, mySvnConfig.isMergeDryRun(), myRecordOnly, true, mySvnConfig.getMergeOptions(), myHandler);
}
Also used : SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget)

Example 27 with SvnTarget

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

the class BranchesLoader method loadBranches.

@NotNull
public List<SvnBranchItem> loadBranches() throws SVNException, VcsException {
    SvnVcs vcs = SvnVcs.getInstance(myProject);
    SVNURL branchesUrl = SVNURL.parseURIEncoded(myUrl);
    List<SvnBranchItem> result = new LinkedList<>();
    SvnTarget target = SvnTarget.fromURL(branchesUrl);
    DirectoryEntryConsumer handler = createConsumer(result);
    vcs.getFactory(target).create(BrowseClient.class, !myPassive).list(target, SVNRevision.HEAD, Depth.IMMEDIATES, handler);
    Collections.sort(result);
    return result;
}
Also used : DirectoryEntryConsumer(org.jetbrains.idea.svn.browse.DirectoryEntryConsumer) BrowseClient(org.jetbrains.idea.svn.browse.BrowseClient) SVNURL(org.tmatesoft.svn.core.SVNURL) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) LinkedList(java.util.LinkedList) SvnVcs(org.jetbrains.idea.svn.SvnVcs) NotNull(org.jetbrains.annotations.NotNull)

Example 28 with SvnTarget

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

the class SvnKitCheckoutClient method runCheckout.

/**
   * This is mostly inlined {@code SVNUpdateClient.doCheckout()} - to allow specifying necessary working copy format. Otherwise, if only
   * {@link SvnWcGeneration} is used - either svn 1.6 or svn 1.8 working copy will be created.
   * <p/>
   * See also http://issues.tmatesoft.com/issue/SVNKIT-495 for more details.
   */
private static void runCheckout(@NotNull SVNUpdateClient client, @NotNull WorkingCopyFormat format, @NotNull SvnTarget source, @NotNull File destination, @Nullable SVNRevision revision, @Nullable Depth depth, boolean force) throws SVNException {
    SvnCheckout checkoutOperation = createCheckoutOperation(client, format);
    checkoutOperation.setUpdateLocksOnDemand(client.isUpdateLocksOnDemand());
    checkoutOperation.setSource(SvnTarget.fromURL(source.getURL(), source.getPegRevision()));
    checkoutOperation.setSingleTarget(SvnTarget.fromFile(destination));
    checkoutOperation.setRevision(revision);
    checkoutOperation.setDepth(toDepth(depth));
    checkoutOperation.setAllowUnversionedObstructions(force);
    checkoutOperation.setIgnoreExternals(client.isIgnoreExternals());
    checkoutOperation.setExternalsHandler(SvnCodec.externalsHandler(client.getExternalsHandler()));
    checkoutOperation.run();
}
Also used : SvnCheckout(org.tmatesoft.svn.core.wc2.SvnCheckout)

Example 29 with SvnTarget

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

the class CreateBranchOrTagAction method perform.

@Override
protected void perform(@NotNull SvnVcs vcs, @NotNull VirtualFile file, @NotNull DataContext context) throws VcsException {
    CreateBranchOrTagDialog dialog = new CreateBranchOrTagDialog(vcs.getProject(), true, virtualToIoFile(file));
    if (dialog.showAndGet()) {
        String dstURL = dialog.getToURL();
        SVNRevision revision = dialog.getRevision();
        String comment = dialog.getComment();
        Ref<Exception> exception = new Ref<>();
        boolean isSrcFile = dialog.isCopyFromWorkingCopy();
        File srcFile = new File(dialog.getCopyFromPath());
        SVNURL srcUrl;
        SVNURL dstSvnUrl;
        SVNURL parentUrl;
        try {
            srcUrl = SVNURL.parseURIEncoded(dialog.getCopyFromUrl());
            dstSvnUrl = SVNURL.parseURIEncoded(dstURL);
            parentUrl = dstSvnUrl.removePathTail();
        } catch (SVNException e) {
            throw new SvnBindException(e);
        }
        if (!dirExists(vcs, parentUrl)) {
            int rc = Messages.showYesNoDialog(vcs.getProject(), "The repository path '" + parentUrl + "' does not exist. Would you like to create it?", "Branch or Tag", Messages.getQuestionIcon());
            if (rc == Messages.NO) {
                return;
            }
        }
        Runnable copyCommand = () -> {
            try {
                ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
                CommitEventHandler handler = null;
                if (progress != null) {
                    progress.setText(SvnBundle.message("progress.text.copy.to", dstURL));
                    handler = new IdeaCommitHandler(progress);
                }
                SvnTarget source = isSrcFile ? SvnTarget.fromFile(srcFile, revision) : SvnTarget.fromURL(srcUrl, revision);
                long newRevision = vcs.getFactory(source).createCopyMoveClient().copy(source, SvnTarget.fromURL(dstSvnUrl), revision, true, false, comment, handler);
                updateStatusBar(newRevision, vcs.getProject());
            } catch (Exception e) {
                exception.set(e);
            }
        };
        ProgressManager.getInstance().runProcessWithProgressSynchronously(copyCommand, SvnBundle.message("progress.title.copy"), false, vcs.getProject());
        if (!exception.isNull()) {
            throw new VcsException(exception.get());
        }
        if (dialog.isCopyFromWorkingCopy() && dialog.isSwitchOnCreate()) {
            SingleRootSwitcher switcher = new SingleRootSwitcher(vcs.getProject(), VcsUtil.getFilePath(srcFile, srcFile.isDirectory()), dstSvnUrl);
            AutoSvnUpdater.run(switcher, SvnBundle.message("action.name.switch"));
        }
    }
}
Also used : IdeaCommitHandler(org.jetbrains.idea.svn.checkin.IdeaCommitHandler) SVNURL(org.tmatesoft.svn.core.SVNURL) CommitEventHandler(org.jetbrains.idea.svn.checkin.CommitEventHandler) SVNException(org.tmatesoft.svn.core.SVNException) SingleRootSwitcher(org.jetbrains.idea.svn.update.SingleRootSwitcher) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) VcsException(com.intellij.openapi.vcs.VcsException) SVNException(org.tmatesoft.svn.core.SVNException) Ref(com.intellij.openapi.util.Ref) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) VcsException(com.intellij.openapi.vcs.VcsException) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File)

Example 30 with SvnTarget

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

the class CmdDeleteClient method delete.

@Override
public long delete(@NotNull SVNURL url, @NotNull String message) throws VcsException {
    SvnTarget target = SvnTarget.fromURL(url);
    List<String> parameters = ContainerUtil.newArrayList();
    CommandUtil.put(parameters, target);
    parameters.add("--message");
    parameters.add(message);
    CmdCheckinClient.CommandListener listener = new CmdCheckinClient.CommandListener(null);
    execute(myVcs, target, SvnCommandName.delete, parameters, listener);
    return listener.getCommittedRevision();
}
Also used : CmdCheckinClient(org.jetbrains.idea.svn.checkin.CmdCheckinClient) BaseUpdateCommandListener(org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener) 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