public static ArrayMemory valueOf(ReflogEntry value) { ArrayMemory memory = new ArrayMemory(); memory.refOfIndex("newId").assign(valueOf(value.getNewId())); memory.refOfIndex("oldId").assign(valueOf(value.getOldId())); memory.refOfIndex("who").assign(value.getWho() == null ? Memory.NULL : valueOf(value.getWho())); memory.refOfIndex("comment").assign(value.getComment()); return memory; }
CheckoutEntryImpl(ReflogEntry reflogEntry) { String comment = reflogEntry.getComment(); int p1 = CHECKOUT_MOVING_FROM.length(); int p2 = comment.indexOf(" to ", p1); //$NON-NLS-1$ int p3 = comment.length(); from = comment.substring(p1,p2); to = comment.substring(p2 + " to ".length(), p3); //$NON-NLS-1$ }
/** * Write the given entry to the ref's log. * * @param refName * a {@link java.lang.String} object. * @param entry * a {@link org.eclipse.jgit.lib.ReflogEntry} object. * @return this writer * @throws java.io.IOException */ public ReflogWriter log(String refName, ReflogEntry entry) throws IOException { return log(refName, entry.getOldId(), entry.getNewId(), entry.getWho(), entry.getComment()); }
@Override public String getText(Object element) { final ReflogEntry entry = (ReflogEntry) element; return entry.getComment(); }
log.getOldId(), log.getNewId(), log.getComment());
ReflogEntry entry = entries.get(i); writer.log(stashLockRef, entryId, entry.getNewId(), entry.getWho(), entry.getComment()); entryId = entry.getNewId();
CheckoutEntryImpl(ReflogEntry reflogEntry) { String comment = reflogEntry.getComment(); int p1 = CHECKOUT_MOVING_FROM.length(); int p2 = comment.indexOf(" to ", p1); //$NON-NLS-1$ int p3 = comment.length(); from = comment.substring(p1,p2); to = comment.substring(p2 + " to ".length(), p3); //$NON-NLS-1$ }
CheckoutEntryImpl(ReflogEntry reflogEntry) { String comment = reflogEntry.getComment(); int p1 = CHECKOUT_MOVING_FROM.length(); int p2 = comment.indexOf(" to ", p1); //$NON-NLS-1$ int p3 = comment.length(); from = comment.substring(p1,p2); to = comment.substring(p2 + " to ".length(), p3); //$NON-NLS-1$ }
private String toString(ReflogEntry entry, int i) { final StringBuilder s = new StringBuilder(); s.append(entry.getNewId().abbreviate(7).name()); s.append(" "); //$NON-NLS-1$ s.append(ref == null ? Constants.HEAD : Repository.shortenRefName(ref)); s.append("@{" + i + "}:"); //$NON-NLS-1$ //$NON-NLS-2$ s.append(" "); //$NON-NLS-1$ s.append(entry.getComment()); return s.toString(); } }
public Image getImage(Object element) { String comment = ((ReflogEntry) element).getComment(); if (comment.startsWith("commit:") || comment.startsWith("commit (initial):")) //$NON-NLS-1$ //$NON-NLS-2$ return (Image) resourceManager.get(UIIcons.COMMIT); if (comment.startsWith("commit (amend):")) //$NON-NLS-1$ return (Image) resourceManager.get(UIIcons.AMEND_COMMIT); if (comment.startsWith("pull")) //$NON-NLS-1$ return (Image) resourceManager.get(UIIcons.PULL); if (comment.startsWith("clone")) //$NON-NLS-1$ return (Image) resourceManager.get(UIIcons.CLONEGIT); if (comment.startsWith("rebase")) //$NON-NLS-1$ return (Image) resourceManager.get(UIIcons.REBASE); if (comment.startsWith("merge")) //$NON-NLS-1$ return (Image) resourceManager.get(UIIcons.MERGE); if (comment.startsWith("fetch")) //$NON-NLS-1$ return (Image) resourceManager.get(UIIcons.FETCH); if (comment.startsWith("branch")) //$NON-NLS-1$ return (Image) resourceManager.get(UIIcons.CREATE_BRANCH); if (comment.startsWith("checkout")) //$NON-NLS-1$ return (Image) resourceManager.get(UIIcons.CHECKOUT); return null; }
/** * Write the given {@link ReflogEntry} entry to the ref's log * * @param refName * * @param entry * @return this writer * @throws IOException */ public ReflogWriter log(final String refName, final ReflogEntry entry) throws IOException { return log(refName, entry.getOldId(), entry.getNewId(), entry.getWho(), entry.getComment()); }
/** * Write the given entry to the ref's log. * * @param refName * a {@link java.lang.String} object. * @param entry * a {@link org.eclipse.jgit.lib.ReflogEntry} object. * @return this writer * @throws java.io.IOException */ public ReflogWriter log(String refName, ReflogEntry entry) throws IOException { return log(refName, entry.getOldId(), entry.getNewId(), entry.getWho(), entry.getComment()); }
@Test public void createBranchFromCommit_theRefLogShouldStartWithBranchCreatedFromCommit() throws IOException { writeSomethingToCache(); RevCommit commit = commitToMaster(); BranchUtils.createBranch("test_branch", commit, repo); ReflogEntry lastRefLog = BranchUtils.getLastLog("test_branch", repo); assert lastRefLog != null; assertTrue(lastRefLog.getComment().startsWith("branch: Created from commit")); }
@Test public void createBranchFromBranchName_theRefLogShouldStartWithBranchCreatedFromBranch() throws IOException { writeSomethingToCache(); commitToBranch("source_branch"); BranchUtils.createBranch("test_branch", "source_branch", repo); ReflogEntry lastRefLog = BranchUtils.getLastLog("test_branch", repo); assert lastRefLog != null; assertTrue(lastRefLog.getComment().startsWith("branch: Created from branch")); }
@Test public void createBranchFromCommitId_theRefLogShouldStartWithBranchCreatedFromCommit() throws IOException { writeSomethingToCache(); AnyObjectId commit = commitToMaster(); BranchUtils.createBranch("test_branch", commit, repo); ReflogEntry lastRefLog = BranchUtils.getLastLog("test_branch", repo); assert lastRefLog != null; assertTrue(lastRefLog.getComment().startsWith("branch: Created from commit")); }
@Test public void createBranchFromTagName_theHeadOfTheNewBranchShouldEqualToTheTaggedTag() throws IOException { writeSomethingToCache(); TagUtils.tagCommit("source_tag", commitToMaster(), repo); BranchUtils.createBranch("test_branch", "source_tag", repo); ReflogEntry lastRefLog = BranchUtils.getLastLog("test_branch", repo); assert lastRefLog != null; assertTrue(lastRefLog.getComment().startsWith("branch: Created from tag")); }
@Test public void createBranchFromCommitName_theRefLogShouldStartWithBranchCreatedFromCommit() throws IOException { writeSomethingToCache(); AnyObjectId commit = commitToMaster(); BranchUtils.createBranch("test_branch", commit.getName(), repo); ReflogEntry lastRefLog = BranchUtils.getLastLog("test_branch", repo); assert lastRefLog != null; assertTrue(lastRefLog.getComment().startsWith("branch: Created from commit")); }
@Test public void createBranchFromBranchRef_theRefLogShouldStartWithBranchCreatedFromBranch() throws IOException { writeSomethingToCache(); commitToBranch("source_branch"); BranchUtils.createBranch("test_branch", repo.findRef("source_branch"), repo); ReflogEntry lastRefLog = BranchUtils.getLastLog("test_branch", repo); assert lastRefLog != null; assertTrue(lastRefLog.getComment().startsWith("branch: Created from branch")); }
@Test public void createBranchFromTagRef_theHeadOfTheNewBranchShouldEqualToTheTaggedTag() throws IOException { writeSomethingToCache(); TagUtils.tagCommit("source_tag", commitToMaster(), repo); BranchUtils.createBranch("test_branch", repo.findRef("source_tag"), repo); ReflogEntry lastRefLog = BranchUtils.getLastLog("test_branch", repo); assert lastRefLog != null; assertTrue(lastRefLog.getComment().startsWith("branch: Created from tag")); }
@Test public void createBranchFromTag_theHeadOfTheNewBranchShouldEqualToTheTaggedTag() throws IOException { writeSomethingToCache(); TagUtils.tagCommit("source_tag", commitToMaster(), repo); BranchUtils.createBranch("test_branch", repo.resolve("source_tag"), repo); ReflogEntry lastRefLog = BranchUtils.getLastLog("test_branch", repo); assert lastRefLog != null; assertTrue(lastRefLog.getComment().startsWith("branch: Created from tag")); }