use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnKitMergeClient method merge.
@Override
public void merge(@NotNull SvnTarget source1, @NotNull SvnTarget source2, @NotNull File destination, @Nullable Depth depth, boolean useAncestry, boolean dryRun, boolean recordOnly, boolean force, @Nullable DiffOptions diffOptions, @Nullable ProgressTracker handler) throws VcsException {
assertUrl(source1);
assertUrl(source2);
try {
createClient(diffOptions, handler).doMerge(source1.getURL(), source1.getPegRevision(), source2.getURL(), source2.getPegRevision(), destination, toDepth(depth), useAncestry, force, dryRun, recordOnly);
} catch (SVNException e) {
throw new VcsException(e);
}
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class BranchInfo method checkPaths.
@NotNull
private MultiMap<SvnMergeInfoCache.MergeCheckResult, String> checkPaths(@NotNull SvnChangeList list, @NotNull String branchPath, final String subPathUnderBranch) {
MultiMap<SvnMergeInfoCache.MergeCheckResult, String> result = MultiMap.create();
String myTrunkPathCorrespondingToLocalBranchPath = SVNPathUtil.append(myInfo.getCurrentBranch().getUrl(), subPathUnderBranch);
for (String path : list.getAffectedPaths()) {
String absoluteInTrunkPath = SVNPathUtil.append(myInfo.getRepoUrl(), path);
SvnMergeInfoCache.MergeCheckResult mergeCheckResult;
if (!absoluteInTrunkPath.startsWith(myTrunkPathCorrespondingToLocalBranchPath)) {
mergeCheckResult = SvnMergeInfoCache.MergeCheckResult.NOT_EXISTS;
} else {
String relativeToTrunkPath = absoluteInTrunkPath.substring(myTrunkPathCorrespondingToLocalBranchPath.length());
String localPathInBranch = new File(branchPath, relativeToTrunkPath).getAbsolutePath();
try {
mergeCheckResult = checkPathGoingUp(list.getNumber(), -1, branchPath, localPathInBranch, path, true);
} catch (VcsException | SVNException e) {
LOG.info(e);
mergeCheckResult = SvnMergeInfoCache.MergeCheckResult.NOT_MERGED;
}
}
result.putValue(mergeCheckResult, path);
// NOT_EXISTS. And currently we're only interested in not merged paths for change lists with NOT_MERGED status.
if (SvnMergeInfoCache.MergeCheckResult.NOT_EXISTS.equals(mergeCheckResult)) {
break;
}
}
return result;
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnHistoryProvider method reportAppendableHistory.
public void reportAppendableHistory(FilePath path, final VcsAppendableHistorySessionPartner partner, @Nullable final SVNRevision from, @Nullable final SVNRevision to, final int limit, SVNRevision peg, final boolean forceBackwards) throws VcsException {
FilePath committedPath = path;
Change change = ChangeListManager.getInstance(myVcs.getProject()).getChange(path);
if (change != null) {
final ContentRevision beforeRevision = change.getBeforeRevision();
final ContentRevision afterRevision = change.getAfterRevision();
if (beforeRevision != null && afterRevision != null && !beforeRevision.getFile().equals(afterRevision.getFile()) && afterRevision.getFile().equals(path)) {
committedPath = beforeRevision.getFile();
}
// revision can be VcsRevisionNumber.NULL
if (peg == null && change.getBeforeRevision() != null && change.getBeforeRevision().getRevisionNumber() instanceof SvnRevisionNumber) {
peg = ((SvnRevisionNumber) change.getBeforeRevision().getRevisionNumber()).getRevision();
}
}
boolean showMergeSources = myVcs.getSvnConfiguration().isShowMergeSourcesInAnnotate();
final LogLoader logLoader;
if (path.isNonLocal()) {
logLoader = new RepositoryLoader(myVcs, committedPath, from, to, limit, peg, forceBackwards, showMergeSources);
} else {
logLoader = new LocalLoader(myVcs, committedPath, from, to, limit, peg, showMergeSources);
}
try {
logLoader.preliminary();
} catch (SVNException e) {
throw new VcsException(e);
}
logLoader.check();
if (showMergeSources) {
logLoader.initSupports15();
}
final SvnHistorySession historySession = new SvnHistorySession(myVcs, Collections.emptyList(), committedPath, showMergeSources && Boolean.TRUE.equals(logLoader.mySupport15), null, false, !path.isNonLocal());
final Ref<Boolean> sessionReported = new Ref<>();
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.setText(SvnBundle.message("progress.text2.collecting.history", path.getName()));
}
final Consumer<VcsFileRevision> consumer = vcsFileRevision -> {
if (!Boolean.TRUE.equals(sessionReported.get())) {
partner.reportCreatedEmptySession(historySession);
sessionReported.set(true);
}
partner.acceptRevision(vcsFileRevision);
};
logLoader.setConsumer(consumer);
logLoader.load();
logLoader.check();
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnChangeList method patchChange.
private void patchChange(Change change, final String path) {
final SVNURL becameUrl;
SVNURL wasUrl;
try {
becameUrl = SVNURL.parseURIEncoded(SVNPathUtil.append(myRepositoryRoot, path));
wasUrl = becameUrl;
if (change instanceof ExternallyRenamedChange && change.getBeforeRevision() != null) {
String originUrl = ((ExternallyRenamedChange) change).getOriginUrl();
if (originUrl != null) {
// use another url for origin
wasUrl = SVNURL.parseURIEncoded(SVNPathUtil.append(myRepositoryRoot, originUrl));
}
}
} catch (SVNException e) {
// nothing to do
LOG.info(e);
return;
}
final FilePath filePath = ChangesUtil.getFilePath(change);
final Change additional = new Change(createPropertyRevision(filePath, change.getBeforeRevision(), wasUrl), createPropertyRevision(filePath, change.getAfterRevision(), becameUrl));
change.addAdditionalLayerElement(SvnChangeProvider.PROPERTY_LAYER, additional);
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnInfoHandler method switchPending.
private void switchPending() throws SAXException {
final org.jetbrains.idea.svn.info.Info info;
try {
info = myPending.convert();
} catch (SVNException e) {
throw new SAXException(e);
}
if (myInfoConsumer != null) {
myInfoConsumer.consume(info);
}
myResultsMap.put(info.getFile(), info);
myPending = createPending();
}
Aggregations