Rad54 functions as a heteroduplex DNA pump modulated by its DNA substrates and Rad51 during D loop formation.