Java Code Examples for org.tigris.subversion.svnclientadapter.ISVNClientAdapter#checkout()
The following examples show how to use
org.tigris.subversion.svnclientadapter.ISVNClientAdapter#checkout() .
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: TestKit.java From netbeans with Apache License 2.0 | 6 votes |
public static void svnimport(File repoDir, File wc) throws SVNClientException, MalformedURLException { ISVNClientAdapter client = getClient(); String url = TestUtilities.formatFileURL(repoDir); SVNUrl repoUrl = new SVNUrl(url); client.mkdir(repoUrl.appendPath(wc.getName()), "msg"); client.checkout(repoUrl.appendPath(wc.getName()), wc, SVNRevision.HEAD, true); File[] files = wc.listFiles(); if(files != null) { for (File file : files) { if(!isMetadata(file)) { client.addFile(file); } } client.commit(new File[] {wc}, "commit", true); } Subversion.getInstance().versionedFilesChanged(); }
Example 2
Source File: AbstractSvnTestCase.java From netbeans with Apache License 2.0 | 6 votes |
protected void svnimportWC() throws SVNClientException { ISVNClientAdapter client = getFullWorkingClient(); SVNUrl url = getTestUrl().appendPath(wc.getName()); try { client.mkdir(url, true, "msg"); } catch (SVNClientException ex) { } client.checkout(url, wc, SVNRevision.HEAD, true); File[] files = wc.listFiles(); if(files != null) { for (File file : files) { if(!isMetadata(file)) { client.addFile(file); } } client.commit(new File[] {wc}, "commit", true); } }
Example 3
Source File: AbstractSvnTestCase.java From netbeans with Apache License 2.0 | 6 votes |
protected void importFile(File folder) throws SVNClientException { ISVNClientAdapter client = getFullWorkingClient(); SVNUrl url = getTestUrl().appendPath(folder.getName()); client.mkdir(url, true, "msg"); client.checkout(url, folder, SVNRevision.HEAD, true); File[] files = folder.listFiles(); if(files != null) { for (File file : files) { if(!isMetadata(file)) { if (file.isDirectory()) { client.addDirectory(file, true); } else { client.addFile(file); } } } client.commit(new File[] {folder}, "commit", true); } }
Example 4
Source File: SvnFileSystemTest.java From netbeans with Apache License 2.0 | 6 votes |
private void repoinit() throws IOException { try { File repoDir = getRepoDir(); File wc = getWorkDir(); if (!repoDir.exists()) { repoDir.mkdirs(); String[] cmd = {"svnadmin", "create", repoDir.getAbsolutePath()}; Process p = Runtime.getRuntime().exec(cmd); p.waitFor(); } ISVNClientAdapter client = getClient(getRepoUrl()); SVNUrl url = getRepoUrl().appendPath(getWorkDir().getName()); client.mkdir(url, "mkdir"); client.checkout(url, wc, SVNRevision.HEAD, true); } catch (Exception ex) { throw new IOException(ex.getMessage()); } }
Example 5
Source File: CheckoutTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testCheckoutFolder(String repoFolderName, String targetFolderName) throws Exception { File cifolder = createFolder(repoFolderName); File folder1 = createFolder(cifolder, "folder1"); File file = createFile(folder1, "file"); importFile(cifolder); File checkout = createFolder(targetFolderName); SVNUrl url = getTestUrl().appendPath(cifolder.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, checkout, SVNRevision.HEAD, true); File chFolder1 = new File(checkout, folder1.getName()); File chFile = new File(chFolder1, file.getName()); assertTrue(chFolder1.exists()); assertTrue(chFile.exists()); assertStatus(SVNStatusKind.NORMAL, checkout); assertStatus(SVNStatusKind.NORMAL, chFolder1); assertStatus(SVNStatusKind.NORMAL, chFile); assertNotifiedFiles(new File[] {chFolder1, chFile}); }
Example 6
Source File: CheckoutCommand.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * @param pm * @param resource * @param svnClient * @param destPath * @throws SVNException */ private void checkoutProject(final IProgressMonitor pm, ISVNRemoteFolder resource, ISVNClientAdapter svnClient, File destPath) throws SVNException { final IProgressMonitor subPm = Policy.infiniteSubMonitorFor(pm, 800); try { subPm.beginTask("", Policy.INFINITE_PM_GUESS_FOR_CHECKOUT); // If checking out a specific revision, check to see if the location has changed in the // repository and adjust the URL if it has. SVNUrl url; if (svnRevision instanceof SVNRevision.Number) { url = Util.getUrlForRevision(resource, (SVNRevision.Number)svnRevision, subPm); } else { url = resource.getUrl(); } svnClient.checkout(url, destPath, svnRevision, depth, ignoreExternals, force); } catch (SVNClientException e) { throw new SVNException("cannot checkout", e.operationInterrupted()); } finally { subPm.done(); } }
Example 7
Source File: CheckoutTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
private void testCheckoutFiles(String... fileNames) throws Exception { File folder = createFolder(CI_FOLDER); List<File> files = new ArrayList<File>(4); for (String fileName : fileNames) { files.add(createFile(folder, fileName)); } importFile(folder); File checkout = createFolder("checkoutfolder"); SVNUrl url = getTestUrl().appendPath(folder.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, checkout, SVNRevision.HEAD, true); assertStatus(SVNStatusKind.NORMAL, checkout); List<File> chFiles = new ArrayList<File>(files.size()); for (File file : files) { File chFile = new File(checkout, file.getName()); assertTrue(chFile.exists()); assertStatus(SVNStatusKind.NORMAL, chFile); chFiles.add(chFile); } assertNotifiedFiles(chFiles.toArray(new File[chFiles.size()])); }
Example 8
Source File: CheckoutTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
public void testCheckoutFolderNonRecursivelly() throws Exception { File cifolder = createFolder(CI_FOLDER); File folder1 = createFolder(cifolder, "folder1"); File file = createFile(folder1, "file"); importFile(cifolder); File checkout = createFolder("checkoutfolder"); SVNUrl url = getTestUrl().appendPath(cifolder.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, checkout, SVNRevision.HEAD, false); File chFolder1 = new File(checkout, folder1.getName()); File chFile = new File(chFolder1, file.getName()); if(isCommandLine()) { assertFalse(chFolder1.exists()); } else { assertTrue(chFolder1.exists()); } assertFalse(chFile.exists()); assertStatus(SVNStatusKind.NORMAL, checkout); if(isCommandLine()) { assertStatus(SVNStatusKind.UNVERSIONED, chFolder1); } else { assertStatus(SVNStatusKind.NORMAL, chFolder1); } assertStatus(SVNStatusKind.NONE, chFile); assertNotifiedFiles(new File[] {}); }
Example 9
Source File: CheckoutTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
private void testCheckoutFolderPrevRevision(String repoFolderName) throws Exception { File cifolder = createFolder(repoFolderName); File folder1 = createFolder(cifolder, "folder1"); File file = createFile(folder1, "file"); importFile(cifolder); SVNRevision revision = getRevision(getRepoUrl()); File addedFile = createFile(folder1, "addedfile"); add(addedFile); commit(cifolder); assertStatus(SVNStatusKind.NORMAL, addedFile); File checkout = createFolder("checkoutfolder"); SVNUrl url = getTestUrl().appendPath(cifolder.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, checkout, revision, true); File chFolder1 = new File(checkout, folder1.getName()); File chFile = new File(chFolder1, file.getName()); File chAddedFile = new File(chFolder1, addedFile.getName()); assertTrue(chFolder1.exists()); assertTrue(chFile.exists()); assertTrue(!chAddedFile.exists()); assertStatus(SVNStatusKind.NORMAL, checkout); assertStatus(SVNStatusKind.NORMAL, chFolder1); assertStatus(SVNStatusKind.NORMAL, chFile); assertStatus(SVNStatusKind.NONE, chAddedFile); assertNotifiedFiles(new File[] {chFolder1, chFile}); }
Example 10
Source File: UpdateTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
private void testUpdateFile(String folder1Name, String folder2Name, String fileName) throws Exception { File wc1 = createFolder(folder1Name); File file1 = createFile(wc1, fileName); write(file1, 1); importFile(wc1); assertStatus(SVNStatusKind.NORMAL, wc1); assertStatus(SVNStatusKind.NORMAL, file1); File wc2 = createFolder(folder2Name); File file2 = new File(wc2, fileName); SVNUrl url = getTestUrl().appendPath(wc1.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, wc2, SVNRevision.HEAD, true); assertStatus(SVNStatusKind.NORMAL, file2); assertContents(file2, 1); SVNRevision revisionBefore = (SVNRevision.Number) getRevision(getRepoUrl()); write(file2, 2); assertStatus(SVNStatusKind.MODIFIED, file2); commit(file2); assertStatus(SVNStatusKind.NORMAL, file2); clearNotifiedFiles(); long r = c.update(file1, SVNRevision.HEAD, false); SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl()); assertNotSame(revisionBefore, revisionAfter); assertEquals(((SVNRevision.Number)revisionAfter).getNumber(), r); assertStatus(SVNStatusKind.NORMAL, file1); assertContents(file1, 2); assertNotifiedFiles(new File[] {file1}); }
Example 11
Source File: UpdateTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
private void testUpdateFilePrevRevision(String folder1Name, String folder2Name, String fileName) throws Exception { File wc1 = createFolder(folder1Name); File file1 = createFile(wc1, fileName); write(file1, 1); importFile(wc1); assertStatus(SVNStatusKind.NORMAL, wc1); assertStatus(SVNStatusKind.NORMAL, file1); File wc2 = createFolder(folder2Name); File file2 = new File(wc2, fileName); SVNUrl url = getTestUrl().appendPath(wc1.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, wc2, SVNRevision.HEAD, true); assertStatus(SVNStatusKind.NORMAL, file2); assertContents(file2, 1); SVNRevision prevRev = (SVNRevision.Number) getRevision(getRepoUrl()); write(file2, 2); assertStatus(SVNStatusKind.MODIFIED, file2); commit(file2); assertStatus(SVNStatusKind.NORMAL, file2); clearNotifiedFiles(); long r = c.update(file1, prevRev, false); SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl()); assertNotSame(r, ((SVNRevision.Number)revisionAfter).getNumber()); assertEquals(((SVNRevision.Number)prevRev).getNumber(), r); assertStatus(SVNStatusKind.NORMAL, file1); assertContents(file1, 1); assertNotifiedFiles(new File[] { /*file1*/ }); // XXX no output from cli! }
Example 12
Source File: UpdateTestHidden.java From netbeans with Apache License 2.0 | 4 votes |
public void testUpdateFolderRecusivelly() throws Exception { File wc1 = createFolder("wc1"); File fileA1 = createFile(wc1, "fileA"); File fileB1 = createFile(wc1, "fileB"); File folder1 = createFolder(wc1, "folder"); File fileC1 = createFile(folder1, "fileC"); write(fileA1, 1); write(fileB1, 1); write(fileC1, 1); importFile(wc1); assertStatus(SVNStatusKind.NORMAL, wc1); assertStatus(SVNStatusKind.NORMAL, fileA1); assertStatus(SVNStatusKind.NORMAL, fileB1); assertStatus(SVNStatusKind.NORMAL, fileC1); File wc2 = createFolder("wc2"); File fileA2 = new File(wc2, "fileA"); File fileB2 = new File(wc2, "fileB"); File fileC2 = new File(new File(wc2, folder1.getName()), "fileC"); SVNUrl url = getTestUrl().appendPath(wc1.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, wc2, SVNRevision.HEAD, true); assertStatus(SVNStatusKind.NORMAL, fileA2); assertStatus(SVNStatusKind.NORMAL, fileB2); assertStatus(SVNStatusKind.NORMAL, fileC2); assertContents(fileA2, 1); assertContents(fileB2, 1); assertContents(fileC2, 1); SVNRevision revisionBefore = (SVNRevision.Number) getRevision(getRepoUrl()); write(fileA2, 2); write(fileB2, 2); write(fileC2, 2); assertStatus(SVNStatusKind.MODIFIED, fileA2); assertStatus(SVNStatusKind.MODIFIED, fileB2); assertStatus(SVNStatusKind.MODIFIED, fileC2); commit(wc2); assertStatus(SVNStatusKind.NORMAL, fileA2); assertStatus(SVNStatusKind.NORMAL, fileB2); assertStatus(SVNStatusKind.NORMAL, fileC2); clearNotifiedFiles(); long r = c.update(wc1, SVNRevision.HEAD, true); SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl()); assertNotSame(revisionBefore, revisionAfter); assertEquals(((SVNRevision.Number)revisionAfter).getNumber(), r); assertStatus(SVNStatusKind.NORMAL, fileA1); assertStatus(SVNStatusKind.NORMAL, fileB1); assertStatus(SVNStatusKind.NORMAL, fileC1); assertContents(fileA1, 2); assertContents(fileB1, 2); assertContents(fileC1, 2); assertNotifiedFiles(new File[] {fileA1, fileB1, fileC1}); }
Example 13
Source File: UpdateTestHidden.java From netbeans with Apache License 2.0 | 4 votes |
public void testUpdateFolderNonRecusivelly() throws Exception { // XXX setproperty on folder File wc1 = createFolder("wc1"); File fileA1 = createFile(wc1, "fileA"); File fileB1 = createFile(wc1, "fileB"); File folder1 = createFolder(wc1, "folder"); File fileC1 = createFile(folder1, "fileC"); write(fileA1, 1); write(fileB1, 1); write(fileC1, 1); importFile(wc1); assertStatus(SVNStatusKind.NORMAL, wc1); assertStatus(SVNStatusKind.NORMAL, fileA1); assertStatus(SVNStatusKind.NORMAL, fileB1); assertStatus(SVNStatusKind.NORMAL, fileC1); File wc2 = createFolder("wc2"); File fileA2 = new File(wc2, "fileA"); File fileB2 = new File(wc2, "fileB"); File fileC2 = new File(new File(wc2, folder1.getName()), "fileC"); SVNUrl url = getTestUrl().appendPath(wc1.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, wc2, SVNRevision.HEAD, true); assertStatus(SVNStatusKind.NORMAL, fileA2); assertStatus(SVNStatusKind.NORMAL, fileB2); assertStatus(SVNStatusKind.NORMAL, fileC2); assertContents(fileA2, 1); assertContents(fileB2, 1); assertContents(fileC2, 1); SVNRevision revisionBefore = (SVNRevision.Number) getRevision(getRepoUrl()); write(fileA2, 2); write(fileB2, 2); write(fileC2, 2); assertStatus(SVNStatusKind.MODIFIED, fileA2); assertStatus(SVNStatusKind.MODIFIED, fileB2); assertStatus(SVNStatusKind.MODIFIED, fileC2); commit(wc2); assertStatus(SVNStatusKind.NORMAL, fileA2); assertStatus(SVNStatusKind.NORMAL, fileB2); assertStatus(SVNStatusKind.NORMAL, fileC2); clearNotifiedFiles(); long r = c.update(wc1, SVNRevision.HEAD, false); SVNRevision revisionAfter = (SVNRevision.Number) getRevision(getRepoUrl()); assertNotSame(revisionBefore, revisionAfter); assertEquals(((SVNRevision.Number)revisionAfter).getNumber(), r); assertStatus(SVNStatusKind.NORMAL, fileA1); assertStatus(SVNStatusKind.NORMAL, fileB1); assertStatus(SVNStatusKind.NORMAL, fileC1); assertContents(fileA1, 2); assertContents(fileB1, 2); assertContents(fileC1, 1); assertNotifiedFiles(new File[] {fileA1, fileB1}); }
Example 14
Source File: ResolvedTestHidden.java From netbeans with Apache License 2.0 | 4 votes |
private void testResolved(String folder1Name, String folder2Name, String fileName) throws Exception { File wc1 = createFolder(folder1Name); File file1 = createFile(wc1, fileName); write(file1, 1); importFile(wc1); assertStatus(SVNStatusKind.NORMAL, wc1); assertStatus(SVNStatusKind.NORMAL, file1); File wc2 = createFolder(folder2Name); File file2 = new File(wc2, fileName); SVNUrl url = getTestUrl().appendPath(wc1.getName()); ISVNClientAdapter c = getNbClient(); c.checkout(url, wc2, SVNRevision.HEAD, true); assertStatus(SVNStatusKind.NORMAL, file2); assertContents(file2, 1); write(file2, 2); assertStatus(SVNStatusKind.MODIFIED, file2); commit(file2); assertStatus(SVNStatusKind.NORMAL, file2); write(file1, 3); c.update(file1, SVNRevision.HEAD, false); assertStatus(SVNStatusKind.CONFLICTED, file1); write(file1, 2); clearNotifiedFiles(); c.resolved(file1); assertStatus(SVNStatusKind.NORMAL, file1); if (isSvnkit()) { // svnkit does not notify about resolved files assertNotifiedFiles(); } else { assertNotifiedFiles(file1); } }