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