#212731 by boombatower: added repository id to source revisions and latest commits tables, and implemented _repository hook to delete data from the tables.