As can be gathered from the
expression, it indicates a state of intense anger and annoyance, so much so that the person making the threat is ready, willing and able to inflict physical pain and degradation upon the person who has annoyed them. While it may not literally result in the removal of the offenders head and defecating into the stump, it will usually result in physical violence and a humbling of the person who caused the offence.
The expression that is believed to have
originated with the British Royal Navy. It gradually became used within all branches of the armed forces and later spread to the civilian organisations
associated with them before obtaining wider usage.