Search in sources :

Example 1 with SvnPropertiesDiffRequest

use of org.jetbrains.idea.svn.difftool.properties.SvnPropertiesDiffRequest in project intellij-community by JetBrains.

the class SvnChangeDiffViewerProvider method createPropertyRequest.

@NotNull
private static SvnPropertiesDiffRequest createPropertyRequest(@NotNull Change change, @NotNull ProgressIndicator indicator) throws DiffRequestProducerException {
    try {
        Change propertiesChange = getSvnChangeLayer(change);
        if (propertiesChange == null)
            throw new DiffRequestProducerException(SvnBundle.getString("diff.cant.get.properties.changes"));
        ContentRevision bRevRaw = propertiesChange.getBeforeRevision();
        ContentRevision aRevRaw = propertiesChange.getAfterRevision();
        if (bRevRaw != null && !(bRevRaw instanceof PropertyRevision)) {
            LOG.warn("Before change is not PropertyRevision");
            throw new DiffRequestProducerException(SvnBundle.getString("diff.cant.get.properties.changes"));
        }
        if (aRevRaw != null && !(aRevRaw instanceof PropertyRevision)) {
            LOG.warn("After change is not PropertyRevision");
            throw new DiffRequestProducerException(SvnBundle.getString("diff.cant.get.properties.changes"));
        }
        PropertyRevision bRev = (PropertyRevision) bRevRaw;
        PropertyRevision aRev = (PropertyRevision) aRevRaw;
        indicator.checkCanceled();
        List<PropertyData> bContent = bRev != null ? bRev.getProperties() : null;
        indicator.checkCanceled();
        List<PropertyData> aContent = aRev != null ? aRev.getProperties() : null;
        if (aRev == null && bRev == null)
            throw new DiffRequestProducerException(SvnBundle.getString("diff.cant.get.properties.changes"));
        ContentRevision bRevMain = change.getBeforeRevision();
        ContentRevision aRevMain = change.getAfterRevision();
        String title1 = bRevMain != null ? StringUtil.nullize(bRevMain.getRevisionNumber().asString()) : null;
        String title2 = aRevMain != null ? StringUtil.nullize(aRevMain.getRevisionNumber().asString()) : null;
        return new SvnPropertiesDiffRequest(bContent, aContent, title1, title2);
    } catch (VcsException e) {
        throw new DiffRequestProducerException(e);
    }
}
Also used : DiffRequestProducerException(com.intellij.diff.chains.DiffRequestProducerException) PropertyData(org.jetbrains.idea.svn.properties.PropertyData) PropertyRevision(org.jetbrains.idea.svn.history.PropertyRevision) VcsException(com.intellij.openapi.vcs.VcsException) SvnPropertiesDiffRequest(org.jetbrains.idea.svn.difftool.properties.SvnPropertiesDiffRequest) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) Change(com.intellij.openapi.vcs.changes.Change) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DiffRequestProducerException (com.intellij.diff.chains.DiffRequestProducerException)1 VcsException (com.intellij.openapi.vcs.VcsException)1 Change (com.intellij.openapi.vcs.changes.Change)1 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)1 NotNull (org.jetbrains.annotations.NotNull)1 SvnPropertiesDiffRequest (org.jetbrains.idea.svn.difftool.properties.SvnPropertiesDiffRequest)1 PropertyRevision (org.jetbrains.idea.svn.history.PropertyRevision)1 PropertyData (org.jetbrains.idea.svn.properties.PropertyData)1