Search in sources :

Example 6 with SVNURL

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

the class ShowPropertiesDiffAction method createHandler.

@NotNull
private static PropertyConsumer createHandler(SVNRevision revision, @NotNull final List<PropertyData> lines) {
    final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
    if (indicator != null) {
        indicator.checkCanceled();
        indicator.setText(SvnBundle.message("show.properties.diff.progress.text.revision.information", revision.toString()));
    }
    return new PropertyConsumer() {

        public void handleProperty(final File path, final PropertyData property) throws SVNException {
            registerProperty(property);
        }

        public void handleProperty(final SVNURL url, final PropertyData property) throws SVNException {
            registerProperty(property);
        }

        public void handleProperty(final long revision, final PropertyData property) throws SVNException {
        // revision properties here
        }

        private void registerProperty(@NotNull PropertyData property) {
            if (indicator != null) {
                indicator.checkCanceled();
                indicator.setText2(SvnBundle.message("show.properties.diff.progress.text2.property.information", property.getName()));
            }
            lines.add(property);
        }
    };
}
Also used : PropertyConsumer(org.jetbrains.idea.svn.properties.PropertyConsumer) PropertyData(org.jetbrains.idea.svn.properties.PropertyData) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SVNURL(org.tmatesoft.svn.core.SVNURL) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with SVNURL

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

the class ProxyModule method setupProxy.

private void setupProxy(@NotNull Command command) {
    SVNURL repositoryUrl = command.requireRepositoryUrl();
    Proxy proxy = AuthenticationService.getIdeaDefinedProxy(repositoryUrl);
    if (proxy != null) {
        String hostGroup = ensureGroupForHost(command, repositoryUrl.getHost());
        InetSocketAddress address = (InetSocketAddress) proxy.address();
        command.put("--config-option");
        command.put(String.format("servers:%s:http-proxy-host=%s", hostGroup, address.getHostName()));
        command.put("--config-option");
        command.put(String.format("servers:%s:http-proxy-port=%s", hostGroup, address.getPort()));
    }
}
Also used : Proxy(java.net.Proxy) SVNURL(org.tmatesoft.svn.core.SVNURL) InetSocketAddress(java.net.InetSocketAddress)

Example 8 with SVNURL

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

the class DefaultBranchConfigInitializer method getDefaultConfiguration.

