If memory serves me well I remember reading that the song was sung by British troops leaving for the Boer War, which fits with John's publishing date.
It used to be sung regularly on that Splendid Show Specifically Singled out for Serendipitous Selections of Songs The Good Old Days on BBC TV.
AndyG