I too have heard the origin of this song related to the Duke of York in Flanders in the 'French Revolutionary Wars'.
IIRC the campaign was around the 1796 mark and was satirised in cartoons by Gilray et al as "The Wet Party" - it was basically a lesson in how not to campaign.
Walrus