@Test @SuppressWarnings("unchecked") public void parseLogDirectory() throws Exception { String revId1 = "1234"; String author1 = "username@example.com"; String date1 = "Wed 2008-10-01 10:01:34 +0200"; String[] files = { "/filename.ext", "/directory", "/directory/filename.ext", "/directory/filename2.ext2", "/otherdir/file.extension" }; if (PlatformUtils.isWindows()) { files = new String[] { "\\\\filename.ext", "\\\\directory", "\\\\directory\\filename.ext", "\\\\directory\\filename2.ext2", "\\\\otherdir\\file.extension" }; } StringBuilder output = new StringBuilder(); for (int i = 0; i < 60; i++) { output.append('-'); } output.append('\n'); output.append("revno: " + revId1 + "\n"); output.append("committer: " + author1 + "\n"); output.append("timestamp: " + date1 + "\n"); output.append("message:\n"); output.append(" Some message\n"); output.append("added:\n"); for (String file : files) { output.append(" " + file.substring(1) + "\n"); } History result = instance.parse(output.toString()); assertNotNull(result); assertNotNull(result.getHistoryEntries()); assertEquals(1, result.getHistoryEntries().size()); HistoryEntry e1 = result.getHistoryEntries().get(0); assertEquals(revId1, e1.getRevision()); assertEquals(author1, e1.getAuthor()); assertEquals(new HashSet<>(Arrays.asList(files)), e1.getFiles()); }
History parse(File file, String sinceRevision) throws HistoryException { try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\" Exit code: " + status); } } catch (IOException e) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\"", e); } if (sinceRevision != null) { repository.removeAndVerifyOldestChangeset(entries, sinceRevision); } return new History(entries); }
BazaarHistoryParser implements Executor.StreamHandler { History parse(File file, String sinceRevision) throws HistoryException { try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\" Exit code: " + status); } } catch (IOException e) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\"", e); } if (sinceRevision != null) { repository.removeAndVerifyOldestChangeset(entries, sinceRevision); } return new History(entries); } }
BazaarHistoryParser implements Executor.StreamHandler { History parse(File file, String sinceRevision) throws HistoryException { try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\" Exit code: " + status); } } catch (IOException e) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\"", e); } if (sinceRevision != null) { repository.removeAndVerifyOldestChangeset(entries, sinceRevision); } return new History(entries); } BazaarHistoryParser(BazaarRepository repository); }
BazaarHistoryParser implements Executor.StreamHandler { History parse(File file, String sinceRevision) throws HistoryException { try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\" Exit code: " + status); } } catch (IOException e) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\"", e); } if (sinceRevision != null) { repository.removeAndVerifyOldestChangeset(entries, sinceRevision); } return new History(entries); } BazaarHistoryParser(BazaarRepository repository); @Override void processStream(InputStream input); }
BazaarHistoryParser implements Executor.StreamHandler { History parse(File file, String sinceRevision) throws HistoryException { try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\" Exit code: " + status); } } catch (IOException e) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\"", e); } if (sinceRevision != null) { repository.removeAndVerifyOldestChangeset(entries, sinceRevision); } return new History(entries); } BazaarHistoryParser(BazaarRepository repository); @Override void processStream(InputStream input);  }