All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
If someone entrusts a secret to someone else, the latter is forbidden from divulging this secret, as has been clarified by the scholars, but if you disclosed his secret unintentionally, then you are not sinful, as Allah says (what means): {Our Lord, do not impose blame upon us if we have forgotten or erred.} [Quran 2:286]
It is confirmed in Saheeh Muslim that Allah said in a Qudsi hadeeth, “I have indeed done so.”
Moreover, Ibn ‘Abbaas narrated that the Prophet said, “Allah has forgiven my nation the things they forget, do by mistake, or are forced to do.” [Ibn Maajah]
If someone did not commit a sin, it is not required of him to repent.
Since your friend does not know that you have divulged his secret, then do not inform him about it. If he later comes to know about it, then tell him what really happened and that you did not do it intentionally. This is with regard to your first question.
As regards your second question, it seems – and Allah knows best – that that person had the right to tease you in the same manner that you had teased him, according to Islamic conditions, pursuant to the saying of Allah (which means): {And if you punish [an enemy, O believers] punish with an equivalent of that with which you were harmed. But if you are patient - it is better for those who are patient.} [Quran 16:126]
However, he has no right to punish you physically. As regards whether the punishment was equivalent to your teasing of him, then we do not know about it but we hope that you are acquitted from sin by this punishment.
Allah knows best.