@Test public void ParseALaSSCM() throws IOException { String newLine = "\r\r\n"; String author1 = "Michailf"; String author3 = "Joec"; String author4 = "user4"; String author5 = "user5"; String date1 = "9/7/2013 1:10 PM"; String date2 = "10/8/2013 1:13 PM"; String date3 = "10/8/2013 1:14 PM"; String date4 = "10/8/2013 1:15 PM"; String date5 = "10/18/2013 11:16 PM"; String comment3 = "Change with check in." + newLine + "" + newLine + "Third comment line"; String comment5 = "Comment with promote"; String output = "Full file path: Branch1/Repo with spaces/readme.txt" + newLine + "Branch: Branch1" + newLine + "Working directory: C:\\scm\\Branch1\\Repo with spaces" + newLine + "Action: User: Version: Date:" + newLine + "add Michailf 1 " + date1 + newLine + "add to branch[Bug#00000008 - Branch to work on changes.]" + newLine + " Joec 1 " + date2 + newLine + "checkin Joec 2 " + date3 + newLine + " Comments - " + comment3 + newLine + "promote from[Bug#00000008 - Branch to work on changes. v. 2]" + newLine + " user4 3 " + date4 + newLine + "promote from[Bug#00000008 - Branch to work on changes. v. 3]" + newLine + " user5 4 " + date5 + newLine + " Comments - " + comment5 + newLine; History result = instance.parse(output); assertNotNull(result); assertTrue("Should contain four history entries", 4 == result.getHistoryEntries().size()); { HistoryEntry e0 = result.getHistoryEntries().get(0); assertEquals("4", e0.getRevision()); assertEquals(author5, e0.getAuthor()); assertTrue(!e0.getMessage().isEmpty()); assertEquals(0, e0.getFiles().size()); } { HistoryEntry e1 = result.getHistoryEntries().get(1); assertEquals("3", e1.getRevision()); assertEquals(author4, e1.getAuthor()); assertTrue(!e1.getMessage().isEmpty()); assertEquals(0, e1.getFiles().size()); } { HistoryEntry e2 = result.getHistoryEntries().get(2); assertEquals("2", e2.getRevision()); assertEquals(author3, e2.getAuthor()); assertTrue(!e2.getMessage().isEmpty()); assertEquals(0, e2.getFiles().size()); } { HistoryEntry e3 = result.getHistoryEntries().get(3); assertEquals("1", e3.getRevision()); assertEquals(author1, e3.getAuthor()); assertTrue(e3.getMessage().isEmpty()); assertEquals(0, e3.getFiles().size()); } }
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); } return history; }
SSCMHistoryParser 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); } return history; } }
SSCMHistoryParser 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); } return history; } SSCMHistoryParser(SSCMRepository repository); }
SSCMHistoryParser 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); } return history; } SSCMHistoryParser(SSCMRepository repository); @Override void processStream(InputStream input); }
SSCMHistoryParser 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); } return history; } SSCMHistoryParser(SSCMRepository repository); @Override void processStream(InputStream input);  }