@NotNull
private static SvnBranchConfigurationNew getDefaultConfiguration(@NotNull SvnVcs vcs, @NotNull SVNURL url) throws SVNException, VcsException {
    SvnBranchConfigurationNew result = new SvnBranchConfigurationNew();
    result.setTrunkUrl(url.toString());
    SVNURL branchLocationsParent = getBranchLocationsParent(url);
    if (branchLocationsParent != null) {
        SvnTarget target = SvnTarget.fromURL(branchLocationsParent);
        vcs.getFactory(target).createBrowseClient().list(target, SVNRevision.HEAD, Depth.IMMEDIATES, createHandler(result, target.getURL()));
    }
    return result;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with SVNURL

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

the class DefaultBranchConfigInitializer method getDefaultConfiguration.

@Nullable
public SvnBranchConfigurationNew getDefaultConfiguration() {
    SvnBranchConfigurationNew result = null;
    SvnVcs vcs = SvnVcs.getInstance(myProject);
    SVNURL rootUrl = SvnUtil.getUrl(vcs, VfsUtilCore.virtualToIoFile(myRoot));
    if (rootUrl != null) {
        try {
            result = getDefaultConfiguration(vcs, rootUrl);
        } catch (SVNException | VcsException e) {
            LOG.info(e);
        }
    } else {
        LOG.info("Directory is not a working copy: " + myRoot.getPresentableUrl());
    }
    return result;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) VcsException(com.intellij.openapi.vcs.VcsException) SVNException(org.tmatesoft.svn.core.SVNException) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Nullable(org.jetbrains.annotations.Nullable)

Example 10 with SVNURL

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

the class SvnChangeProvider method processCopiedFile.

private void processCopiedFile(@NotNull SvnChangedFile copiedFile, @NotNull SvnChangeProviderContext context, @Nullable VcsDirtyScope dirtyScope) throws SVNException {
    boolean foundRename = false;
    final Status copiedStatus = copiedFile.getStatus();
    final String copyFromURL = ObjectUtils.assertNotNull(copiedFile.getCopyFromURL());
    final Set<SvnChangedFile> deletedToDelete = new HashSet<>();
    for (SvnChangedFile deletedFile : context.getDeletedFiles()) {
        final Status deletedStatus = deletedFile.getStatus();
        if (deletedStatus.getURL() != null && Comparing.equal(copyFromURL, deletedStatus.getURL().toString())) {
            final String clName = SvnUtil.getChangelistName(copiedFile.getStatus());
            applyMovedChange(context, copiedFile.getFilePath(), dirtyScope, deletedToDelete, deletedFile, copiedStatus, clName);
            for (SvnChangedFile deletedChild : context.getDeletedFiles()) {
                final Status childStatus = deletedChild.getStatus();
                final SVNURL childUrl = childStatus.getURL();
                if (childUrl == null) {
                    continue;
                }
                final String childURL = childUrl.toDecodedString();
                if (StringUtil.startsWithConcatenation(childURL, copyFromURL, "/")) {
                    String relativePath = childURL.substring(copyFromURL.length());
                    File newPath = new File(copiedFile.getFilePath().getIOFile(), relativePath);
                    FilePath newFilePath = myFactory.createFilePathOn(newPath);
                    if (!context.isDeleted(newFilePath)) {
                        applyMovedChange(context, newFilePath, dirtyScope, deletedToDelete, deletedChild, context.getTreeConflictStatus(newPath), clName);
                    }
                }
            }
            foundRename = true;
            break;
        }
    }
    final List<SvnChangedFile> deletedFiles = context.getDeletedFiles();
    for (SvnChangedFile file : deletedToDelete) {
        deletedFiles.remove(file);
    }
    // by building a relative url
    if (!foundRename && copiedStatus.getURL() != null) {
        File wcPath = myVcs.getSvnFileUrlMapping().getLocalPath(copyFromURL);
        if (wcPath != null) {
            Status status;
            try {
                status = myVcs.getFactory(wcPath).createStatusClient().doStatus(wcPath, false);
            } catch (SvnBindException ex) {
                LOG.info(ex);
                status = null;
            }
            if (status != null && status.is(StatusType.STATUS_DELETED)) {
                final FilePath filePath = myFactory.createFilePathOnDeleted(wcPath, false);
                final SvnContentRevision beforeRevision = SvnContentRevision.createBaseRevision(myVcs, filePath, status.getRevision());
                final ContentRevision afterRevision = CurrentContentRevision.create(copiedFile.getFilePath());
                context.getBuilder().processChangeInList(context.createMovedChange(beforeRevision, afterRevision, copiedStatus, status), SvnUtil.getChangelistName(status), SvnVcs.getKey());
                foundRename = true;
            }
        }
    }
    if (!foundRename) {
        // for debug
        LOG.info("Rename not found for " + copiedFile.getFilePath().getPresentableUrl());
        context.processStatus(copiedFile.getFilePath(), copiedStatus);
    }
}
Also used : FileStatus(com.intellij.openapi.vcs.FileStatus) Status(org.jetbrains.idea.svn.status.Status) FilePath(com.intellij.openapi.vcs.FilePath) SVNURL(org.tmatesoft.svn.core.SVNURL) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File)

Aggregations

SVNURL (org.tmatesoft.svn.core.SVNURL)93 SVNException (org.tmatesoft.svn.core.SVNException)37 File (java.io.File)31 SVNConfigFile (org.tmatesoft.svn.core.internal.wc.SVNConfigFile)15 VirtualFile (com.intellij.openapi.vfs.VirtualFile)13 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)8 VcsException (com.intellij.openapi.vcs.VcsException)7 Nullable (org.jetbrains.annotations.Nullable)7 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)7 SvnTarget (org.tmatesoft.svn.core.wc2.SvnTarget)7 ArrayList (java.util.ArrayList)6 NotNull (org.jetbrains.annotations.NotNull)6 Info (org.jetbrains.idea.svn.info.Info)6 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)5 FilePath (com.intellij.openapi.vcs.FilePath)4 SvnVcs (org.jetbrains.idea.svn.SvnVcs)3 SvnAuthenticationManager (org.jetbrains.idea.svn.auth.SvnAuthenticationManager)3 SVNDirEntry (org.tmatesoft.svn.core.SVNDirEntry)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 Project (com.intellij.openapi.project.Project)2