@Override public void callback(Supplier<RevObject> supplier) { RevObject object = supplier.get(); progress.setProgress(progress.getProgress() + 1); if (object instanceof RevCommit) { RevCommit commit = (RevCommit) object; want.remove(commit.getId()); have.removeAll(commit.getParentIds()); have.add(commit.getId()); } else if (object instanceof RevTag) { RevTag tag = (RevTag) object; want.remove(tag.getId()); have.remove(tag.getCommitId()); have.add(tag.getId()); } } };
public static String toString(@NonNull RevTag t) { return String.format("%s(%s)[commit:%s, message:%s, tagger:%s]", t.getClass().getSimpleName(), // toShortString(t.getId()), // toShortString(t.getCommitId()), // t.getMessage(), // toShortString(t.getTagger())); }
w.write(tag.getName()); w.write(" "); w.write(tag.getId().toString()); w.write("\n");
/** * Executes the tag creation operation. * * @return the created tag * */ @Override protected RevTag _call() throws RuntimeException { checkState(name != null, "tag name was not provided"); final String tagRefPath = Ref.TAGS_PREFIX + name; checkArgument(!command(RefParse.class).setName(tagRefPath).call().isPresent(), "A tag named '" + name + "' already exists."); command(CheckRefFormat.class).setThrowsException(true).setRef(tagRefPath).call(); if (commitId == null) { final Optional<Ref> currHead = command(RefParse.class).setName(Ref.HEAD).call(); Preconditions.checkState(currHead.isPresent(), "Repository has no HEAD, can't create tag"); commitId = currHead.get().getObjectId(); } RevPerson tagger = resolveTagger(); message = message == null ? "" : message; RevTag tag = RevTagBuilder.build(name, commitId, message, tagger); objectDatabase().put(tag); Optional<Ref> branchRef = command(UpdateRef.class).setName(tagRefPath) .setNewValue(tag.getId()).call(); checkState(branchRef.isPresent()); return tag; }
/** * Executes the tag creation operation. * * @return the created tag * */ @Override protected RevTag _call() throws RuntimeException { checkState(name != null, "tag name was not provided"); final String tagRefPath = Ref.TAGS_PREFIX + name; checkArgument(!command(RefParse.class).setName(tagRefPath).call().isPresent(), "A tag named '" + name + "' already exists."); command(CheckRefFormat.class).setThrowsException(true).setRef(tagRefPath).call(); if (commitId == null) { final Optional<Ref> currHead = command(RefParse.class).setName(Ref.HEAD).call(); Preconditions.checkState(currHead.isPresent(), "Repository has no HEAD, can't create tag"); commitId = currHead.get().getObjectId(); } RevPerson tagger = resolveTagger(); message = message == null ? "" : message; final RevTag tag = RevTag.builder().name(name).commitId(commitId).message(message) .tagger(tagger).build(); objectDatabase().put(tag); Optional<Ref> branchRef = command(UpdateRef.class).setName(tagRefPath) .setNewValue(tag.getId()).call(); checkState(branchRef.isPresent()); return tag; }
&& tags.containsKey(rf.localName())) { RevTag tag = tags.get(rf.localName()); remoteLocalRefs.add(new Ref(Ref.TAGS_PREFIX + tag.getName(), tag.getId()));
&& tags.containsKey(rf.localName())) { RevTag tag = tags.get(rf.localName()); remoteLocalRefs.add(new Ref(Ref.TAGS_PREFIX + tag.getName(), tag.getId()));
private void testTag(RevTag tag) throws IOException { byte[] buff = write(tag); RevTag read; read = (RevTag) read(tag.getId(), buff); assertTag(tag, read); read = (RevTag) read(null, buff); assertTag(tag, read); }
private void writeTagImpl(RevTag revTag, String tag) throws StreamWriterException { writeElement("id", revTag.getId().toString()); writeElement("commitid", revTag.getCommitId().toString()); writeElement("name", revTag.getName()); writeElement("message", revTag.getMessage()); writePerson("tagger", revTag.getTagger()); }
private void assertTag(RevTag tag, RevTag read) { assertEquals(tag, read); assertEquals(tag.getId(), read.getId()); assertEquals(tag.getName(), read.getName()); assertEquals(tag.getMessage(), read.getMessage()); assertEquals(tag.getCommitId(), read.getCommitId()); assertEquals(tag.getTagger(), read.getTagger()); }
public RevTag testCreateTag(ObjectId id, String name, ObjectId commitId, String message, RevPerson tagger) { RevTag actual = factory.createTag(id, name, commitId, message, tagger); assertNotNull(actual); RevTag expected = DEFAULT.createTag(id, name, commitId, message, tagger); assertNotNull(expected); assertEquals(expected.getId(), actual.getId()); assertEquals(expected.getCommitId(), actual.getCommitId()); assertEquals(expected.getName(), actual.getName()); assertEquals(expected.getMessage(), actual.getMessage()); assertEquals(expected.getTagger(), actual.getTagger()); assertEquals(expected, actual); return actual; }