public void tag(String tagName, String comment) throws GitException { tagName = tagName.replace(' ', '_'); try { launchCommand("tag", "-a", "-f", "-m", comment, tagName); } catch (GitException e) { throw new GitException("Could not apply tag " + tagName, e); } }
public void commit(File f) throws GitException { try { launchCommand("commit", "-F", f.getAbsolutePath()); } catch (GitException e) { throw new GitException("Cannot commit " + f, e); } }
/** {@inheritDoc} */ public void tag(String tagName, String comment) throws GitException, InterruptedException { tagName = tagName.replace(' ', '_'); try { launchCommand("tag", "-a", "-f", "-m", comment, tagName); } catch (GitException e) { throw new GitException("Could not apply tag " + tagName, e); } }
/** {@inheritDoc} */ public void deleteTag(String tagName) throws GitException, InterruptedException { tagName = tagName.replace(' ', '_'); try { launchCommand("tag", "-d", tagName); } catch (GitException e) { throw new GitException("Could not delete tag " + tagName, e); } }
/** {@inheritDoc} */ public void branch(String name) throws GitException, InterruptedException { try { launchCommand("branch", name); } catch (GitException e) { throw new GitException("Cannot create branch " + name, e); } }
/** {@inheritDoc} */ public void deleteBranch(String name) throws GitException, InterruptedException { try { launchCommand("branch", "-D", name); } catch (GitException e) { throw new GitException("Could not delete branch " + name, e); } }
/** {@inheritDoc} */ public void deleteRef(String refName) throws GitException, InterruptedException { refName = refName.replace(' ', '_'); try { launchCommand("update-ref", "-d", refName); } catch (GitException e) { throw new GitException("Could not delete ref " + refName, e); } }
/** {@inheritDoc} */ @Deprecated public void merge(String refSpec) throws GitException, InterruptedException { try { launchCommand("merge", refSpec); } catch (GitException e) { throw new GitException("Could not merge " + refSpec, e); } }
@Override public ChangelogCommand excludes(ObjectId rev) { try { walk.markUninteresting(walk.lookupCommit(rev)); return this; } catch (IOException e) { throw new GitException("Error: jgit excludes() in " + workspace + " " + e.getMessage(), e); } }
@Override public ChangelogCommand includes(ObjectId rev) { try { walk.markStart(walk.lookupCommit(rev)); hasIncludedRev = true; return this; } catch (IOException e) { throw new GitException("Error: jgit includes() in " + workspace + " " + e.getMessage(), e); } }
private void createNote(String note, String namespace, String command ) throws GitException, InterruptedException { File msg = null; try { msg = createTempFile("git-note", ".txt"); FileUtils.writeStringToFile(msg,note); launchCommand("notes", "--ref=" + namespace, command, "-F", msg.getAbsolutePath()); } catch (IOException | GitException e) { throw new GitException("Could not apply note " + note, e); } finally { deleteTempFile(msg); } }
/** {@inheritDoc} */ @Deprecated @Override public void merge(String refSpec) throws GitException, InterruptedException { try (Repository repo = getRepository()) { merge(repo.resolve(refSpec)); } catch (IOException e) { throw new GitException(e); } }
public void init() throws GitException { if (hasGitRepo()) { throw new GitException(Messages.GitAPI_Repository_FailedInitTwiceMsg()); } try { setDelegate(Git.init().setDirectory(new File(workspace.getRemote())).call()); } catch (GitAPIException ex) { throw new GitException(ex); } }
private void doInit(String workspace, boolean bare) throws GitException { try { Git.init().setBare(bare).setDirectory(new File(workspace)).call(); } catch (GitAPIException e) { throw new GitException(e); } }
/** {@inheritDoc} */ @Deprecated @Override public void setSubmoduleUrl(String name, String url) throws GitException, InterruptedException { try (Repository repo = getRepository()) { StoredConfig config = repo.getConfig(); config.setString("submodule", name, "url", url); config.save(); } catch (IOException e) { throw new GitException(e); } }
private StoredConfig getConfig(String GIT_DIR) throws GitException { try (Repository repo = isBlank(GIT_DIR) ? getRepository() : new RepositoryBuilder().setWorkTree(new File(GIT_DIR)).build()) { return repo.getConfig(); } catch (IOException ioe) { throw new GitException(ioe); } }
/** {@inheritDoc} */ @Override public void setRemoteUrl(String name, String url) throws GitException { try (Repository repo = getRepository()) { StoredConfig config = repo.getConfig(); config.setString("remote", name, "url", url); config.save(); } catch (IOException e) { throw new GitException(e); } }
/** {@inheritDoc} */ @Override public void branch(String name) throws GitException { try (Repository repo = getRepository()) { git(repo).branchCreate().setName(name).call(); } catch (GitAPIException e) { throw new GitException(e); } }
/** {@inheritDoc} */ @Override public void tag(String name, String message) throws GitException { try (Repository repo = getRepository()) { git(repo).tag().setName(name).setMessage(message).setForceUpdate(true).call(); } catch (GitAPIException e) { throw new GitException(e); } }
private void doCheckout(String ref, String branch) throws GitException { try (Repository repo = getRepository()) { git(repo).checkout().setName(branch).setCreateBranch(true).setForce(true).setStartPoint(ref).call(); } catch (GitAPIException e) { throw new GitException("Could not checkout " + branch + " with start point " + ref, e); } }