org.tigris.subversion.svnclientadapter.SVNStatusKind Java Examples
The following examples show how to use
org.tigris.subversion.svnclientadapter.SVNStatusKind.
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: PropertyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testPropertyListUrl(String filePath) throws Exception { createAndCommitParentFolders(filePath); File file = createFile(filePath); add(file); ISVNClientAdapter c = getNbClient(); c.propertySet(file, "p1", "v1", false); c.propertySet(file, "p2", "v2", false); c.propertySet(file, "p3", "v3", false); commit(file); assertPropertyStatus(SVNStatusKind.NORMAL, file); ISVNProperty[] props = c.getProperties(getFileUrl(file)); Map<String, ISVNProperty> propMap = new HashMap<String, ISVNProperty>(); for (ISVNProperty p : props) { propMap.put(p.getName(), p); } assertEquals(3, propMap.size()); assertProperty("p1", "v1", propMap); assertProperty("p2", "v2", propMap); assertProperty("p3", "v3", propMap); }
Example #2
Source File: SVNStatusSyncInfo.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private static IResourceVariant createLatestResourceVariant(IResource local, LocalResourceStatus baseStatusInfo, RemoteResourceStatus remoteStatusInfo) { if( remoteStatusInfo == null || remoteStatusInfo.getStatusKind() == SVNStatusKind.DELETED ) return null; if( remoteStatusInfo.getStatusKind() == SVNStatusKind.NONE && baseStatusInfo != null && isAddition(baseStatusInfo.getStatusKind()) ) { return null; } if( local.getType() == IResource.FILE ) { return new RemoteFile(remoteStatusInfo); } else { return new RemoteFolder(remoteStatusInfo); } }
Example #3
Source File: RevertTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
private void testRevertFile(String filePath) throws Exception { createAndCommitParentFolders(filePath); File file = createFile(filePath); write(file, 1); add(file); commit(file); assertStatus(SVNStatusKind.NORMAL, file); write(file, 2); assertStatus(SVNStatusKind.MODIFIED, file); ISVNClientAdapter c = getNbClient(); c.revert(file, false); assertStatus(SVNStatusKind.NORMAL, file); assertContents(file, 1); assertNotifiedFiles(new File[] {file}); }
Example #4
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void renameVersionedFolder_DO() throws Exception { // init File fromFolder = new File(wc, "from"); fromFolder.mkdirs(); commit(wc); File toFolder = new File(wc, "to"); // rename renameDO(fromFolder, toFolder); // test assertFalse(fromFolder.exists()); assertTrue(toFolder.exists()); assertEquals(SVNStatusKind.DELETED, getSVNStatus(fromFolder).getTextStatus()); assertEquals(SVNStatusKind.ADDED, getSVNStatus(toFolder).getTextStatus()); assertCachedStatus(fromFolder, FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY); assertCachedStatus(toFolder, FileInformation.STATUS_VERSIONED_ADDEDLOCALLY); commit(wc); assertFalse(fromFolder.exists()); }
Example #5
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void moveVersionedFile2IgnoredFolder_FO() throws Exception { // init File fromFile = new File(wc, "file"); fromFile.createNewFile(); File toFolder = new File(wc, "toFolder"); toFolder.mkdirs(); File toFile = new File(toFolder, fromFile.getName()); // add commit(fromFile); getClient().setIgnoredPatterns(wc, Collections.singletonList(toFolder.getName())); // move moveFO(fromFile, toFile); // test assertFalse(fromFile.exists()); assertTrue(toFile.exists()); assertEquals(SVNStatusKind.DELETED, getSVNStatus(fromFile).getTextStatus()); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(toFile).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY, getStatus(fromFile)); assertCachedStatus(toFile, FileInformation.STATUS_NOTVERSIONED_EXCLUDED); }
Example #6
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void renameA2B_CreateA_FO() throws Exception { // init File fileA = new File(wc, "A"); fileA.createNewFile(); commit(wc); // rename File fileB = new File(wc, "B"); renameFO(fileA, fileB); // create from file FileUtil.toFileObject(fileA.getParentFile()).createData(fileA.getName()); // test assertTrue(fileB.exists()); assertTrue(fileA.exists()); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(fileA).getTextStatus()); assertEquals(SVNStatusKind.ADDED, getSVNStatus(fileB).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_UPTODATE, getStatus(fileA)); assertCachedStatus(fileB, FileInformation.STATUS_VERSIONED_ADDEDLOCALLY); // commit(wc); }
Example #7
Source File: ResolveTreeConflictWizard.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public ISVNStatus getLocalCopiedTo(boolean getAll) throws SVNException, SVNClientException { String endsWithCheck = treeConflict.getConflictDescriptor().getSrcRightVersion().getPathInRepos(); IProject project = svnResource.getResource().getProject(); if (project != null) { int index = endsWithCheck.indexOf("/" + project.getName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$ if (index != -1) endsWithCheck = endsWithCheck.substring(index); } if (copiedTo == null && !copiedToRetrieved) { statuses = getStatuses(getAll); ISVNClientAdapter svnClient = svnResource.getRepository().getSVNClient(); for (int i = 0; i < statuses.length; i++) { if (statuses[i].isCopied() && statuses[i].getTextStatus().equals(SVNStatusKind.ADDED)) { ISVNInfo info = svnClient.getInfoFromWorkingCopy(statuses[i].getFile()); if (info.getCopyUrl() != null) { if ((svnResource.getUrl() != null && info.getCopyUrl().toString().equals(svnResource.getUrl().toString())) || (info.getCopyUrl().toString().endsWith(endsWithCheck))) { copiedTo = statuses[i]; break; } } } } svnResource.getRepository().returnSVNClient(svnClient); } copiedToRetrieved = true; return copiedTo; }
Example #8
Source File: StatusUpdateStrategy.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Collect the content of unversioned folders. * @param statuses * @param recursive * @return */ protected ISVNStatus[] collectUnversionedFolders(ISVNStatus[] statuses, boolean recursive) { if (statuses == null) { return null; } List<ISVNStatus> processed = new ArrayList<ISVNStatus>(); for (ISVNStatus status : statuses) { processed.add(status); if (status.getNodeKind() != SVNNodeKind.FILE && status.getTextStatus() == SVNStatusKind.UNVERSIONED) { File folder = status.getFile(); if (!folder.isDirectory() && !folder.exists()) continue; Set<String> alreadyProcessed = new HashSet<String>(); processUnversionedFolder(folder, processed, recursive, alreadyProcessed); } } return processed.toArray(new ISVNStatus[processed.size()]); }
Example #9
Source File: SvnWcParserTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testGetSingleStatusFileCopied1NewFormat() throws Exception { File myFile = new File(dataRootDir + "/SvnWcParser/new-format-file-copied1/testapp/AnotherAnotherMain.java"); ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); assertTrue(parsedStatus.isCopied()); assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherAnotherMain.java", parsedStatus.getUrl().toString()); assertEquals(SVNStatusKind.ADDED, parsedStatus.getTextStatus()); assertEquals(18, parsedStatus.getRevision().getNumber()); assertNull(parsedStatus.getConflictNew()); assertNull(parsedStatus.getConflictOld()); assertNull(parsedStatus.getConflictWorking()); assertEquals(myFile, parsedStatus.getFile()); assertNull(parsedStatus.getLastChangedDate()); assertEquals(-1, parsedStatus.getLastChangedRevision().getNumber()); assertNull(parsedStatus.getLastCommitAuthor()); assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); assertEquals(myFile.getPath(), parsedStatus.getPath()); assertEquals(SVNStatusKind.NONE, parsedStatus.getPropStatus()); assertNull(parsedStatus.getLockComment()); assertNull(parsedStatus.getLockOwner()); assertNull(parsedStatus.getLockCreationDate()); }
Example #10
Source File: SvnWcParserTest.java From netbeans with Apache License 2.0 | 6 votes |
/** * Tests a specific case... where the file doesn't exist, and there is no entry in the SVN * files, but it's still being queried by the module. Return unversioned */ public void testGetSingleStatusFileUnknownAnywhere() throws Exception { File myFile = new File(dataRootDir + "/SvnWcParser/no-changes/testapp/ReadMe.txt"); ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); assertFalse(parsedStatus.isCopied()); assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/ReadMe.txt", parsedStatus.getUrl().toString()); assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getTextStatus()); assertEquals(0, parsedStatus.getRevision().getNumber()); assertNull(parsedStatus.getConflictNew()); assertNull(parsedStatus.getConflictOld()); assertNull(parsedStatus.getConflictWorking()); assertEquals(myFile, parsedStatus.getFile()); assertNull(parsedStatus.getLastChangedDate()); assertEquals(0, parsedStatus.getLastChangedRevision().getNumber()); assertNull(parsedStatus.getLastCommitAuthor()); assertEquals(SVNNodeKind.UNKNOWN, parsedStatus.getNodeKind()); assertEquals(myFile.getPath(), parsedStatus.getPath()); assertEquals(SVNStatusKind.UNVERSIONED, parsedStatus.getPropStatus()); assertNull(parsedStatus.getLockComment()); assertNull(parsedStatus.getLockOwner()); assertNull(parsedStatus.getLockCreationDate()); }
Example #11
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void deleteA_renameUnversioned2A_DO() throws Exception { // init File folder = new File(wc, "folder"); folder.mkdir(); File fileA = new File(folder, "A"); fileA.createNewFile(); commit(wc); File fileUnversioned = new File(folder, "Unversioned"); fileUnversioned.createNewFile(); //delete delete(fileA); assertFalse(fileA.exists()); assertEquals(SVNStatusKind.DELETED, getSVNStatus(fileA).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY, getStatus(fileA)); // move renameDO(fileUnversioned, fileA); // test assertTrue(fileA.exists()); assertFalse(fileUnversioned.exists()); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(fileA).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_UPTODATE, getStatus(fileA)); }
Example #12
Source File: SvnWcParserTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testGetSingleStatusFileLockedWithCommentNewFormat() throws Exception { File myFile = new File(dataRootDir + "/SvnWcParser/new-format-file-locked-with-comment/testapp/AnotherMain.java"); ISVNStatus parsedStatus = svnWcParser.getSingleStatus(myFile); assertFalse(parsedStatus.isCopied()); assertEquals("svn://gonzo/testRepos/trunk/testApp/src/testapp/AnotherMain.java", parsedStatus.getUrl().toString()); assertEquals(SVNStatusKind.NORMAL, parsedStatus.getTextStatus()); assertEquals(19, parsedStatus.getRevision().getNumber()); assertNull(parsedStatus.getConflictNew()); assertNull(parsedStatus.getConflictOld()); assertNull(parsedStatus.getConflictWorking()); assertEquals(myFile, parsedStatus.getFile()); Date expectedDate = SvnWcUtils.parseSvnDate("2006-04-25T07:05:57.738276Z"); assertEquals(expectedDate, parsedStatus.getLastChangedDate()); assertEquals(10, parsedStatus.getLastChangedRevision().getNumber()); assertEquals("ed", parsedStatus.getLastCommitAuthor()); assertEquals(SVNNodeKind.FILE, parsedStatus.getNodeKind()); assertEquals(myFile.getPath(), parsedStatus.getPath()); assertEquals(SVNStatusKind.NORMAL, parsedStatus.getPropStatus()); assertEquals("This is my comment", parsedStatus.getLockComment()); assertEquals("ed", parsedStatus.getLockOwner()); expectedDate = SvnWcUtils.parseSvnDate("2006-08-29T10:36:02.498983Z"); assertEquals(expectedDate, parsedStatus.getLockCreationDate()); }
Example #13
Source File: PropertyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
public void testPropertySetGetDelFile() throws Exception { File file = createFile("file"); add(file); commit(file); File prop = createFile("prop"); write(prop, 2); ISVNClientAdapter c = getNbClient(); c.propertySet(file, "p1", prop, false); assertNotifiedFiles(file); assertPropertyStatus(SVNStatusKind.MODIFIED, file); assertProperty(c, file, "p1", new byte[] {2}); clearNotifiedFiles(); c.propertyDel(file, "p1", true); assertPropertyStatus(SVNStatusKind.NONE, file); assertNotifiedFiles(file); }
Example #14
Source File: PropertyTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
public void testPropertySetNonRecursivelly() throws Exception { File folder = createFolder("folder"); File file = createFolder(folder, "file"); File folder1 = createFolder(folder, "folder1"); File file1 = createFolder(folder1, "file1"); add(folder); add(file); add(folder1); add(file1); commit(getWC()); ISVNClientAdapter c = getNbClient(); c.propertySet(folder, "p1", "v1", false); assertNotifiedFiles(folder); assertPropertyStatus(SVNStatusKind.MODIFIED, folder); assertPropertyStatus(SVNStatusKind.NONE, file); assertPropertyStatus(SVNStatusKind.NONE, folder1); assertPropertyStatus(SVNStatusKind.NONE, file1); assertProperty(c, folder, "p1", "v1"); }
Example #15
Source File: Setup.java From netbeans with Apache License 2.0 | 6 votes |
/** * Local file vs HEAD * @param baseFile * @param status remote status of the file */ public Setup(File baseFile, ISVNStatus status) { this.baseFile = baseFile; this.propertyName = null; this.secondRevision = null; title = baseFile.getName(); String headTitle; ResourceBundle loc = NbBundle.getBundle(Setup.class); if (status.getRepositoryTextStatus().equals(SVNStatusKind.ADDED)) { firstRevision = REVISION_HEAD; headTitle = loc.getString("MSG_DiffPanel_RemoteNew"); } else if (status.getRepositoryTextStatus().equals(SVNStatusKind.DELETED)) { firstRevision = null; headTitle = loc.getString("MSG_DiffPanel_RemoteDeleted"); } else if (status.getRepositoryTextStatus().equals(SVNStatusKind.MODIFIED)) { firstRevision = REVISION_HEAD; headTitle = MessageFormat.format(loc.getString("MSG_DiffPanel_RemoteModified"), new Object [] { firstRevision }); } else { firstRevision = REVISION_HEAD; headTitle = REVISION_HEAD.toString(); } firstSource = new DiffStreamSource(baseFile, propertyName, REVISION_HEAD, headTitle); secondSource = new DiffStreamSource(baseFile, propertyName, REVISION_CURRENT, REVISION_CURRENT); }
Example #16
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void renameAddedFile_DO() throws Exception { // init File fromFile = new File(wc, "fromFile"); fromFile.createNewFile(); File toFile = new File(wc, "toFile"); // add getClient().addFile(fromFile); // rename renameDO(fromFile, toFile); // test assertFalse(fromFile.exists()); assertTrue(toFile.exists()); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(fromFile).getTextStatus()); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(toFile).getTextStatus()); assertEquals(FileInformation.STATUS_UNKNOWN, getStatus(fromFile)); assertCachedStatus(toFile, FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY); // commit(wc); }
Example #17
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void deleteVersionedFile() throws Exception { // init File file = new File(wc, "file"); file.createNewFile(); commit(wc); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(file).getTextStatus()); // delete delete(file); // test assertFalse(file.exists()); assertEquals(SVNStatusKind.DELETED, getSVNStatus(file).getTextStatus()); assertCachedStatus(file, FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY); commit(wc); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(file).getTextStatus()); }
Example #18
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void moveUnversionedFolder_FO() throws Exception { // init File fromFolder = new File(wc, "folder"); fromFolder.mkdirs(); File toParent = new File(wc, "toFolder"); toParent.mkdirs(); File toFolder = new File(toParent, fromFolder.getName()); // move moveFO(fromFolder, toFolder); // test assertFalse(fromFolder.exists()); assertTrue(toFolder.exists()); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(fromFolder).getTextStatus()); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(toFolder).getTextStatus()); assertEquals(FileInformation.STATUS_UNKNOWN, getStatus(fromFolder)); assertCachedStatus(toFolder, FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY); // commit(wc); }
Example #19
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void deleteNotVersionedFolder() throws IOException, SVNClientException { // init File folder = new File(wc, "folder2"); folder.mkdirs(); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(folder).getTextStatus()); // delete delete(folder); // test assertFalse(folder.exists()); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(folder).getTextStatus()); assertEquals(FileInformation.STATUS_UNKNOWN, getStatus(folder)); // commit(wc); }
Example #20
Source File: AddTestHidden.java From netbeans with Apache License 2.0 | 6 votes |
public void testAddNoDirectory() throws Exception { File file = new File(getWC(), "fail"); assertStatus(SVNStatusKind.NONE, file); SVNClientException e = null; try { ISVNClientAdapter c = getNbClient(); c.addDirectory(file, false); } catch (SVNClientException ex) { e = ex; } if (isJavahl()) { assertNotNull(e); assertTrue(e.getMessage().indexOf("is not a working copy") > -1 || e.getMessage().indexOf("not found") > -1); } assertNotifiedFiles(new File[] {}); }
Example #21
Source File: ApiTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testCommit() throws SVNClientException, IOException { File folder = new File(workDir, "testCommitFolder"); folder.mkdirs(); TestKit.svnimport(repoDir, folder); ISVNStatus s = TestKit.getSVNStatus(folder); assertEquals(SVNStatusKind.NORMAL, s.getTextStatus()); File file = new File(folder, "file"); file.createNewFile(); TestKit.add(file); s = TestKit.getSVNStatus(file); assertEquals(SVNStatusKind.ADDED, s.getTextStatus()); Subversion.getInstance().versionedFilesChanged(); SvnUtils.refreshParents(folder); Subversion.getInstance().getStatusCache().refreshRecursively(folder); org.netbeans.modules.subversion.api.Subversion.commit(new File[] {folder}, "", "", "msg"); s = TestKit.getSVNStatus(file); assertEquals(SVNStatusKind.NORMAL, s.getTextStatus()); }
Example #22
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void renameA2B2A_FO() throws Exception { // init File fileA = new File(wc, "from"); fileA.createNewFile(); commit(wc); File fileB = new File(wc, "to"); // rename renameFO(fileA, fileB); renameFO(fileB, fileA); // test assertTrue(fileA.exists()); assertFalse(fileB.exists()); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(fileA).getTextStatus()); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(fileB).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_UPTODATE, getStatus(fileA)); assertEquals(FileInformation.STATUS_UNKNOWN, getStatus(fileB)); // commit(wc); }
Example #23
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void renameVersionedFile_FO() throws Exception { // init File fromFile = new File(wc, "fromFile"); fromFile.createNewFile(); commit(wc); File toFile = new File(wc, "toFile"); // rename renameFO(fromFile, toFile); // test assertFalse(fromFile.exists()); assertTrue(toFile.exists()); assertEquals(SVNStatusKind.DELETED, getSVNStatus(fromFile).getTextStatus()); assertEquals(SVNStatusKind.ADDED, getSVNStatus(toFile).getTextStatus()); assertCachedStatus(fromFile, FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY); assertCachedStatus(toFile, FileInformation.STATUS_VERSIONED_ADDEDLOCALLY); // commit(wc); }
Example #24
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void moveVersionedFolder_DO() throws Exception { // init File fromFolder = new File(wc, "from"); fromFolder.mkdirs(); File toParent = new File(wc, "toFolder"); toParent.mkdirs(); commit(wc); File toFolder = new File(toParent, fromFolder.getName()); // move moveDO(fromFolder, toFolder); // test assertFalse(fromFolder.exists()); assertTrue(toFolder.exists()); assertEquals(SVNStatusKind.DELETED, getSVNStatus(fromFolder).getTextStatus()); assertEquals(SVNStatusKind.UNVERSIONED, getSVNStatus(toFolder).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY, getStatus(fromFolder)); assertCachedStatus(toFolder, FileInformation.STATUS_NOTVERSIONED_NEWLOCALLY); commit(wc); assertFalse(fromFolder.exists()); }
Example #25
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void deleteA_CreateAOnDemandLocking() throws IOException, SVNClientException { // init File file = new File(wc, "A"); file.createNewFile(); commit(wc); SvnModuleConfig.getDefault().setAutoLock(true); getClient().propertySet(file, "svn:needs-lock", "true", false); commit(file); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(file).getTextStatus()); // delete FileObject fo = FileUtil.toFileObject(file); fo.delete(); // test if deleted assertFalse(file.exists()); assertEquals(SVNStatusKind.DELETED, getSVNStatus(file).getTextStatus()); // create fo.getParent().createData(fo.getName()); // test assertTrue(file.exists()); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(file).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_UPTODATE | FileInformation.STATUS_LOCKED, getStatus(file)); }
Example #26
Source File: AbstractJhlClientAdapter.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public InputStream getContent(File path, SVNRevision revision) throws SVNClientException { try { String target = fileToSVNPath(path, false); notificationHandler.setCommand(ISVNNotifyListener.Command.CAT); notificationHandler.logCommandLine("cat -r " + revision.toString() + " " + target); notificationHandler.setBaseDir(); if (revision.equals(SVNRevision.BASE)) { // This is to work-around a JavaHL problem when trying to // retrieve the base revision of a newly added file. ISVNStatus status = getSingleStatus(path); if (status.getTextStatus().equals(SVNStatusKind.ADDED)) return new ByteArrayInputStream(new byte[0]); } byte[] contents = svnClient.fileContent(target, JhlConverter.convert(revision), Revision.BASE); InputStream input = new ByteArrayInputStream(contents); return input; } catch (ClientException e) { notificationHandler.logException(e); throw new SVNClientException(e); } }
Example #27
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void modifyFileOnDemandLock () throws Exception { // init File file = new File(wc, "file"); file.createNewFile(); commit(wc); getClient().propertySet(file, "svn:needs-lock", "true", false); commit(file); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(file).getTextStatus()); SvnModuleConfig.getDefault().setAutoLock(true); // modify OutputStream os = FileUtil.toFileObject(file).getOutputStream(); os.write(new byte[] { 'a', 0 }); os.close(); // test assertTrue(file.exists()); assertEquals(SVNStatusKind.MODIFIED, getSVNStatus(file).getTextStatus()); assertCachedStatus(file, FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY_CONTENT | FileInformation.STATUS_LOCKED); commit(wc); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(file).getTextStatus()); }
Example #28
Source File: AbstractSvnTestCase.java From netbeans with Apache License 2.0 | 5 votes |
protected void add(ISVNClientAdapter client, File file) throws SVNClientException { ISVNStatus status = getSVNStatus(file); if(status.getTextStatus().equals(SVNStatusKind.UNVERSIONED)) { try { client.addFile(file); } catch (SVNClientException e) { if(e.getMessage().indexOf("is not a working copy") > -1 && containsParent(e.getMessage(), file.getParentFile())) { // ignore } else { throw e; } } } if(file.isFile() || status.getTextStatus().equals(SVNStatusKind.IGNORED)) { return; } File[] files = file.listFiles(); if(files != null) { for (File f : files) { if(!isMetadata(f)) { add(f); } } } }
Example #29
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 5 votes |
public void copyAddedFile2VersionedFolder_DO() throws Exception { // init File toFolder = new File(wc, "toFolder"); toFolder.mkdirs(); commit(wc); File fromFile = new File(wc, "fromFile"); fromFile.createNewFile(); File toFile = new File(toFolder, fromFile.getName()); // add getClient().addFile(fromFile); // rename copyDO(fromFile, toFile); // test assertTrue(fromFile.exists()); assertTrue(toFile.exists()); assertEquals(SVNStatusKind.ADDED, getSVNStatus(fromFile).getTextStatus()); assertEquals(SVNStatusKind.ADDED, getSVNStatus(toFile).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_ADDEDLOCALLY, getStatus(fromFile)); assertCachedStatus(toFile, FileInformation.STATUS_VERSIONED_ADDEDLOCALLY); assertFalse(getSVNStatus(toFile).isCopied()); // commit(wc); }
Example #30
Source File: InteceptorTest.java From netbeans with Apache License 2.0 | 5 votes |
public void deleteA_moveUnversioned2A_FO() throws Exception { // init File folderA = new File(wc, "folderA"); folderA.mkdir(); File fileA = new File(folderA, "f"); fileA.createNewFile(); commit(wc); File folderB = new File(wc, "folderB"); folderB.mkdir(); File fileUnversioned = new File(folderB, "f"); fileUnversioned.createNewFile(); //delete delete(fileA); assertFalse(fileA.exists()); assertEquals(SVNStatusKind.DELETED, getSVNStatus(fileA).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY, getStatus(fileA)); // move moveFO(fileUnversioned, fileA); // test assertTrue(fileA.exists()); assertFalse(fileUnversioned.exists()); assertEquals(SVNStatusKind.NORMAL, getSVNStatus(fileA).getTextStatus()); assertEquals(FileInformation.STATUS_VERSIONED_UPTODATE, getStatus(fileA)); }