John Riley did indeed lead Irish deserters for Mexico in the war. The Irish were ill-used by Nativist officers who didn't like 'croppies.' Protestant America was feeling threatened by the huge influx of Catholic Irish flooding into the US from famine-struck Ireland. Few troops have been given more reason to desert. However, the movie tells it all wrong. Riley wasn't a sergeant and didn't plan to return after getting his men to safety. He was a private who swam the Rio Grande a month before the war was declared. He responded to 'desertion leaflets' that the Mexicans had sneaked into American Camps. No US army ever had higher desertion rates.
The treatment of Winfield Scott is rather harsh. Riley was actually sentenced to hang with virtually all of his men but it was Scott who commuted his sentence (the still harsh 50 lashes and branding), along with that of more than a score of his men. This infuriated Scott's Nativist officers.
Riley remained in the Mexican Army after the war for a year or so and almost certainly returned to Ireland thereafter. Also, he was a young fellow, about thirty, which made it hard to accept Tom in the role. Another thing that was irritating is that there is a list of the men who served under Riley and it is amazing that the screenwriter decided to create fictional replacements instead. Why? Also, one must not forget that most Irish, despite poor treatment by prejudiced officers, did not desert. Who was more heroic, those who deserted or those who didn't?
All in all, a disappointment. However, it is one of the very few films that deals with the Mexican American War, and for that I commend it.