This is from the darcs patch for #1342, which failed to apply on my darcs tree, so I'm landing it from git. I'm landing the rename-files part separately from the modify-those-files part to avoid VC complications.