Search in sources :

Example 1 with GetLogsCommand

use of org.tigris.subversion.subclipse.core.commands.GetLogsCommand in project subclipse by subclipse.

the class MergeWizardUnblockRevisionsPage method getLogEntries.

protected ILogEntry[] getLogEntries(SVNRevision pegRevision, SVNRevision revisionStart, SVNRevision revisionEnd, boolean stopOnCopy, long limit, AliasManager tagManager, boolean includeMergedRevisions) throws TeamException {
    GetLogsCommand logCmd = new GetLogsCommand(remoteResource, pegRevision, revisionStart, revisionEnd, stopOnCopy, limit, tagManager, includeMergedRevisions);
    logCmd.run(null);
    return logCmd.getLogEntries();
}
Also used : GetLogsCommand(org.tigris.subversion.subclipse.core.commands.GetLogsCommand)

Example 2 with GetLogsCommand

use of org.tigris.subversion.subclipse.core.commands.GetLogsCommand in project subclipse by subclipse.

the class RevisionDetailsAction method run.

public void run() {
    remoteResource = null;
    logEntry = null;
    includeTags = SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE);
    BusyIndicator.showWhile(Display.getDefault(), new Runnable() {

        public void run() {
            try {
                RevisionGraphEditorInput input = (RevisionGraphEditorInput) editor.getEditorInput();
                ISVNInfo info = input.getInfo();
                ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(info.getRepository().toString());
                remoteResource = new RemoteFile(repository, new SVNUrl(repository.getLocation() + node.getPath()), new SVNRevision.Number(node.getRevision()));
                AliasManager tagManager = null;
                if (includeTags)
                    tagManager = new AliasManager(remoteResource.getUrl());
                SVNRevision pegRevision = new SVNRevision.Number(node.getRevision());
                SVNRevision revisionStart = new SVNRevision.Number(node.getRevision());
                SVNRevision revisionEnd = new SVNRevision.Number(node.getRevision());
                GetLogsCommand logCmd = new GetLogsCommand(remoteResource, pegRevision, revisionStart, revisionEnd, false, 0, tagManager, true);
                logCmd.run(null);
                ILogEntry[] logEntries = logCmd.getLogEntries();
                if (logEntries != null && logEntries.length > 0) {
                    logEntry = logEntries[0];
                }
            } catch (Exception e) {
                MessageDialog.openError(Display.getDefault().getActiveShell(), "Revision Info", e.getMessage());
            }
        }
    });
    if (logEntry != null) {
        ShowRevisionsDialog dialog = new ShowRevisionsDialog(Display.getDefault().getActiveShell(), logEntry, remoteResource, includeTags, null);
        dialog.setTitle("Revision Info");
        dialog.setSelectFirst(true);
        dialog.open();
    }
}
Also used : AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) RevisionGraphEditorInput(org.tigris.subversion.subclipse.graph.editors.RevisionGraphEditorInput) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ShowRevisionsDialog(org.tigris.subversion.subclipse.ui.dialogs.ShowRevisionsDialog) GetLogsCommand(org.tigris.subversion.subclipse.core.commands.GetLogsCommand) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 3 with GetLogsCommand

use of org.tigris.subversion.subclipse.core.commands.GetLogsCommand in project subclipse by subclipse.

the class Util method getUrlForRevision.

public static SVNUrl getUrlForRevision(ISVNRemoteResource resource, SVNRevision.Number revision, IProgressMonitor pm) throws SVNException {
    SVNUrl url = resource.getUrl();
    SVNRevision revisionStart = new SVNRevision.Number(revision.getNumber());
    GetLogsCommand getLogsCommand = new GetLogsCommand(resource, SVNRevision.HEAD, revisionStart, SVNRevision.HEAD, false, 0, null, true);
    getLogsCommand.run(pm);
    ILogEntry[] logEntries = getLogsCommand.getLogEntries();
    String path = resource.getRepositoryRelativePath().replaceAll("%20", " ");
    for (int i = logEntries.length - 1; i > -1; i--) {
        ILogEntry logEntry = logEntries[i];
        if (!logEntry.getRevision().equals(revision)) {
            LogEntryChangePath[] changePaths = logEntry.getLogEntryChangePaths();
            for (LogEntryChangePath changePath : changePaths) {
                if (changePath.getPath().equals(path) && changePath.getCopySrcPath() != null) {
                    try {
                        path = changePath.getCopySrcPath();
                        url = new SVNUrl(resource.getRepository().getRepositoryRoot().toString() + changePath.getCopySrcPath());
                    } catch (MalformedURLException e) {
                    }
                }
            }
        }
    }
    return url;
}
Also used : MalformedURLException(java.net.MalformedURLException) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) LogEntryChangePath(org.tigris.subversion.subclipse.core.history.LogEntryChangePath) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) GetLogsCommand(org.tigris.subversion.subclipse.core.commands.GetLogsCommand) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision)

Example 4 with GetLogsCommand

use of org.tigris.subversion.subclipse.core.commands.GetLogsCommand in project subclipse by subclipse.

the class CompareWithRevisionAction method execute.

