In vivo analysis of the molecular mechanisms of long- and short-range transcriptional repression