org.tmatesoft.svn.core.wc.SVNRevision Java Examples
The following examples show how to use
org.tmatesoft.svn.core.wc.SVNRevision.
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: SvnKitDiff.java From StatSVN with GNU Lesser General Public License v3.0 | 6 votes |
/** * Gets a single diff for a file between two revisions. */ public int[] getLineDiff(String oldRevNr, String newRevNr, String filename) throws IOException, BinaryDiffException { int oldRevisionNo = Integer.parseInt(oldRevNr); int newRevisionNo = Integer.parseInt(newRevNr); File newFile = new File(getProcessor().getInfoProcessor().relativeToAbsolutePath(filename)); File oldFile = newFile; ByteArrayOutputStream diffBytes = new ByteArrayOutputStream(); try { getManager().getDiffClient().doDiff(oldFile, SVNRevision.create(oldRevisionNo), newFile, SVNRevision.create(newRevisionNo), SVNDepth.INFINITY, false, diffBytes, null); } catch (SVNException ex) { handleSvnException(ex); } String modDiffDataStr = replaceRelativePathWithinDiffData(getCheckoutDirectory(), diffBytes.toString()); return parseSingleDiffStream(new ByteArrayInputStream(modDiffDataStr.getBytes())); }
Example #2
Source File: SvnPersisterCoreImpl.java From proctor with Apache License 2.0 | 6 votes |
/** * Returns the most recent log entry startRevision. * startRevision should not be HEAD because the path @HEAD could be deleted. * * @param path * @param startRevision * @return * @throws SVNException */ private SVNLogEntry getMostRecentLogEntry(final SVNClientManager clientManager, final String path, final SVNRevision startRevision) throws SVNException { final String[] targetPaths = {path}; final SVNLogClient logClient = clientManager.getLogClient(); final FilterableSVNLogEntryHandler handler = new FilterableSVNLogEntryHandler(); final int limit = 1; // In order to get history is "descending" order, the startRevision should be the one closer to HEAD // The path@head could be deleted - must use 'pegRevision' to get history at a deleted path logClient.doLog(svnUrl, targetPaths, /* pegRevision */ startRevision, /* startRevision */ startRevision, /* endRevision */ SVNRevision.create(1), /* stopOnCopy */ false, /* discoverChangedPaths */ false, /* includeMergedRevisions */ false, limit, new String[]{SVNRevisionProperty.AUTHOR}, handler); if (handler.getLogEntries().isEmpty()) { return null; } else { return handler.getLogEntries().get(0); } }
Example #3
Source File: SvnProctor.java From proctor with Apache License 2.0 | 6 votes |
@Nonnull @Override public List<Revision> getMatrixHistory(final int start, final int limit) throws StoreException { final String[] targetPaths = {}; return getSvnCore().doWithClientAndRepository(new SvnPersisterCore.SvnOperation<List<Revision>>() { @Override public List<Revision> execute(final SVNRepository repo, final SVNClientManager clientManager) throws Exception { return getSVNLogs(clientManager, targetPaths, SVNRevision.HEAD, start, limit); } @Override public StoreException handleException(final Exception e) throws StoreException { throw new StoreException.ReadException("Unable to get matrix history", e); } }); }
Example #4
Source File: SvnProctor.java From proctor with Apache License 2.0 | 6 votes |
@Nonnull @Override public String getLatestVersion() throws StoreException { return getSvnCore().doWithClientAndRepository(new SvnPersisterCore.SvnOperation<String>() { @Override public String execute(final SVNRepository repo, final SVNClientManager clientManager) throws Exception { final String[] targetPaths = {}; final SVNRevision svnRevision = SVNRevision.HEAD; final SVNLogClient logClient = clientManager.getLogClient(); final FilterableSVNLogEntryHandler handler = new FilterableSVNLogEntryHandler(); // In order to get history is "descending" order, the startRevision should be the one closer to HEAD logClient.doLog(svnUrl, targetPaths, /* pegRevision */ SVNRevision.HEAD, svnRevision, SVNRevision.create(1), /* stopOnCopy */ false, /* discoverChangedPaths */ false, /* includeMergedRevisions */ false, /* limit */ 1, new String[]{SVNRevisionProperty.LOG}, handler); final SVNLogEntry entry = handler.getLogEntries().size() > 0 ? handler.getLogEntries().get(0) : null; return entry == null ? "-1" : String.valueOf(entry.getRevision()); } @Override public StoreException handleException(final Exception e) throws StoreException { throw new StoreException.ReadException("Unable to get latest revision", e); } }); }
Example #5
Source File: StatusCmdTest.java From git-as-svn with GNU General Public License v2.0 | 6 votes |
@Test public void simple() throws Exception { try (SvnTestServer server = SvnTestServer.createMasterRepository()) { final SvnOperationFactory factory = server.createOperationFactory(); final SvnCheckout checkout = factory.createCheckout(); checkout.setSource(SvnTarget.fromURL(server.getUrl())); checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); checkout.setRevision(SVNRevision.create(1)); checkout.run(); final SvnGetStatus status = factory.createGetStatus(); status.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); status.setRevision(SVNRevision.create(2)); status.run(); } }
Example #6
Source File: SvnWorkingCopyManager.java From scava with Eclipse Public License 2.0 | 6 votes |
public void checkoutBroken(File workingDirectory, VcsRepository repository, String revision) throws WorkingCopyCheckoutException { try { SvnUtil.setupLibrary(); final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); try { final SvnCheckout checkout = svnOperationFactory.createCheckout(); checkout.setSingleTarget(SvnTarget.fromFile(workingDirectory)); checkout.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(repository.getUrl()), SVNRevision.create(Long.parseLong(revision)))); checkout.run(); } finally { svnOperationFactory.dispose(); } } catch (NumberFormatException | SVNException e) { throw new WorkingCopyCheckoutException(repository, revision, e); } }
Example #7
Source File: TestCheckOut.java From klask-io with GNU General Public License v3.0 | 6 votes |
private static void checkout(final SVNUpdateClient updateClient, final String checkoutRootPath, final String destRootPath, final String repoPath, final SVNDepth depth) { // updateClient.doExport( // SVNURL.parseURIDecoded(checkoutRootPath + "/" + repoPath), // new File(destRootPath + (!repoPath.isEmpty() ? "/" : "") + repoPath), // SVNRevision.UNDEFINED, // SVNRevision.HEAD, // null, // true, // depth); try { updateClient.doCheckout( SVNURL.parseURIDecoded(checkoutRootPath + "/" + repoPath), new File(destRootPath + (!repoPath.isEmpty() ? "/" : "") + repoPath), SVNRevision.UNDEFINED, SVNRevision.HEAD, depth, true); } catch (final SVNException e) { System.err.println("Exception sur le fichier " + checkoutRootPath + "/" + repoPath); System.err.println(e.getMessage()); } }
Example #8
Source File: SubversionCommit.java From Getaviz with Apache License 2.0 | 6 votes |
private String createDiffDescription(long revision, String cleanedFilePath) throws SVNException { String returnable = null; final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); try { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final SvnDiffGenerator diffGenerator = new SvnDiffGenerator(); final SvnDiff diff = svnOperationFactory.createDiff(); SVNURL currentRepoFilePath = SVNURL.parseURIEncoded(repo.getLocation().toString() + "/" + cleanedFilePath); List<SVNFileRevision> revisions = new ArrayList<SVNFileRevision>(); repo.getFileRevisions(cleanedFilePath, revisions, 0, entry.getRevision()); diff.setSources(SvnTarget.fromURL(currentRepoFilePath, SVNRevision.create(getLastCommitWhenChanged(revision, revisions))), SvnTarget.fromURL(currentRepoFilePath, SVNRevision.create(revision))); diff.setUseGitDiffFormat(true); diff.setDiffGenerator(diffGenerator); diff.setOutput(byteArrayOutputStream); diff.setDepth(SVNDepth.EMPTY); diff.run(); returnable = new String(byteArrayOutputStream.toByteArray()); } finally { svnOperationFactory.dispose(); } return returnable; }
Example #9
Source File: SvnKitDiff.java From StatSVN with GNU Lesser General Public License v3.0 | 6 votes |
/** * Gets diffs inside one revision. * * @return a list of diffs that were extracted from one particular revision */ public Vector getLineDiff(String newRevNr) throws IOException, BinaryDiffException { ByteArrayOutputStream diffBytes = new ByteArrayOutputStream(); int revisionNo = Integer.parseInt(newRevNr); try { getManager().getDiffClient().doDiff(getCheckoutDirectory(), SVNRevision.create(revisionNo), SVNRevision.create(revisionNo - 1), SVNRevision.create(revisionNo), SVNDepth.INFINITY, false, diffBytes, null); } catch (SVNException ex) { handleSvnException(ex); } String modDiffDataStr = replaceRelativePathWithinDiffData(getCheckoutDirectory(), diffBytes.toString()); final Vector answer = new Vector(); parseMultipleDiffStream(answer, new ByteArrayInputStream(modDiffDataStr.getBytes())); return answer; }
Example #10
Source File: SvnUpdateTest.java From git-as-svn with GNU General Public License v2.0 | 5 votes |
/** * Bug: svn up doesnt remove file #18 * <pre> * bozaro@landfill:/tmp/test/git-as-svn$ echo > test.txt * bozaro@landfill:/tmp/test/git-as-svn$ svn add test.txt * A test.txt * bozaro@landfill:/tmp/test/git-as-svn$ svn commit -m "Add new file" * Добавляю test.txt * Передаю данные . * Committed revision 58. * bozaro@landfill:/tmp/test/git-as-svn$ svn up -r 57 * Updating '.': * В редакции 57. * bozaro@landfill:/tmp/test/git-as-svn$ ls -l test.txt * -rw-rw-r-- 1 bozaro bozaro 1 авг. 15 00:50 test.txt * bozaro@landfill:/tmp/test/git-as-svn$ * </pre> */ @Test public void addAndUpdate() throws Exception { try (SvnTestServer server = SvnTestServer.createEmpty()) { final SvnOperationFactory factory = server.createOperationFactory(); final SVNClientManager client = SVNClientManager.newInstance(factory); // checkout final SvnCheckout checkout = factory.createCheckout(); checkout.setSource(SvnTarget.fromURL(server.getUrl())); checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); checkout.setRevision(SVNRevision.HEAD); final long revision = checkout.run(); // create file Path newFile = server.getTempDirectory().resolve("somefile.txt"); TestHelper.saveFile(newFile, "Bla Bla Bla"); // add file client.getWCClient().doAdd(newFile.toFile(), false, false, false, SVNDepth.INFINITY, false, true); // set eof property client.getWCClient().doSetProperty(newFile.toFile(), SVNProperty.EOL_STYLE, SVNPropertyValue.create(SVNProperty.EOL_STYLE_NATIVE), false, SVNDepth.INFINITY, null, null); // commit new file client.getCommitClient().doCommit(new File[]{newFile.toFile()}, false, "Add file commit", null, null, false, false, SVNDepth.INFINITY); // update for checkout revision client.getUpdateClient().doUpdate(server.getTempDirectory().toFile(), SVNRevision.create(revision), SVNDepth.INFINITY, false, false); // file must be remove Assert.assertFalse(Files.exists(newFile)); } }
Example #11
Source File: SvnClient.java From steady with Apache License 2.0 | 5 votes |
public File checkoutFile(String _rev, String _rel_path) { final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); File f = null; SVNURL url = null; try { // Create subdir for given rev final String rel_dir = _rel_path.substring(0, _rel_path.lastIndexOf('/')); final Path rev_dir = Paths.get(this.workDir.toString(), _rev, rel_dir); Path p = Files.createDirectories(rev_dir); // Create SVNURL for specific file url = SVNURL.parseURIEncoded(this.rootRepo.getRepositoryRoot(false) + "/" + rel_dir); // Perform checkout SVNRevision revision = SVNRevision.create(Long.valueOf(_rev)); SVNUpdateClient clnt = new SVNUpdateClient((ISVNAuthenticationManager)this.authManager, null); clnt.doCheckout(url, p.toFile(), revision, revision, SVNDepth.FILES, false); //IMMEDIATES, FILES, INFINITY // // final SvnCheckout checkout = svnOperationFactory.createCheckout(); // checkout.setSingleTarget(SvnTarget.fromFile(p.toFile())); // checkout.setSource(SvnTarget.fromURL(url)); // checkout.setDepth(SVNDepth.IMMEDIATES); //INFINITY // checkout.setRevision(revision); // // // Checkout and get file // checkout.run(); f = Paths.get(this.workDir.toString(), _rev, _rel_path).toFile(); } catch (Exception e) { SvnClient.log.error("Error while checking out URL '" + url + "', revision "+ _rev + ": " + e.getMessage()); } finally { svnOperationFactory.dispose(); } return f; }
Example #12
Source File: SvnCheckoutTest.java From git-as-svn with GNU General Public License v2.0 | 5 votes |
@Test public void checkoutRootRevision() throws Exception { try (SvnTestServer server = SvnTestServer.createEmpty()) { final SvnOperationFactory factory = server.createOperationFactory(); final SvnCheckout checkout = factory.createCheckout(); checkout.setSource(SvnTarget.fromURL(server.getUrl())); checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); checkout.setRevision(SVNRevision.create(0)); checkout.run(); } }
Example #13
Source File: SvnProctor.java From proctor with Apache License 2.0 | 5 votes |
@Nonnull @Override public List<Revision> getHistory(final String test, final String version, final int start, final int limit) throws StoreException { final Long revision = SvnPersisterCoreImpl.parseRevisionOrDie(version); return getSvnCore().doWithClientAndRepository(new SvnPersisterCore.SvnOperation<List<Revision>>() { @Override public List<Revision> execute(final SVNRepository repo, final SVNClientManager clientManager) throws Exception { // check path before executing svn log final String testPath = getTestDefinitionsDirectory() + "/" + test; final SVNNodeKind kind = repo.checkPath(testPath, revision); if (kind == SVNNodeKind.NONE) { return Collections.emptyList(); } final String[] targetPaths = {testPath}; final SVNRevision svnRevision = SVNRevision.create(revision); return getSVNLogs(clientManager, targetPaths, svnRevision, start, limit); } @Override public StoreException handleException(final Exception e) throws StoreException { throw new StoreException.ReadException("Unable to get older revisions for " + test + " r" + revision, e); } }); }
Example #14
Source File: SvnKitPropget.java From StatSVN with GNU Lesser General Public License v3.0 | 5 votes |
public boolean isBinaryFile(final String revision, final String filename) { try { // TODO: HAS NEVER BEEN TESTED. SVNPropertyData data = getManager().getWCClient().doGetProperty(new File(filename), SVNProperty.MIME_TYPE, SVNRevision.parse(revision), SVNRevision.parse(revision)); return isBinary(data); } catch (SVNException e) { try { handleSvnException(e); } catch (IOException ex) { } return false; } }
Example #15
Source File: SvnProctor.java From proctor with Apache License 2.0 | 5 votes |
private List<Revision> getSVNLogs(final SVNClientManager clientManager, final String[] paths, final SVNRevision startRevision, final int start, final int limit) throws StoreException.ReadException { try { final SVNLogClient logClient = clientManager.getLogClient(); final FilterableSVNLogEntryHandler handler = new FilterableSVNLogEntryHandler(); // In order to get history is "descending" order, the startRevision should be the one closer to HEAD logClient.doLog(svnUrl, paths, /* pegRevision */ SVNRevision.HEAD, startRevision, SVNRevision.create(1), /* stopOnCopy */ false, /* discoverChangedPaths */ false, /* includeMergedRevisions */ false, /* limit */ start + limit, new String[]{SVNRevisionProperty.LOG, SVNRevisionProperty.AUTHOR, SVNRevisionProperty.DATE}, handler); final List<SVNLogEntry> entries = handler.getLogEntries(); final List<Revision> revisions; if (entries.size() <= start) { revisions = Collections.emptyList(); } else { final int end = Math.min(start + limit, entries.size()); revisions = Lists.newArrayListWithCapacity(end - start); for (int i = 0; i < end - start; i++) { final SVNLogEntry entry = entries.get(start + i); revisions.add(new Revision(String.valueOf(entry.getRevision()), entry.getAuthor(), entry.getDate(), entry.getMessage())); } } return revisions; } catch (final SVNException e) { throw new StoreException.ReadException("Unable to get older revisions"); } }
Example #16
Source File: SvnCheckoutTest.java From git-as-svn with GNU General Public License v2.0 | 4 votes |
private void checkUpdate(@NotNull String basePath) throws Exception { try (SvnTestServer server = SvnTestServer.createMasterRepository()) { final SvnOperationFactory factory = server.createOperationFactory(); factory.setAutoCloseContext(false); factory.setAutoDisposeRepositoryPool(false); final SVNRepository repo = server.openSvnRepository(); final List<Long> revisions = loadUpdateRevisions(repo, basePath); Assert.assertTrue(revisions.size() > 2); final SvnCheckout checkout = factory.createCheckout(); checkout.setSource(SvnTarget.fromURL(server.getUrl().appendPath(basePath, false))); checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); checkout.setRevision(SVNRevision.create(revisions.get(0))); checkout.run(); factory.setEventHandler(new ISVNEventHandler() { @Override public void handleEvent(SVNEvent event, double progress) { Assert.assertEquals(event.getExpectedAction(), event.getAction()); } @Override public void checkCancelled() { } }); final Random rand = new Random(0); for (long revision : revisions.subList(1, revisions.size())) { final SvnLog svnLog = factory.createLog(); svnLog.setSingleTarget(SvnTarget.fromURL(server.getUrl())); svnLog.setRevisionRanges(Collections.singletonList(SvnRevisionRange.create(SVNRevision.create(revision - 1), SVNRevision.create(revision)))); svnLog.setDiscoverChangedPaths(true); final SVNLogEntry logEntry = svnLog.run(); log.info("Update to revision #{}: {}", revision, StringHelper.getFirstLine(logEntry.getMessage())); final TreeMap<String, SVNLogEntryPath> paths = new TreeMap<>(logEntry.getChangedPaths()); final List<String> targets = new ArrayList<>(); final SvnUpdate update = factory.createUpdate(); String lastAdded = null; for (Map.Entry<String, SVNLogEntryPath> entry : paths.entrySet()) { String path = entry.getKey(); if ((lastAdded != null) && path.startsWith(lastAdded)) { continue; } if (entry.getValue().getType() == 'A') { lastAdded = path + "/"; } if (entry.getValue().getType() == 'A' || rand.nextBoolean()) { if (path.startsWith(basePath)) { final String subPath = path.substring(basePath.length()); targets.add(subPath.startsWith("/") ? subPath.substring(1) : subPath); } } } if (!targets.isEmpty()) { for (String target : targets) { update.addTarget(SvnTarget.fromFile(server.getTempDirectory().resolve(target).toFile())); } update.setRevision(SVNRevision.create(revision)); update.setSleepForTimestamp(false); update.setMakeParents(true); update.run(); } } } }
Example #17
Source File: SvnCheckoutTest.java From git-as-svn with GNU General Public License v2.0 | 4 votes |
/** * <pre> * svn checkout * echo > test.txt * svn commit -m "create test.txt" * rev N * echo foo > test.txt * svn commit -m "modify test.txt" * svn up rev N * </pre> */ @Test public void checkoutAndUpdate() throws Exception { try (SvnTestServer server = SvnTestServer.createEmpty()) { final SVNRepository repo = server.openSvnRepository(); final ISVNEditor editor = repo.getCommitEditor("Initial state", null, false, null); editor.openRoot(-1); editor.addDir("/src", null, -1); editor.addDir("/src/main", null, -1); editor.addFile("/src/main/source.txt", null, -1); editor.changeFileProperty("/src/main/source.txt", SVNProperty.EOL_STYLE, SVNPropertyValue.create(SVNProperty.EOL_STYLE_NATIVE)); sendDeltaAndClose(editor, "/src/main/source.txt", null, "Source content"); editor.closeDir(); editor.addDir("/src/test", null, -1); editor.addFile("/src/test/test.txt", null, -1); editor.changeFileProperty("/src/test/test.txt", SVNProperty.EOL_STYLE, SVNPropertyValue.create(SVNProperty.EOL_STYLE_NATIVE)); sendDeltaAndClose(editor, "/src/test/test.txt", null, "Test content"); editor.closeDir(); editor.closeDir(); editor.closeDir(); editor.closeEdit(); // checkout final SvnOperationFactory factory = server.createOperationFactory(); final SvnCheckout checkout = factory.createCheckout(); checkout.setSource(SvnTarget.fromURL(server.getUrl())); checkout.setSingleTarget(SvnTarget.fromFile(server.getTempDirectory().toFile())); checkout.setRevision(SVNRevision.HEAD); checkout.run(); final Path file = server.getTempDirectory().resolve("src/main/someFile.txt"); final SVNClientManager client = SVNClientManager.newInstance(factory); // create file final SVNCommitInfo commit; { Assert.assertFalse(Files.exists(file)); TestHelper.saveFile(file, "New content"); client.getWCClient().doAdd(file.toFile(), false, false, false, SVNDepth.INFINITY, false, true); client.getWCClient().doSetProperty(file.toFile(), SVNProperty.EOL_STYLE, SVNPropertyValue.create(SVNProperty.EOL_STYLE_NATIVE), false, SVNDepth.INFINITY, null, null); commit = client.getCommitClient().doCommit(new File[]{file.toFile()}, false, "Commit new file", null, null, false, false, SVNDepth.INFINITY); } // modify file { Assert.assertTrue(Files.exists(file)); TestHelper.saveFile(file, "Modified content"); client.getCommitClient().doCommit(new File[]{file.toFile()}, false, "Modify up-to-date commit", null, null, false, false, SVNDepth.INFINITY); } // update to previous commit client.getUpdateClient().doUpdate(server.getTempDirectory().toFile(), SVNRevision.create(commit.getNewRevision()), SVNDepth.INFINITY, false, false); // check no tree conflist ArrayList<String> changeLists = new ArrayList<>(); client.getStatusClient().doStatus(server.getTempDirectory().toFile(), SVNRevision.WORKING, SVNDepth.INFINITY, false, false, true, false, status -> { Assert.assertNull(status.getTreeConflict(), status.getFile().toString()); Assert.assertNull(status.getConflictNewFile(), status.getFile().toString()); }, changeLists); Assert.assertTrue(changeLists.isEmpty()); } }
Example #18
Source File: SvnPersisterCoreImpl.java From proctor with Apache License 2.0 | 4 votes |
@Override public TestVersionResult determineVersions(final String fetchRevision) throws StoreException.ReadException { checkShutdownState(); return doReadWithClientAndRepository(new SvnOperation<TestVersionResult>() { @Override public TestVersionResult execute(final SVNRepository repo, final SVNClientManager clientManager) throws Exception { final String testDefPath = testDefinitionsDirectory; /* final SVNDirEntry info = repo.info(testDefPath, 2); if (info == null) { LOGGER.warn("No test matrix found in " + testDefPath + " under " + svnPath); return null; } */ final Long revision = fetchRevision.length() > 0 ? parseRevisionOrDie(fetchRevision) : Long.valueOf(-1); final SVNRevision svnRevision = revision.longValue() > 0 ? SVNRevision.create(revision.longValue()) : SVNRevision.HEAD; final SVNLogClient logClient = clientManager.getLogClient(); final FilterableSVNDirEntryHandler handler = new FilterableSVNDirEntryHandler(); final SVNURL url = SvnPersisterCoreImpl.this.svnUrl.appendPath(testDefPath, false); logClient.doList(url, svnRevision, svnRevision, /* fetchlocks */false, SVNDepth.IMMEDIATES, SVNDirEntry.DIRENT_KIND | SVNDirEntry.DIRENT_CREATED_REVISION, handler); final SVNDirEntry logEntry = handler.getParent(); final List<TestVersionResult.Test> tests = Lists.newArrayListWithExpectedSize(handler.getChildren().size()); for (final SVNDirEntry testDefFile : handler.getChildren()) { if (testDefFile.getKind() != SVNNodeKind.DIR) { LOGGER.warn(String.format("svn kind (%s) is not SVNNodeKind.DIR, skipping %s", testDefFile.getKind(), testDefFile.getURL())); continue; } final String testName = testDefFile.getName(); final long testRevision; /* When a svn directory gets copied using svn cp source-dir destination-dir, the revision returned by svn list --verbose directory is different from that of svn log directory/sub-dir The revision returned by svn list is the revision of the on the source-dir instead of the destination-dir The code below checks to see if the directory at the provided revision exists, if it does it will use this revision. If the directory does does not exist, try and identify the correct revision using svn log. */ final SVNLogEntry log = getMostRecentLogEntry(clientManager, testDefPath + "/" + testDefFile.getRelativePath(), svnRevision); if (log != null && log.getRevision() != testDefFile.getRevision()) { // The difference in the log.revision and the list.revision can occur during an ( svn cp ) if (LOGGER.isDebugEnabled()) { LOGGER.debug("svn log r" + log.getRevision() + " is different than svn list r" + testDefFile.getRevision() + " for " + testDefFile.getURL()); } testRevision = log.getRevision(); } else { testRevision = testDefFile.getRevision(); } tests.add(new TestVersionResult.Test(testName, String.valueOf(testRevision))); } final String matrixRevision = String.valueOf(logEntry.getRevision()); return new TestVersionResult( tests, logEntry.getDate(), logEntry.getAuthor(), matrixRevision, logEntry.getCommitMessage() ); } @Override public StoreException handleException(final Exception e) throws StoreException { throw new StoreException.ReadException("Unable to read from SVN", e); } }); }