MDL-29954 repository: remove dead code

Also remove repository_attach_id() which was never used and not useful.