@Test public void parseLogNoFile() throws Exception { String revId1 = "1234"; String author1 = "First Last <username@example.com>"; String date1 = "Wed 2008-10-01 10:01:34 +0200"; String revId2 = "1234"; String author2 = "First2 Last2 <username2@example.com>"; String date2 = "Wed 2008-10-15 09:21:31 +0100"; String revId3 = "4"; String author3 = "First3 Last3 <username3@example.com>"; String date3 = "Wed 2008-10-15 09:21:31 -0100"; String revId4 = "4.1"; String author4 = "First3 Last3 <username3@example.com>"; String date4 = "Wed 2008-10-15 09:21:31 -0100"; String output = "------------------------------------------------------------\n" + "revno: " + revId1 + "\n" + "committer: " + author1 + "\n" + "branch nick: 1.2 branch\n" + "timestamp: " + date1 + "\n" + "message:\n" + " Some message.\n" + "------------------------------------------------------------\n" + "revno: " + revId2 + "\n" + "committer: " + author2 + "\n" + "branch nick: branch-name\n" + "timestamp: " + date2 + "\n" + "message:\n" + " One line comment.\n" + "------------------------------------------------------------\n" + "revno: " + revId3 + "\n" + "committer: " + author3 + "\n" + "timestamp: " + date3 + "\n" + "message:\n" + " Comment over two lines, this is line1\n" + " and this is line2\n" + " ------------------------------------------------------------\n" + " revno: " + revId4 + "\n" + " committer: " + author4 + "\n" + " timestamp: " + date4 + "\n" + " message:\n" + " Just a message\n"; History result = instance.parse(output); assertNotNull(result); assertNotNull(result.getHistoryEntries()); assertEquals(3, result.getHistoryEntries().size()); HistoryEntry e1 = result.getHistoryEntries().get(0); assertEquals(revId1, e1.getRevision()); assertEquals(author1, e1.getAuthor()); assertEquals(0, e1.getFiles().size()); HistoryEntry e2 = result.getHistoryEntries().get(1); assertEquals(revId2, e2.getRevision()); assertEquals(author2, e2.getAuthor()); assertEquals(0, e2.getFiles().size()); HistoryEntry e3 = result.getHistoryEntries().get(2); assertEquals(revId3, e3.getRevision()); assertEquals(author3, e3.getAuthor()); assertEquals(0, e3.getFiles().size()); assertTrue(e3.getMessage().contains("line1")); assertTrue(e3.getMessage().contains("line2")); assertTrue(e3.getMessage().contains("revno: " + revId4)); }
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);  }