/**
* Store a tag.
* If author, message or type is set make the tag an annotated tag.
*
* @
*/
public void Save() //renamed from Tag
{
if (TagId != null)
{
throw new InvalidOperationException("exists " + TagId);
}
ObjectId id;
if (author != null || message != null || tagType != null)
{
ObjectId tagid = new ObjectWriter(Repository).WriteTag(this);
TagId = tagid;
id = tagid;
}
else
{
id = Id;
}
RefUpdate ru = Repository.UpdateRef(Constants.RefsTags + TagName);
ru.NewObjectId = id;
ru.SetRefLogMessage("tagged " + TagName, false);
if (ru.ForceUpdate() == RefUpdate.RefUpdateResult.LockFailure)
{
throw new ObjectWritingException("Unable to lock tag " + TagName);
}
}