Reference: al-Bukhaaree in at-Taareekh, Ibn Maajah, Ahmad and others. It is a hasan hadeeth as indicated by Shaykh al-Albaanee in Silsilah al-Ahaadeeth as-Saheehah.
On the authority of al-Baraa ibn ‘Aazib (radhi-yAllaahu ‘anhu) who said: While we were with the Messenger of Allaah (sal-Allaahu ‘alayhi wa sallam), he suddenly looked towards a group (of people) and said:
For what reason have they gathered here?
It was said: In order to dig a grave.
So the Messenger of Allaah (sal-Allaahu ‘alayhi wa sallam) became alarmed and startled and he quickly went ahead of his Companions until he reached the grave, then he knelt upon it, and I turned my face towards him (sal-Allaahu ‘alayhi wa sallam), in order to see what he was doing. He (sal-Allaahu ‘alayhi wa sallam) cried until the earth became wet with his tears, then he turned to us and said:
O my brothers! Prepare for a day like this.