use of org.locationtech.geogig.api.RevTagImpl in project GeoGig by boundlessgeo.
the class HashObjectTest method testHashTags.
@Test
public void testHashTags() throws Exception {
RevPerson tagger = new RevPersonImpl("volaya", "volaya@boundlessgeo.com", -1000, -1);
RevPerson tagger2 = new RevPersonImpl("groldan", "groldan@boundlessgeo.com", 10000, 0);
RevTag tag = new RevTagImpl(null, "tag1", ObjectId.forString("fake commit id"), "message", tagger);
RevTag tag2 = new RevTagImpl(null, "tag2", ObjectId.forString("another fake commit id"), "another message", tagger2);
ObjectId tagId = hashCommand.setObject(tag).call();
ObjectId tagId2 = hashCommand.setObject(tag2).call();
assertNotNull(tagId);
assertNotNull(tagId2);
assertNotSame(tagId, tagId2);
}
use of org.locationtech.geogig.api.RevTagImpl in project GeoGig by boundlessgeo.
the class TagCreateOp method _call.
/**
* 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.");
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 = new RevTagImpl(ObjectId.NULL, name, commitId, message, tagger);
ObjectId id = command(HashObject.class).setObject(tag).call();
tag = new RevTagImpl(id, name, commitId, message, tagger);
objectDatabase().put(tag);
Optional<Ref> branchRef = command(UpdateRef.class).setName(tagRefPath).setNewValue(tag.getId()).call();
checkState(branchRef.isPresent());
return tag;
}
use of org.locationtech.geogig.api.RevTagImpl in project GeoGig by boundlessgeo.
the class FormatCommonV1 method readTag.
public static RevTag readTag(ObjectId id, DataInput in) throws IOException {
final ObjectId commitId = readObjectId(in);
final String name = in.readUTF();
final String message = in.readUTF();
final RevPerson tagger = readRevPerson(in);
return new RevTagImpl(id, name, commitId, message, tagger);
}
use of org.locationtech.geogig.api.RevTagImpl in project GeoGig by boundlessgeo.
the class FormatCommonV2 method readTag.
public static RevTag readTag(ObjectId id, DataInput in) throws IOException {
final ObjectId commitId = readObjectId(in);
final String name = in.readUTF();
final String message = in.readUTF();
final RevPerson tagger = readRevPerson(in);
return new RevTagImpl(id, name, commitId, message, tagger);
}
Aggregations