The person he was fighting with was a prospective client or to be precise a Messenger of the prospective client, Watson later asks about him after he returns from the grocery store as to what happened with that case about the Jaria Diamond, to which Sherlock acquiesces he isn't interested in taking that and send them a message (which flashbacks to the scene where he knocks that swordsman down).
I am not sure which story it refers too, I am digging through my books will update it if i find the answer