Infrared diode laser spectra of MgH and MgD (X 2Σ