use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class SwitchAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
} else {
IResource[] resources = getSelectedResources();
// Use different wizard page name if multiple resources selected so that
// page size and location will be saved and restored separately for
// single selection switch and multiple selection switch.
String pageName;
if (resources.length > 1)
pageName = "SwitchDialogWithConflictHandling.multiple";
else
// $NON-NLS-1$
pageName = "SwitchDialogWithConflictHandling";
SvnWizardSwitchPage switchPage = new SvnWizardSwitchPage(pageName, resources);
SvnWizard wizard = new SvnWizard(switchPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.OK) {
SVNUrl[] svnUrls = switchPage.getUrls();
SVNRevision svnRevision = switchPage.getRevision();
SwitchOperation switchOperation = new SwitchOperation(getTargetPart(), resources, svnUrls, svnRevision);
switchOperation.setDepth(switchPage.getDepth());
switchOperation.setSetDepth(switchPage.isSetDepth());
switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
switchOperation.setForce(switchPage.isForce());
switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
switchOperation.setCanRunAsJob(canRunAsJob);
switchOperation.setConflictResolver(switchPage.getConflictResolver());
switchOperation.run();
}
}
}
use of org.tigris.subversion.svnclientadapter.SVNUrl 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.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class Cache method refresh.
public void refresh(List refreshedNodes, ISVNInfo info, IProgressMonitor monitor, int unitWorked) {
ISVNLogMessageCallback callback = new ISVNLogMessageCallback() {
public void singleMessage(ISVNLogMessage message) {
update(message, true);
}
};
revisionsTempFile = new File(root, "revisionsTemp");
logMessagesTempFile = new File(root, "logMessagesTemp");
revisionsTempFile.delete();
logMessagesTempFile.delete();
try {
revisionsTempFile.createNewFile();
logMessagesTempFile.createNewFile();
} catch (IOException e) {
Activator.handleError(e);
}
List revisions = new ArrayList();
Iterator iter = refreshedNodes.iterator();
while (iter.hasNext()) {
Node node = (Node) iter.next();
revisions.add(Long.toString(node.getRevision()));
}
startTempUpdate();
RandomAccessFile file = null;
ISVNClientAdapter client = null;
try {
client = SVNProviderPlugin.getPlugin().getSVNClient();
file = new RandomAccessFile(logMessagesFile, "r");
int revInt = new Long(getLatestRevision()).intValue();
while (file.getFilePointer() < file.length()) {
ISVNLogMessage lm = readNext(file, true);
level = 0;
int index = revisions.indexOf(lm.getRevision().toString());
if (index == -1) {
update(lm, true);
if (lm.hasChildren() && lm.getChildMessages() != null) {
updateChildren(lm, true);
}
monitor.worked(unitWorked / revInt);
} else {
Node updateNode = (Node) refreshedNodes.get(index);
SVNRevision updateRevision = new SVNRevision.Number(updateNode.getRevision());
client.getLogMessages(new SVNUrl(info.getRepository() + updateNode.getPath()), updateRevision, updateRevision, updateRevision, false, true, 0, true, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
monitor.worked(unitWorked);
// updateRevision = (ISVNLogMessage)refreshedMessages.get(index);
// monitor.worked(unitWorked);
}
if (monitor.isCanceled()) {
break;
}
}
} catch (Exception e) {
} finally {
closeFile(file);
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
finishTempUpdate();
if (monitor.isCanceled()) {
revisionsTempFile.delete();
logMessagesTempFile.delete();
return;
}
revisionsFile.delete();
logMessagesFile.delete();
revisionsTempFile.renameTo(revisionsFile);
logMessagesTempFile.renameTo(logMessagesFile);
}
use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.
the class SVNUrlWithPegRevision method parse.
private void parse(SVNUrl url) {
String urlString = url.toString();
if (!urlString.endsWith("@")) {
int index = urlString.lastIndexOf("@");
if (index != -1) {
String rev = urlString.substring(index + 1);
try {
pegRevision = SVNRevision.getRevision(rev);
} catch (ParseException e) {
}
if (pegRevision != null) {
urlString = urlString.substring(0, index);
try {
this.url = new SVNUrl(urlString);
} catch (MalformedURLException e) {
this.url = url;
pegRevision = null;
}
return;
}
}
}
this.url = url;
}
use of org.tigris.subversion.svnclientadapter.SVNUrl 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;
}
Aggregations