Java Code Examples for org.tigris.subversion.svnclientadapter.SVNRevision#HEAD
The following examples show how to use
org.tigris.subversion.svnclientadapter.SVNRevision#HEAD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SVNRepositoryLocation.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public ISVNRemoteFile getRemoteFile(SVNUrl url) throws SVNException{ ISVNClientAdapter svnClient = getSVNClient(); ISVNInfo info = null; try { if (this.getRepositoryRoot().equals(url)) return new RemoteFile(this, url, SVNRevision.HEAD); else info = svnClient.getInfo(url, SVNRevision.HEAD, SVNRevision.HEAD); } catch (SVNClientException e) { throw new SVNException( "Can't get latest remote resource for " + url); } if (info == null) return null; // no remote file else { return new RemoteFile(null, // we don't know its parent this, url, SVNRevision.HEAD, info.getLastChangedRevision(), info.getLastChangedDate(), info.getLastCommitAuthor()); } }
Example 2
Source File: ExportRemoteFolderDialog.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
protected void okPressed() { boolean success = true; SVNRevision revision = null; if (headButton.getSelection()) revision = SVNRevision.HEAD; else { int revisionNumber = Integer.parseInt(revisionText.getText().trim()); long revisionLong = revisionNumber; revision = new SVNRevision.Number(revisionLong); } File directory = new File(directoryText.getText().trim() + File.separator + remoteResource.getName()); try { new ExportRemoteFolderOperation(targetPart, remoteResource, directory, revision).run(); } catch (Exception e) { MessageDialog.openError(getShell(), Policy.bind("ExportRemoteFolderAction.directoryDialogText"), e.getMessage()); //$NON-NLS-1$ success = false; } if (!success) return; super.okPressed(); }
Example 3
Source File: ShowDifferencesAsUnifiedDiffOperation.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException { ISVNClientAdapter client = null; ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(fromUrl.toString()); if (repository != null) client = repository.getSVNClient(); if (client == null) client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient(); try { SVNRevision pegRevision = null; if (fromUrl.toString().equals(toUrl.toString()) && localResource != null) { if (localResource.getResource() == null) pegRevision = SVNRevision.HEAD; else { IResource resource = localResource.getResource(); ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource); pegRevision = svnResource.getRevision(); } } if (pegRevision == null) client.diff(fromUrl, fromRevision, toUrl, toRevision, file, true); else client.diff(fromUrl, pegRevision, fromRevision, toRevision, file, true); } catch (SVNClientException e) { throw SVNException.wrapException(e); } finally { monitor.done(); SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client); } }
Example 4
Source File: AnnotationBar.java From netbeans with Apache License 2.0 | 6 votes |
private void revert(File file, String revision) { final Context ctx = new Context(file); final SVNUrl url; try { url = SvnUtils.getRepositoryRootUrl(file); } catch (SVNClientException ex) { SvnClientExceptionHandler.notifyException(ex, true, true); return; } final RepositoryFile repositoryFile = new RepositoryFile(url, url, SVNRevision.HEAD); final RevertModifications revertModifications = new RevertModifications(repositoryFile, revision); if(!revertModifications.showDialog()) { return; } RequestProcessor rp = Subversion.getInstance().getRequestProcessor(url); SvnProgressSupport support = new SvnProgressSupport() { @Override public void perform() { RevertModificationsAction.performRevert(revertModifications.getRevisionInterval(), revertModifications.revertNewFiles(), !revertModifications.revertRecursively(), ctx, this); } }; support.start(rp, url, NbBundle.getMessage(AnnotationBar.class, "MSG_Revert_Progress")); // NOI18N }
Example 5
Source File: CheckoutWizardCheckoutAsWithProjectFilePage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public SVNRevision getRevision() { if (headButton.getSelection()) return SVNRevision.HEAD; SVNRevision svnRevision = null; try { svnRevision = SVNRevision.getRevision(revisionText.getText().trim()); } catch (ParseException e) {} if (svnRevision == null) return SVNRevision.HEAD; return svnRevision; }
Example 6
Source File: SvnWizardCompareMultipleResourcesWithBranchTagPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public boolean performFinish() { urlCombo.saveUrl(); try { if (urlStrings.length > 1) { urls = new SVNUrl[compareResources.length]; for (int i = 0; i < compareResources.length; i++) { if (urlCombo.getText().endsWith("/")) //$NON-NLS-1$ urls[i] = new SVNUrl(urlCombo.getText() + compareResources[i].getPartialPath()); else urls[i] = new SVNUrl(urlCombo.getText() + "/" + compareResources[i].getPartialPath()); //$NON-NLS-1$ } } else { urls = new SVNUrl[1]; urls[0] = new SVNUrl(urlCombo.getText()); } if (headButton.getSelection()) revision = SVNRevision.HEAD; else { try { revision = SVNRevision.getRevision(revisionText.getText().trim()); } catch (ParseException e1) { MessageDialog.openError(getShell(), Policy.bind("SvnWizardCompareMultipleResourcesWithBranchTagPage.0"), Policy.bind("SwitchDialog.invalid")); //$NON-NLS-1$ //$NON-NLS-2$ return false; } } } catch (MalformedURLException e) { MessageDialog.openError(getShell(), Policy.bind("SvnWizardCompareMultipleResourcesWithBranchTagPage.0"), e.getMessage()); //$NON-NLS-1$ return false; } return true; }
Example 7
Source File: SVNLocalBaseCompareInput.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public SVNLocalBaseCompareInput(ISVNLocalResource[] resources, SVNRevision revision, boolean readOnly) throws SVNException, SVNClientException { super(new CompareConfiguration()); this.remoteRevision = revision; this.readOnly = readOnly; localResourceNodes = new SVNLocalResourceNode[resources.length]; remoteResourceNodes = new ResourceEditionNode[resources.length]; for (int i = 0; i < resources.length; i++) { localResourceNodes[i] = new SVNLocalResourceNode(resources[i]); ISVNRemoteResource remoteResource = null; LocalResourceStatus status = resources[i].getStatus(); if (status != null && status.isCopied()) { ISVNClientAdapter svnClient = null; try { svnClient = resources[i].getRepository().getSVNClient(); ISVNInfo info = svnClient.getInfoFromWorkingCopy(resources[i].getFile()); SVNUrl copiedFromUrl = info.getCopyUrl(); if (copiedFromUrl != null) { GetRemoteResourceCommand getRemoteResourceCommand = new GetRemoteResourceCommand(resources[i].getRepository(), copiedFromUrl, SVNRevision.HEAD); getRemoteResourceCommand.run(null); remoteResource = getRemoteResourceCommand.getRemoteResource(); } } finally { resources[i].getRepository().returnSVNClient(svnClient); } } if (remoteResource == null) remoteResource = resources[i].getRemoteResource(revision); remoteResourceNodes[i] = new ResourceEditionNode(remoteResource); remoteResourceNodes[i].setLocalResource(localResourceNodes[i]); localResourceNodes[i].setRemoteResource(remoteResourceNodes[i]); } }
Example 8
Source File: RevisionSetupSupportTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testDiffModifiedDifferentNames () throws Exception { // init File project = new File(wc, "project"); File trunk = new File(project, "trunk"); final File file = new File(trunk, "file"); trunk.mkdirs(); file.createNewFile(); add(project); commit(project); RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/project/trunk", SVNRevision.HEAD); RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/project/branches/B", SVNRevision.HEAD); getClient().copy(left.getFileUrl(), right.getFileUrl(), "copying...", SVNRevision.HEAD, true); TestKit.write(file, "modification"); commit(trunk); final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(new File[] { trunk })); final AtomicReference<Setup[]> ref = new AtomicReference<>(); new SvnProgressSupport() { @Override protected void perform () { ref.set(revSupp.computeSetupsBetweenRevisions(this)); } }.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished(); Setup[] setups = ref.get(); assertNotNull(setups); assertEquals(1, setups.length); assertEquals(file, setups[0].getBaseFile()); assertEquals(FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY, setups[0].getInfo().getStatus()); }
Example 9
Source File: RevisionSetupSupportTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testDiffModifiedFile () throws Exception { // init File trunk = new File(wc, "trunk"); File folder = new File(trunk, "folder"); File file = new File(folder, "file"); folder.mkdirs(); file.createNewFile(); add(trunk); commit(trunk); RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/trunk/folder", SVNRevision.HEAD); RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/branches/B/folder", SVNRevision.HEAD); getClient().copy(left.getFileUrl(), right.getFileUrl(), "copying...", SVNRevision.HEAD, true); TestKit.write(file, "modification"); commit(file); final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(folder)); final AtomicReference<Setup[]> ref = new AtomicReference<>(); new SvnProgressSupport() { @Override protected void perform () { ref.set(revSupp.computeSetupsBetweenRevisions(this)); } }.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished(); Setup[] setups = ref.get(); assertNotNull(setups); assertEquals(1, setups.length); assertEquals(file, setups[0].getBaseFile()); assertEquals(FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY, setups[0].getInfo().getStatus()); }
Example 10
Source File: RevisionSetupSupportTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testDiffNoChange () throws Exception { // init File trunk = new File(wc, "trunk"); File folder = new File(trunk, "folder"); File file = new File(folder, "file"); folder.mkdirs(); file.createNewFile(); add(trunk); commit(trunk); RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/trunk/folder", SVNRevision.HEAD); RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/branches/B/folder", SVNRevision.HEAD); getClient().copy(left.getFileUrl(), right.getFileUrl(), "copying...", SVNRevision.HEAD, true); final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(folder)); final AtomicReference<Setup[]> ref = new AtomicReference<>(); new SvnProgressSupport() { @Override protected void perform () { ref.set(revSupp.computeSetupsBetweenRevisions(this)); } }.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished(); Setup[] setups = ref.get(); assertNotNull(setups); assertEquals(0, setups.length); }
Example 11
Source File: ResourceEditionNode.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Creates a new ResourceEditionNode on the given resource edition. */ public ResourceEditionNode(ISVNRemoteResource resourceEdition, SVNRevision pegRevision) { this.resource = resourceEdition; this.pegRevision = pegRevision; if (pegRevision == null) { pegRevision = SVNRevision.HEAD; } if (resource instanceof RemoteFolder) { ((RemoteFolder)resource).setPegRevision(pegRevision); } else if (resource instanceof RemoteFile) { ((RemoteFile)resource).setPegRevision(pegRevision); } }
Example 12
Source File: SVNLocalCompareInput.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * @throws SVNException * creates a SVNLocalCompareInput, allows setting whether the current local resource is read only or not. */ public SVNLocalCompareInput(ISVNLocalResource resource, SVNRevision revision, boolean readOnly) throws SVNException, SVNClientException { super(new CompareConfiguration()); this.remoteRevision = revision; this.readOnly = readOnly; this.resource = resource; LocalResourceStatus status = resource.getStatus(); if (status != null && status.isCopied()) { ISVNClientAdapter svnClient = null; try { svnClient = resource.getRepository().getSVNClient(); ISVNInfo info = svnClient.getInfoFromWorkingCopy(resource.getFile()); SVNUrl copiedFromUrl = info.getCopyUrl(); if (copiedFromUrl != null) { GetRemoteResourceCommand getRemoteResourceCommand = new GetRemoteResourceCommand(resource.getRepository(), copiedFromUrl, SVNRevision.HEAD); getRemoteResourceCommand.run(null); this.remoteResource = getRemoteResourceCommand.getRemoteResource(); } } finally { resource.getRepository().returnSVNClient(svnClient); } } // SVNRevision can be any valid revision : BASE, HEAD, number ... if (this.remoteResource == null) this.remoteResource = resource.getRemoteResource(revision); // remoteResouce can be null if there is no corresponding remote resource // (for example no base because resource has just been added) }
Example 13
Source File: SVNRepositoryLocation.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private SVNRepositoryLocation(String user, String password, SVNUrl url, SVNUrl repositoryRootUrl) { this.user = user; this.url = url; this.repositoryRootUrl = repositoryRootUrl; rootFolder = new RemoteFolder(this, url, SVNRevision.HEAD); }
Example 14
Source File: RepositoryPaths.java From netbeans with Apache License 2.0 | 5 votes |
public SVNRevision getRevision() { if (revisionTextField == null) { return SVNRevision.HEAD; } String revisionString = getRevisionString(); if (revisionString.equals("")) { return SVNRevision.HEAD; } return SvnUtils.getSVNRevision(revisionString); }
Example 15
Source File: UpdateToAction.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected SVNRevision getRevision(Context ctx) { File[] roots = ctx.getRootFiles(); SVNRevision revision = null; if(roots == null || roots.length == 0) return null; File interestingFile = roots[0]; final SVNUrl rootUrl; final SVNUrl url; try { rootUrl = SvnUtils.getRepositoryRootUrl(interestingFile); url = SvnUtils.getRepositoryUrl(interestingFile); } catch (SVNClientException ex) { SvnClientExceptionHandler.notifyException(ex, true, true); return null; } final RepositoryFile repositoryFile = new RepositoryFile(rootUrl, url, SVNRevision.HEAD); final UpdateTo updateTo = new UpdateTo(repositoryFile, Subversion.getInstance().getStatusCache().containsFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE, true)); if(updateTo.showDialog()) { revision = updateTo.getSelectedRevision(); } return revision; }
Example 16
Source File: AbstractJhlClientAdapter.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private SVNDiffSummary[] diffSummarize(String target1, SVNRevision revision1, String target2, SVNRevision revision2, int depth, boolean ignoreAncestry) throws SVNClientException { try { notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF); if (revision1 == null) revision1 = SVNRevision.HEAD; if (revision2 == null) revision2 = SVNRevision.HEAD; String commandLine = "diff --summarize"; Depth d = JhlConverter.depth(depth); commandLine += depthCommandLine(d); if (ignoreAncestry) commandLine += " --ignoreAncestry"; commandLine += " " + target1 + "@" + revision1 + " " + target2 + "@" + revision2; notificationHandler.logCommandLine(commandLine); notificationHandler.setBaseDir(); JhlDiffSummaryReceiver callback = new JhlDiffSummaryReceiver(); svnClient.diffSummarize(target1, JhlConverter.convert(revision1), target2, JhlConverter.convert(revision2), d, null, ignoreAncestry, callback); return callback.getDiffSummary(); } catch (ClientException e) { notificationHandler.logException(e); throw new SVNClientException(e); } }
Example 17
Source File: SummaryEditionNode.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public SummaryEditionNode(ISVNRemoteResource resourceEdition) { this(resourceEdition, SVNRevision.HEAD); }
Example 18
Source File: RevisionSetupSupportTest.java From netbeans with Apache License 2.0 | 4 votes |
public void testDiffModifiedMultiFile () throws Exception { // init File trunk = new File(wc, "trunk"); File folder = new File(trunk, "folder"); final File file = new File(folder, "file.a"); final File file2 = new File(folder, "file.b"); folder.mkdirs(); file.createNewFile(); file2.createNewFile(); add(trunk); commit(trunk); RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/trunk/folder/" + file.getName(), SVNRevision.HEAD); RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/branches/B/folder/" + file.getName(), SVNRevision.HEAD); getClient().copy(left.getFileUrl(), right.getFileUrl(), "copying...", SVNRevision.HEAD, true); left = new RepositoryFile(repoUrl, wc.getName() + "/trunk/folder/" + file2.getName(), SVNRevision.HEAD); right = new RepositoryFile(repoUrl, wc.getName() + "/branches/B/folder/" + file2.getName(), SVNRevision.HEAD); getClient().copy(left.getFileUrl(), right.getFileUrl(), "copying...", SVNRevision.HEAD, true); TestKit.write(file, "modification"); TestKit.write(file2, "modification"); commit(folder); final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(new File[] { file, file2 })) { @Override protected File[] getRoots () { return new File[] { file, file2 }; } }; final AtomicReference<Setup[]> ref = new AtomicReference<>(); new SvnProgressSupport() { @Override protected void perform () { ref.set(revSupp.computeSetupsBetweenRevisions(this)); } }.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished(); Setup[] setups = ref.get(); assertNotNull(setups); assertEquals(2, setups.length); assertEquals(new HashSet<>(Arrays.asList(file, file2)), new HashSet<>(Arrays.asList(setups[0].getBaseFile(), setups[1].getBaseFile()))); assertEquals(FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY, setups[0].getInfo().getStatus()); assertEquals(FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY, setups[1].getInfo().getStatus()); }
Example 19
Source File: GetLogsCommand.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * execute the command * @param aMonitor * @throws SVNException */ public void run(IProgressMonitor aMonitor) throws SVNException { ISVNRepositoryLocation repository = null; ISVNClientAdapter svnClient = null; logEntries = null; IProgressMonitor monitor = Policy.monitorFor(aMonitor); monitor.beginTask(Policy.bind("RemoteFile.getLogEntries"), 100); //$NON-NLS-1$ ISVNLogMessage[] logMessages; try { if (callback == null) { logMessages = remoteResource.getLogMessages( pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions); } else { repository = remoteResource.getRepository(); svnClient = repository.getSVNClient(); if (remoteResource instanceof BaseResource) { boolean logMessagesRetrieved = false; ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(remoteResource.getResource()); if (svnResource != null) { LocalResourceStatus status = svnResource.getStatus(); if (status != null && status.isCopied()) { ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile()); SVNUrl copiedFromUrl = info.getCopyUrl(); if (copiedFromUrl != null) { svnClient.getLogMessages(copiedFromUrl, SVNRevision.HEAD, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback); logMessagesRetrieved = true; GetRemoteResourceCommand getRemoteResourceCommand = new GetRemoteResourceCommand(remoteResource.getRepository(), copiedFromUrl, SVNRevision.HEAD); getRemoteResourceCommand.run(null); remoteResource = getRemoteResourceCommand.getRemoteResource(); } } } if (!logMessagesRetrieved) svnClient.getLogMessages(((BaseResource)remoteResource).getFile(), pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback); } else { svnClient.getLogMessages(remoteResource.getUrl(), pegRevision, revisionStart, revisionEnd, stopOnCopy, !SVNProviderPlugin.getPlugin().getSVNClientManager().isFetchChangePathOnDemand(), limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback); } logMessages = callback.getLogMessages(); } if (remoteResource.isFolder()) { logEntries = LogEntry.createLogEntriesFrom((ISVNRemoteFolder) remoteResource, logMessages, getTags(logMessages)); } else { logEntries = LogEntry.createLogEntriesFrom((ISVNRemoteFile) remoteResource, logMessages, getTags(logMessages), getUrls(logMessages)); } } catch (Exception e) { throw SVNException.wrapException(e); } finally { if (repository != null) { repository.returnSVNClient(svnClient); } monitor.done(); } }
Example 20
Source File: GetLogsCommand.java From APICloud-Studio with GNU General Public License v3.0 | 3 votes |
/** * Constructor * * @param remoteResource * @param pegRevision peg revision for URL * @param revisionStart first revision to show * @param revisionEnd last revision to show * @param stopOnCopy do not continue on copy operations * @param limit limit the number of log messages (if 0 or less no * limit) * @param tagManager used to determine tags for revision */ public GetLogsCommand(ISVNRemoteResource remoteResource, SVNRevision pegRevision, SVNRevision revisionStart, SVNRevision revisionEnd, boolean stopOnCopy, long limit, AliasManager tagManager, boolean includeMergedRevisions) { this.remoteResource = remoteResource; this.pegRevision = (pegRevision != null) ? pegRevision : SVNRevision.HEAD; this.revisionStart = revisionStart; this.revisionEnd = (revisionEnd != null) ? revisionEnd : SVNRevision.HEAD; this.stopOnCopy = stopOnCopy; this.limit = limit; this.tagManager = tagManager; this.includeMergedRevisions = includeMergedRevisions; }