/** {@inheritDoc} */ public <T> T withRepository(RepositoryCallback<T> callable) throws IOException, InterruptedException { return proxy.withRepository(callable); }
private ObjectId getFirstParent(final ObjectId id, GitClient git) throws GitException, IOException, InterruptedException { return git.withRepository(new RepositoryCallback<ObjectId>() { @Override public ObjectId invoke(Repository repository, VirtualChannel virtualChannel)
private void printCommitMessageToLog(TaskListener listener, GitClient git, final Build revToBuild) throws IOException { try { RevCommit commit = git.withRepository(new RevCommitRepositoryCallback(revToBuild)); listener.getLogger().println("Commit message: \"" + commit.getShortMessage() + "\""); } catch (InterruptedException e) { e.printStackTrace(listener.error("Unable to retrieve commit message")); } }
return git.withRepository(new RepositoryCallback<List<Revision>>() { public List<Revision> invoke(Repository repository, VirtualChannel channel) throws IOException { try (RevWalk walk = new RevWalk(repository)) {
private Map<String, BlameResult> loadBlameResultsForFiles(final Map<String, BlameRequest> linesOfConflictingFiles) throws InterruptedException, IOException { try { ObjectId headCommit = git.revParse(gitCommit); return git.withRepository(new BlameCallback(this, headCommit, linesOfConflictingFiles.values())); } catch (GitException exception) { log("Can't determine head commit using 'git rev-parse'. Skipping blame. %n%s%n", exception.getMessage()); return Collections.emptyMap(); } }
return git.withRepository(new RepositoryCallback<List<Revision>>() { public List<Revision> invoke(Repository repo, VirtualChannel channel) throws IOException, InterruptedException {
throw new IOException("Closed"); return client.withRepository(new RepositoryCallback<V>() { @Override public V invoke(Repository repository, VirtualChannel virtualChannel)
return utils.git.withRepository(new RepositoryCallback<List<Revision>>() { public List<Revision> invoke(Repository repo, VirtualChannel channel) throws IOException, InterruptedException { Collections.sort(in,new CommitTimeComparator(repo));
public GitConfig getGitConfig() throws AbortException { try { GitClient client = Git.with(listener, env).in(workspace).getClient(); return client.withRepository(new GitInfoCallback(listener)); } catch (Exception e) { throw new AbortException("Error getting git config " + e); } }
public GitConfig getGitConfig() throws AbortException { try { GitClient client = Git.with(listener, env).in(workspace).getClient(); return client.withRepository(new GitInfoCallback(listener)); } catch (Exception e) { throw new AbortException("Error getting git config " + e); } }
return utils.git.withRepository(new RepositoryCallback<List<Revision>>() { public List<Revision> invoke(Repository repo, VirtualChannel channel) throws IOException, InterruptedException { Collections.sort(in,new CommitTimeComparator(repo));
@Override public Blames blame(final Report report) { try { report.logInfo("Invoking Git blamer to create author and commit information for all affected files"); report.logInfo("GIT_COMMIT env = '%s'", gitCommit); report.logInfo("Git working tree = '%s'", git.getWorkTree()); ObjectId headCommit = git.revParse(gitCommit); if (headCommit == null) { report.logError("Could not retrieve HEAD commit, aborting"); return new Blames(); } report.logInfo("Git commit ID = '%s'", headCommit.getName()); String workspacePath = getWorkspacePath(); report.logInfo("Job workspace = '%s'", workspacePath); return git.withRepository(new BlameCallback(report, headCommit, workspacePath)); } catch (IOException exception) { report.logException(exception, "Computing blame information failed with an exception:"); } catch (GitException exception) { report.logException(exception, "Can't determine head commit using 'git rev-parse'. Skipping blame."); } catch (InterruptedException e) { // nothing to do, already logged } return new Blames(); }