/** * @param args * @param workDir * @return command output * @throws GitException */ private String launchCommandIn(ArgumentListBuilder args, FilePath workDir) throws GitException { ByteArrayOutputStream fos = new ByteArrayOutputStream(); try { args.prepend(getGitExe()); int status = launcher.launch().cmds(args.toCommandArray()). envs(environment).stdout(fos).pwd(workDir).join(); String result = fos.toString(); if (status != 0) { throw new GitException( "Command \"" + StringUtils.join(args.toCommandArray(), " ") + "\" returned status code " + status + ": " + result); } return result; } catch (Exception e) { throw new GitException("Error performing command: " + StringUtils.join(args.toCommandArray(), " ") + "\n" + e.getMessage(), e); } }
/** * @param args * @param workDir * @return command output * @throws GitException */ private String launchCommandIn(ArgumentListBuilder args, FilePath workDir) throws GitException { ByteArrayOutputStream fos = new ByteArrayOutputStream(); try { args.prepend(getGitExe()); int status = launcher.launch().cmds(args.toCommandArray()). envs(environment).stdout(fos).pwd(workDir).join(); String result = fos.toString(); if (status != 0) { throw new GitException( "Command \"" + StringUtils.join(args.toCommandArray(), " ") + "\" returned status code " + status + ": " + result); } return result; } catch (Exception e) { throw new GitException("Error performing command: " + StringUtils.join(args.toCommandArray(), " ") + "\n" + e.getMessage(), e); } }
private void whatchanged(String revFrom, String revTo, OutputStream outputStream, String... extraargs) throws GitException { String revSpec = revFrom + ".." + revTo; ArgumentListBuilder args = new ArgumentListBuilder(); args.add(getGitExe(), "whatchanged"); args.add(extraargs); args.add(revSpec); try { if (launcher.launch().cmds(args).envs(environment).stdout( outputStream).pwd(workspace).join() != 0) { throw new GitException("Error launching git whatchanged"); } } catch (Exception e) { throw new GitException("Error performing git whatchanged", e); } }
private void whatchanged(String revFrom, String revTo, OutputStream outputStream, String... extraargs) throws GitException { String revSpec = revFrom + ".." + revTo; ArgumentListBuilder args = new ArgumentListBuilder(); args.add(getGitExe(), "whatchanged"); args.add(extraargs); args.add(revSpec); try { if (launcher.launch().cmds(args).envs(environment).stdout( outputStream).pwd(workspace).join() != 0) { throw new GitException("Error launching git whatchanged"); } } catch (Exception e) { throw new GitException("Error performing git whatchanged", e); } }