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);
}
};
}
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()));
}
}
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;
}
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;
}
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);
}
}
Aggregations