Java Code Examples for org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy()
The following examples show how to use
org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy() .
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: CopyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testCopyURL2URL(String srcPath, String targetFileName) throws Exception { createAndCommitParentFolders(srcPath); File file = createFile(srcPath); add(file); commit(file); File filecopy = createFile(renameFile(srcPath, targetFileName)); filecopy.delete(); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(file), getFileUrl(filecopy), "copy", SVNRevision.HEAD); ISVNInfo info = getInfo(getFileUrl(filecopy)); assertNotNull(info); assertEquals(getFileUrl(filecopy), TestUtilities.decode(info.getUrl())); assertNotifiedFiles(new File[] {}); }
Example 2
Source File: CopyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testCopyURL2URLPrevRevision(String srcPath, String targetFileName) throws Exception { createAndCommitParentFolders(srcPath); File file = createFile(srcPath); write(file, 1); add(file); commit(file); SVNRevision prevRev = getRevision(file); write(file, 2); commit(getWC()); File filecopy = createFile(renameFile(srcPath, targetFileName)); filecopy.delete(); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(file), getFileUrl(filecopy), "copy", prevRev); ISVNLogMessage[] logs = getLog(getFileUrl(filecopy)); assertEquals(((SVNRevision.Number)prevRev).getNumber() ,logs[0].getChangedPaths()[0].getCopySrcRevision().getNumber()); InputStream is = getContent(getFileUrl(filecopy)); assertContents(is, 1); assertNotifiedFiles(new File[] {}); }
Example 3
Source File: CopyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testCopyFile2URL(String srcPath, String targetFileName) throws Exception { createAndCommitParentFolders(srcPath); File file = createFile(srcPath); add(file); commit(file); // File filecopy = new File(createFolder(file.getParentFile(), targetFileName), file.getName()); File filecopy = createFile(renameFile(srcPath, targetFileName)); ISVNClientAdapter c = getNbClient(); // c.copy(file, getFileUrl(filecopy), "copy"); XXX is failing with javahl and we don't use it anyway c.copy(new File[] {file}, getFileUrl(filecopy), "copy", false, true); ISVNInfo info = getInfo(getFileUrl(filecopy)); assertNotNull(info); assertEquals(getFileUrl(filecopy), TestUtilities.decode(info.getUrl())); assertNotifiedFiles(new File[] {}); }
Example 4
Source File: CopyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testCopyFile2File(String srcPath, String target) throws Exception { createAndCommitParentFolders(srcPath); File file = createFile(srcPath); add(file); commit(file); // File filecopy = new File(createFolder(file.getParentFile(), targetFileName), file.getName()); File filecopy = new File(file.getParentFile(), target); ISVNClientAdapter c = getNbClient(); // c.copy(file, getFileUrl(filecopy), "copy"); XXX is failing with javahl and we don't use it anyway c.copy(file, filecopy); assertTrue(filecopy.exists()); ISVNInfo info = getInfo(filecopy); assertNotNull(info); assertEquals(getFileUrl(filecopy), TestUtilities.decode(info.getUrl())); assertNotifiedFiles(new File[] {}); }
Example 5
Source File: CopyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testCopyURL2File(String srcPath, String targetFileName) throws Exception { createAndCommitParentFolders(srcPath); File file = createFile(srcPath); add(file); commit(file); File filecopy = createFile(renameFile(srcPath, targetFileName)); filecopy.delete(); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(file), filecopy, SVNRevision.HEAD); assertTrue(filecopy.exists()); assertStatus(SVNStatusKind.ADDED, filecopy); if (isSvnkit()) { // svnkit does not notify about files assertNotifiedFiles(new File[] {}); } else { assertNotifiedFiles(new File[] {filecopy}); } }
Example 6
Source File: CopyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testCopyURL2FilePrevRevision(String srcPath, String targetFileName) throws Exception { createAndCommitParentFolders(srcPath); File file = createFile(srcPath); write(file, 1); add(file); commit(file); SVNRevision prevRev = getRevision(file); write(file, 2); commit(getWC()); File filecopy = createFile(renameFile(srcPath, targetFileName)); filecopy.delete(); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(file), filecopy, prevRev); assertContents(filecopy, 1); if (isSvnkit()) { // svnkit does not notify about files assertNotifiedFiles(new File[] {}); } else { assertNotifiedFiles(new File[] {filecopy}); } }
Example 7
Source File: MoveTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testMoveURL2URLPrevRevision(String srcPath, String targetFileName) throws Exception { createAndCommitParentFolders(srcPath); File file = createFile(srcPath); write(file, 1); add(file); commit(file); SVNRevision prevRev = getRevision(file); write(file, 2); commit(getWC()); File filemove = createFile(renameFile(srcPath, targetFileName)); filemove.delete(); // we're operating with repository directly, cannot leave unversioned files lying on disk (they would be committed in the next round) ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(file), getFileUrl(filemove), "move", prevRev); ISVNLogMessage[] logs = getLog(getFileUrl(filemove)); assertEquals(((SVNRevision.Number)prevRev).getNumber() ,logs[0].getChangedPaths()[0].getCopySrcRevision().getNumber()); InputStream is = getContent(getFileUrl(filemove)); assertContents(is, 1); assertNotifiedFiles(new File[] {}); }
Example 8
Source File: SwitchToTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
public void testSwitchToFile() throws Exception { File file = createFile("file"); add(file); commit(file); File filecopy = createFile("filecopy"); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(file), getFileUrl(filecopy), "copy", SVNRevision.HEAD); assertCopy(getFileUrl(filecopy)); assertInfo(file, getFileUrl(file)); c.switchToUrl(file, getFileUrl(filecopy), SVNRevision.HEAD, false); assertInfo(file, getFileUrl(filecopy)); assertNotifiedFiles();// XXX empty also in svnCA - why?! - no output from cli }
Example 9
Source File: RepositoryResourcesManager.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * copy the remote resource to the given remote folder */ public void copyRemoteResource(ISVNRemoteResource resource, ISVNRemoteFolder destinationFolder, String message,IProgressMonitor monitor) throws SVNException { IProgressMonitor progress = Policy.monitorFor(monitor); progress.beginTask(Policy.bind("RepositoryResourcesManager.copyRemoteResources"), 100); //$NON-NLS-1$ ISVNClientAdapter svnClient = null; try { svnClient = resource.getRepository().getSVNClient(); svnClient.copy(resource.getUrl(),destinationFolder.getUrl(),message,SVNRevision.HEAD); destinationFolder.refresh(); remoteResourceCopied(resource, destinationFolder); } catch (SVNClientException e) { throw SVNException.wrapException(e); } finally { resource.getRepository().returnSVNClient(svnClient); progress.done(); } }
Example 10
Source File: MergeTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
public void testFolderMergeRec() throws Exception { File folder = createFolder("folder"); add(folder); commit(folder); assertInfo(folder, getFileUrl(folder)); File foldercopy = new File(getWC(), "foldercopy"); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(folder), getFileUrl(foldercopy), "copy", SVNRevision.HEAD); c.switchToUrl(folder, getFileUrl(foldercopy), SVNRevision.HEAD, true); assertCopy(getFileUrl(foldercopy)); assertInfo(folder, getFileUrl(foldercopy)); File folder1 = createFolder(folder, "folder1"); File file = createFile(folder, "file"); File file1 = createFile(folder1, "file"); add(file); add(folder1); add(file1); commit(folder); assertTrue(file.exists()); c.switchToUrl(folder, getFileUrl(folder), SVNRevision.HEAD, true); assertCopy(getFileUrl(folder)); assertInfo(folder, getFileUrl(folder)); assertFalse(file.exists()); assertFalse(file1.exists()); assertFalse(folder1.exists()); ISVNLogMessage[] log = getCompleteLog(getFileUrl(folder)); c.merge(getFileUrl(foldercopy), log[0].getRevision(), getFileUrl(foldercopy), SVNRevision.HEAD, folder, false, true); assertTrue(file.exists()); assertTrue(file1.exists()); assertTrue(folder1.exists()); assertNotifiedFiles(new File[] {file, file1, folder1}); }
Example 11
Source File: SwitchToTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
public void testSwitchToFilePrevRev() throws Exception { File file = createFile("file"); add(file); write(file, 1); commit(file); File filecopy = createFile("filecopy"); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(file), getFileUrl(filecopy), "copy", SVNRevision.HEAD); assertCopy(getFileUrl(filecopy)); assertInfo(file, getFileUrl(file)); // switch to copy c.switchToUrl(file, getFileUrl(filecopy), SVNRevision.HEAD, false); assertInfo(file, getFileUrl(filecopy)); SVNRevision prevrev = getRevision(file); // change copy write(file, 2); commit(file); // switch to trunk c.switchToUrl(file, getFileUrl(file), SVNRevision.HEAD, false); assertInfo(file, getFileUrl(file)); // switch to copies prev revision c.switchToUrl(file, getFileUrl(filecopy), prevrev, false); // test assertInfo(file, getFileUrl(filecopy)); assertContents(file, 1); SVNRevision rev = getRevision(file); assertEquals(((SVNRevision.Number)prevrev).getNumber(), ((SVNRevision.Number)rev).getNumber()); assertNotifiedFiles(file); }
Example 12
Source File: SwitchToTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
public void testSwitchToFolderNonRec() throws Exception { File folder = createFolder("folder"); File file = createFile(folder, "file"); File folder1 = createFolder(folder, "folder1"); File file1 = createFile(folder1, "file1"); add(folder); add(file); add(folder1); add(file1); commit(folder); File foldercopy = createFolder("foldercopy"); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(folder), getFileUrl(foldercopy), "copy", SVNRevision.HEAD); assertCopy(getFileUrl(foldercopy)); assertInfo(folder, getFileUrl(folder)); assertInfo(file, getFileUrl(folder).appendPath(file.getName())); assertInfo(folder1, getFileUrl(folder).appendPath(folder1.getName())); assertInfo(file1, getFileUrl(folder).appendPath(folder1.getName()).appendPath(file1.getName())); c.switchToUrl(folder, getFileUrl(foldercopy), SVNRevision.HEAD, false); assertInfo(folder, getFileUrl(foldercopy)); assertInfo(file, getFileUrl(foldercopy).appendPath(file.getName())); assertInfo(folder1, getFileUrl(folder).appendPath(folder1.getName())); assertInfo(file1, getFileUrl(folder).appendPath(folder1.getName()).appendPath(file1.getName())); assertNotifiedFiles(new File[] {}); // XXX empty also in svnCA - why?! - no output from cli }
Example 13
Source File: SwitchToTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
public void testSwitchToFolderRec() throws Exception { File folder = createFolder("folder"); File file = createFile(folder, "file"); File folder1 = createFolder(folder, "folder1"); File file1 = createFile(folder1, "file1"); add(folder); add(file); add(folder1); add(file1); commit(folder); File foldercopy = createFolder("foldercopy"); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(folder), getFileUrl(foldercopy), "copy", SVNRevision.HEAD); assertCopy(getFileUrl(foldercopy)); assertInfo(folder, getFileUrl(folder)); assertInfo(file, getFileUrl(folder).appendPath(file.getName())); assertInfo(folder1, getFileUrl(folder).appendPath(folder1.getName())); assertInfo(file1, getFileUrl(folder).appendPath(folder1.getName()).appendPath(file1.getName())); c.switchToUrl(folder, getFileUrl(foldercopy), SVNRevision.HEAD, true); assertInfo(folder, getFileUrl(foldercopy)); assertInfo(file, getFileUrl(foldercopy).appendPath(file.getName())); assertInfo(folder1, getFileUrl(foldercopy).appendPath(folder1.getName())); assertInfo(file1, getFileUrl(foldercopy).appendPath(folder1.getName()).appendPath(file1.getName())); assertNotifiedFiles(new File[] {}); // XXX empty also in svnCA - why?! - no output from cli }
Example 14
Source File: SwitchToTestHidden.java From netbeans with Apache License 2.0 | 5 votes |
public void testSwitchToFolderWithAtSignRec() throws Exception { if(!shouldBeTestedWithCurrentClient(true, false)) { return; } File folder = createFolder("fol@der"); File file = createFile(folder, "file"); File folder1 = createFolder(folder, "folder1"); File file1 = createFile(folder1, "file1"); add(folder); add(file); add(folder1); add(file1); commit(folder); File foldercopy = createFolder("folder@copy"); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(folder), getFileUrl(foldercopy), "copy", SVNRevision.HEAD); assertCopy(getFileUrl(foldercopy)); assertInfo(folder, getFileUrl(folder)); assertInfo(file, getFileUrl(folder).appendPath(file.getName())); assertInfo(folder1, getFileUrl(folder).appendPath(folder1.getName())); assertInfo(file1, getFileUrl(folder).appendPath(folder1.getName()).appendPath(file1.getName())); c.switchToUrl(folder, getFileUrl(foldercopy), SVNRevision.HEAD, true); assertInfo(folder, getFileUrl(foldercopy)); assertInfo(file, getFileUrl(foldercopy).appendPath(file.getName())); assertInfo(folder1, getFileUrl(foldercopy).appendPath(folder1.getName())); assertInfo(file1, getFileUrl(foldercopy).appendPath(folder1.getName()).appendPath(file1.getName())); assertNotifiedFiles(new File[] {}); // XXX empty also in svnCA - why?! - no output from cli }
Example 15
Source File: MergeTestHidden.java From netbeans with Apache License 2.0 | 4 votes |
public void testMergeFolderNonRec() throws Exception { // init wc File folder = createFolder("folder"); add(folder); commit(folder); assertInfo(folder, getFileUrl(folder)); // init copy from wc File foldercopy = new File(getWC(), "foldercopy"); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(folder), getFileUrl(foldercopy), "copy", SVNRevision.HEAD); // switch to copy c.switchToUrl(folder, getFileUrl(foldercopy), SVNRevision.HEAD, true); assertCopy(getFileUrl(foldercopy)); assertInfo(folder, getFileUrl(foldercopy)); // add new files to copy File folder1 = createFolder(folder, "folder1"); File file = createFile(folder, "file"); File file1 = createFile(folder1, "file"); add(file); add(folder1); add(file1); commit(folder); assertTrue(file.exists()); // switch back to wc c.switchToUrl(folder, getFileUrl(folder), SVNRevision.HEAD, true); assertCopy(getFileUrl(folder)); assertInfo(folder, getFileUrl(folder)); assertFalse(file.exists()); assertFalse(file1.exists()); assertFalse(folder1.exists()); // merge wc with copy ISVNLogMessage[] log = getCompleteLog(getFileUrl(folder)); c.merge(getFileUrl(foldercopy), log[0].getRevision(), getFileUrl(foldercopy), SVNRevision.HEAD, folder, false, false); assertTrue(file.exists()); assertFalse(file1.exists()); assertFalse(folder1.exists()); assertNotifiedFiles(new File[] {file, folder1}); }
Example 16
Source File: MergeTestHidden.java From netbeans with Apache License 2.0 | 4 votes |
public void testMergeFolderFrom2Urls() throws Exception { File folder = createFolder("folder"); add(folder); commit(folder); assertInfo(folder, getFileUrl(folder)); File foldercopy1 = new File(getWC(), "foldercopy1"); ISVNClientAdapter c = getNbClient(); c.copy(getFileUrl(folder), getFileUrl(foldercopy1), "copy", SVNRevision.HEAD); c.switchToUrl(folder, getFileUrl(foldercopy1), SVNRevision.HEAD, true); assertCopy(getFileUrl(foldercopy1)); assertInfo(folder, getFileUrl(foldercopy1)); File file1 = createFile(folder, "file1"); add(file1); commit(folder); assertTrue(file1.exists()); File foldercopy2 = new File(getWC(), "foldercopy2"); c = getNbClient(); c.copy(getFileUrl(foldercopy1), getFileUrl(foldercopy2), "copy", SVNRevision.HEAD); c.switchToUrl(folder, getFileUrl(foldercopy2), SVNRevision.HEAD, true); assertCopy(getFileUrl(foldercopy2)); assertInfo(folder, getFileUrl(foldercopy2)); File file2 = createFile(folder, "file2"); add(file2); commit(folder); assertTrue(file2.exists()); c.switchToUrl(folder, getFileUrl(folder), SVNRevision.HEAD, true); assertCopy(getFileUrl(folder)); assertInfo(folder, getFileUrl(folder)); assertFalse(file1.exists()); assertFalse(file2.exists()); ISVNLogMessage[] log = getCompleteLog(getFileUrl(foldercopy1)); c.merge(getFileUrl(foldercopy1), log[0].getRevision(), getFileUrl(foldercopy2), SVNRevision.HEAD, folder, true, true); assertTrue(file1.exists()); assertTrue(file2.exists()); assertNotifiedFiles(new File[] {file1, file2}); }