diffcore-rename: split out the delta counting code.