/** * Set upstream {@code RevCommit} * * @param upstream * the upstream commit * @return {@code this} */ public RebaseCommand setUpstream(RevCommit upstream) { this.upstreamCommit = upstream; this.upstreamCommitName = upstream.name(); return this; }
public GoConfigRevisions getCommits(final int pageSize, final int offset) { return doLocked(() -> { GoConfigRevisions goConfigRevisions = new GoConfigRevisions(); try { LogCommand command = git.log().setMaxCount(pageSize).setSkip(offset); Iterable<RevCommit> revisions = command.call(); for (RevCommit revision : revisions) { GoConfigRevision goConfigRevision = new GoConfigRevision((byte[]) null, revision.getFullMessage()); goConfigRevision.setCommitSHA(revision.name()); goConfigRevisions.add(goConfigRevision); } } catch (Exception e) { // ignore } return goConfigRevisions; }); }
private void writeCurrentCommit(RevCommit commit) throws IOException { RebaseState.appendToFile(rebaseState.getFile(CURRENT_COMMIT), commit.name()); }
/** {@inheritDoc} */ @Override public String toString() { final StringBuilder s = new StringBuilder(); s.append(Constants.typeString(getType())); s.append(' '); s.append(name()); s.append(' '); s.append(commitTime); s.append(' '); appendCoreFlags(s); return s.toString(); } }
private void add(RevCommit c) { final int flag = walker.allocFlag(); branchMask |= flag; if ((c.flags & branchMask) != 0) { // This should never happen. RevWalk ensures we get a // commit admitted to the initial queue only once. If // we see this marks aren't correctly erased. // throw new IllegalStateException(MessageFormat.format(JGitText.get().staleRevFlagsOn, c.name())); } c.flags |= flag; pending.add(c); }
throw new NoMergeBaseException(NoMergeBaseException.MergeBaseFailureReason.TOO_MANY_MERGE_BASES, MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, Integer.valueOf(MAX_BASES), a.name(), b.name(), Integer.valueOf(baseCommits.size()))); MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, Integer.valueOf(MAX_BASES), a.name(), b.name(), Integer.valueOf(baseCommits.size()))); parents.add(nextBase);
private RevCommit getParentCommit(RevCommit srcCommit, RevWalk revWalk) throws MultipleParentsNotAllowedException, MissingObjectException, IOException { final RevCommit srcParent; if (mainlineParentNumber == null) { if (srcCommit.getParentCount() != 1) throw new MultipleParentsNotAllowedException( MessageFormat.format( JGitText.get().canOnlyCherryPickCommitsWithOneParent, srcCommit.name(), Integer.valueOf(srcCommit.getParentCount()))); srcParent = srcCommit.getParent(0); } else { if (mainlineParentNumber.intValue() > srcCommit.getParentCount()) throw new JGitInternalException(MessageFormat.format( JGitText.get().commitDoesNotHaveGivenParent, srcCommit, mainlineParentNumber)); srcParent = srcCommit .getParent(mainlineParentNumber.intValue() - 1); } revWalk.parseHeaders(srcParent); return srcParent; }
try { co.setProgressMonitor(monitor); co.setName(newCommit.name()).call(); if (headName.startsWith(Constants.R_HEADS)) { RefUpdate rup = repo.updateRef(headName); rup.setExpectedOldObjectId(oldCommit); rup.setNewObjectId(newCommit); rup.setRefLogMessage("Fast-forward from " + oldCommit.name() //$NON-NLS-1$ + " to " + newCommit.name(), false); //$NON-NLS-1$ Result res = rup.update(walk); switch (res) {
@Override public String getStringRepresentation() { if (commitRef == null) { return null; } return commitRef.name(); } }
/** * @param upstream * the upstream commit * @return {@code this} */ public RebaseCommand setUpstream(RevCommit upstream) { this.upstreamCommit = upstream; this.upstreamCommitName = upstream.name(); return this; }
rebaseState.createFile(AMEND, commitToPick.name()); return stop(commitToPick, Status.EDIT); case COMMENT:
@Override protected IStatus run(IProgressMonitor monitor) { try { op.execute(monitor); } catch (CoreException e) { Activator.logError(MessageFormat.format( UIText.StashDropCommand_dropFailed, commit.name()), e); } return Status.OK_STATUS; }
protected static Collection<RemoteRefUpdate> push(TestRepository from, RevCommit q) throws IOException { final Repository db = from.getRepository(); final String srcExpr = q.name(); final String dstName = master; final boolean forceUpdate = true; final String localName = null; final ObjectId oldId = null; RemoteRefUpdate u = new RemoteRefUpdate(db, srcExpr, dstName, forceUpdate, localName, oldId); return Collections.singleton(u); }
@Override public Collection<String> getWebSocketObservables() { Collection<String> regions = super.getWebSocketObservables(); PullRequest request = getPullRequest(); if (request != null) { regions.add(CommitIndexed.getWebSocketObservable(request.getBaseCommit().name())); regions.add(CommitIndexed.getWebSocketObservable(request.getHeadCommit().name())); } return regions; }
private void checkout(RevCommit commit, IProgressMonitor monitor) throws CoreException { monitor.setTaskName(UIText.FetchGerritChangePage_CheckingOutTaskName); BranchOperationUI.checkout(repository, commit.name()).run(monitor); monitor.worked(1); }
public Object execute(final ExecutionEvent event) throws ExecutionException { final List<RepositoryCommit> commits = getCommits(event); if (commits.size() == 1) { final RepositoryCommit commit = commits.get(0); BranchOperationUI.checkout(commit.getRepository(), commit.getRevCommit().name()).start(); } return null; } }
MessageFormat.format( JGitText.get().canOnlyRevertCommitsWithOneParent, srcCommit.name(), Integer.valueOf(srcCommit.getParentCount())));
public static String getHashOldest(Repository repository) throws Exception { try (RevWalk revWalk = new RevWalk(repository)) { revWalk.markStart( revWalk.parseCommit(repository.resolve(Constants.HEAD))); revWalk.sort(RevSort.COMMIT_TIME_DESC, true); revWalk.sort(RevSort.REVERSE, true); RevCommit revCommit = revWalk.next(); return revCommit.name(); } }