@Test public void testGetHistoryGetInvalid() throws Exception { assertNotNull("Couldn't read bitkeeper test repository.", bkRepo); assertNull("Something returned by getHistoryGet with fake file", bkRepo.getHistoryGet(bkRepo.getDirectoryName(), "fakename.cpp", "+")); assertNull("Something returned by getHistoryGet with fake file", bkRepo.getHistoryGet(bkRepo.getDirectoryName(), "fakename.cpp", "1.1")); }
@Override boolean getHistoryGet( BufferSink sink, String parent, String basename, String revision) { final File directory = new File(parent).getAbsoluteFile(); final ArrayList<String> argv = new ArrayList<String>(); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); argv.add(RepoCommand); argv.add("get"); argv.add("-p"); if (revision != null) { argv.add("-r" + revision); } argv.add(basename); final Executor executor = new Executor(argv, directory, RuntimeEnvironment.getInstance().getInteractiveCommandTimeout()); if (executor.exec(true) != 0) { LOGGER.log(Level.SEVERE, "Failed to get history: {0}", executor.getErrorString()); return false; } try { copyBytes(sink, executor.getOutputStream()); return true; } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to get content for {0}", basename); } return false; }
BitKeeperRepository extends Repository { @Override boolean getHistoryGet( BufferSink sink, String parent, String basename, String revision) { final File directory = new File(parent).getAbsoluteFile(); final ArrayList<String> argv = new ArrayList<String>(); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); argv.add(RepoCommand); argv.add("get"); argv.add("-p"); if (revision != null) { argv.add("-r" + revision); } argv.add(basename); final Executor executor = new Executor(argv, directory, RuntimeEnvironment.getInstance().getInteractiveCommandTimeout()); if (executor.exec(true) != 0) { LOGGER.log(Level.SEVERE, "Failed to get history: {0}", executor.getErrorString()); return false; } try { copyBytes(sink, executor.getOutputStream()); return true; } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to get content for {0}", basename); } return false; } }
BitKeeperRepository extends Repository { @Override boolean getHistoryGet( BufferSink sink, String parent, String basename, String revision) { final File directory = new File(parent).getAbsoluteFile(); final ArrayList<String> argv = new ArrayList<String>(); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); argv.add(RepoCommand); argv.add("get"); argv.add("-p"); if (revision != null) { argv.add("-r" + revision); } argv.add(basename); final Executor executor = new Executor(argv, directory, RuntimeEnvironment.getInstance().getInteractiveCommandTimeout()); if (executor.exec(true) != 0) { LOGGER.log(Level.SEVERE, "Failed to get history: {0}", executor.getErrorString()); return false; } try { copyBytes(sink, executor.getOutputStream()); return true; } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to get content for {0}", basename); } return false; } BitKeeperRepository(); }
BitKeeperRepository extends Repository { @Override boolean getHistoryGet( BufferSink sink, String parent, String basename, String revision) { final File directory = new File(parent).getAbsoluteFile(); final ArrayList<String> argv = new ArrayList<String>(); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); argv.add(RepoCommand); argv.add("get"); argv.add("-p"); if (revision != null) { argv.add("-r" + revision); } argv.add(basename); final Executor executor = new Executor(argv, directory, RuntimeEnvironment.getInstance().getInteractiveCommandTimeout()); if (executor.exec(true) != 0) { LOGGER.log(Level.SEVERE, "Failed to get history: {0}", executor.getErrorString()); return false; } try { copyBytes(sink, executor.getOutputStream()); return true; } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to get content for {0}", basename); } return false; } BitKeeperRepository(); @Override boolean isWorking(); Version getVersion(); @Override boolean fileHasHistory(File file); @Override boolean fileHasAnnotation(File file); @Override Annotation annotate(File file, String revision); @Override void buildTagList(File directory, CommandTimeoutType cmdType); }
BitKeeperRepository extends Repository { @Override boolean getHistoryGet( BufferSink sink, String parent, String basename, String revision) { final File directory = new File(parent).getAbsoluteFile(); final ArrayList<String> argv = new ArrayList<String>(); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); argv.add(RepoCommand); argv.add("get"); argv.add("-p"); if (revision != null) { argv.add("-r" + revision); } argv.add(basename); final Executor executor = new Executor(argv, directory, RuntimeEnvironment.getInstance().getInteractiveCommandTimeout()); if (executor.exec(true) != 0) { LOGGER.log(Level.SEVERE, "Failed to get history: {0}", executor.getErrorString()); return false; } try { copyBytes(sink, executor.getOutputStream()); return true; } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to get content for {0}", basename); } return false; } BitKeeperRepository(); @Override boolean isWorking(); Version getVersion(); @Override boolean fileHasHistory(File file); @Override boolean fileHasAnnotation(File file); @Override Annotation annotate(File file, String revision); @Override void buildTagList(File directory, CommandTimeoutType cmdType); static final String CMD_PROPERTY_KEY; static final String CMD_FALLBACK; }