/*
   * @see SVNAction#execute(IAction)
   */
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
    refresh = false;
    // Setup holders
    final ISVNRemoteResource[] resource = new ISVNRemoteResource[] { null };
    final ILogEntry[][] entries = new ILogEntry[][] { null };
    // Get the selected resource
    run(new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) {
            resource[0] = getSelectedRemoteResource();
        }
    }, false, /* cancelable */
    PROGRESS_BUSYCURSOR);
    if (resource[0] == null) {
        // No revisions for selected resource
        MessageDialog.openWarning(getShell(), Policy.bind("CompareWithRevisionAction.noRevisions"), // $NON-NLS-1$ //$NON-NLS-2$
        Policy.bind("CompareWithRevisionAction.noRevisionsLong"));
        return;
    }
    if (resource[0] instanceof IFile && !resource[0].getResource().isSynchronized(Depth.immediates)) {
        refresh = MessageDialog.openQuestion(getShell(), Policy.bind("DifferencesDialog.compare"), Policy.bind("CompareWithRemoteAction.fileChanged"));
    }
    // Fetch the log entries
    run(new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException {
            try {
                monitor.beginTask(Policy.bind("CompareWithRevisionAction.fetching"), // $NON-NLS-1$
                100);
                AliasManager tagManager = null;
                IResource[] resources = getSelectedResources();
                if (refresh)
                    resources[0].refreshLocal(Depth.immediates, monitor);
                if (resources.length == 1)
                    tagManager = new AliasManager(resources[0]);
                GetLogsCommand logCmd = new GetLogsCommand(resource[0], SVNRevision.HEAD, SVNRevision.HEAD, new SVNRevision.Number(0), false, 0, tagManager, false);
                logCmd.run(Policy.subMonitorFor(monitor, 100));
                entries[0] = logCmd.getLogEntries();
                monitor.done();
            } catch (Exception e) {
                throw new InvocationTargetException(e);
            }
        }
    }, true, /* cancelable */
    PROGRESS_DIALOG);
    if (entries[0] == null)
        return;
    final IResource selectedResource = getSelectedResources()[0];
    if (!(selectedResource instanceof IFile)) {
        HistoryDialog dialog = new HistoryDialog(getShell(), resource[0]);
        if (dialog.open() == HistoryDialog.CANCEL) {
            return;
        }
        ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
        if (selectedEntries.length == 0) {
            return;
        }
        ISVNRemoteFolder remoteFolder = new RemoteFolder(resource[0].getRepository(), selectedEntries[0].getResource().getUrl(), selectedEntries[0].getRevision());
        ((RemoteFolder) remoteFolder).setPegRevision(selectedEntries[0].getRevision());
        ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(selectedResource);
        try {
            SVNLocalCompareInput compareInput = new SVNLocalCompareInput(localResource, remoteFolder, SVNRevision.HEAD);
            CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
        } catch (SVNException e) {
            MessageDialog.openError(getShell(), getErrorTitle(), e.getMessage());
        }
        return;
    }
    // Show the compare viewer
    run(new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            SVNCompareRevisionsInput input = new SVNCompareRevisionsInput((IFile) selectedResource, entries[0]);
            if (SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_COMPARE_REVISION_IN_DIALOG)) {
                // running with a null progress monitor is fine because we have already pre-fetched
                // the log entries above.
                input.run(new NullProgressMonitor());
                SaveablePartDialog cd = createCompareDialog(getShell(), input);
                cd.setBlockOnOpen(true);
                cd.open();
            } else {
                CompareUI.openCompareEditorOnPage(input, getTargetPage());
            }
        }
    }, false, /* cancelable */
    PROGRESS_BUSYCURSOR);
}
Also used : HistoryDialog(org.tigris.subversion.subclipse.ui.dialogs.HistoryDialog) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) SVNLocalCompareInput(org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput) IFile(org.eclipse.core.resources.IFile) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNRemoteFolder(org.tigris.subversion.subclipse.core.ISVNRemoteFolder) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) InvocationTargetException(java.lang.reflect.InvocationTargetException) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) SVNCompareRevisionsInput(org.tigris.subversion.subclipse.ui.compare.SVNCompareRevisionsInput) GetLogsCommand(org.tigris.subversion.subclipse.core.commands.GetLogsCommand) IResource(org.eclipse.core.resources.IResource) SaveablePartDialog(org.eclipse.team.ui.SaveablePartDialog)

Example 5 with GetLogsCommand

use of org.tigris.subversion.subclipse.core.commands.GetLogsCommand in project subclipse by subclipse.

the class HistoryDialog method getLogEntries.

protected ILogEntry[] getLogEntries(ISVNRemoteResource remoteResource, SVNRevision pegRevision, SVNRevision revisionStart, SVNRevision revisionEnd, boolean stopOnCopy, long limit, AliasManager tagManager) throws TeamException {
    GetLogsCommand logCmd = new GetLogsCommand(remoteResource, pegRevision, revisionStart, revisionEnd, stopOnCopy, limit, tagManager, false);
    logCmd.run(null);
    return logCmd.getLogEntries();
}
Also used : GetLogsCommand(org.tigris.subversion.subclipse.core.commands.GetLogsCommand)

Aggregations

GetLogsCommand (org.tigris.subversion.subclipse.core.commands.GetLogsCommand)6 ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)3 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)3 SVNException (org.tigris.subversion.subclipse.core.SVNException)2 AliasManager (org.tigris.subversion.subclipse.core.history.AliasManager)2 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 MalformedURLException (java.net.MalformedURLException)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 IInformationControlCreator (org.eclipse.jface.text.IInformationControlCreator)1 Revision (org.eclipse.jface.text.revisions.Revision)1