Pretty sure its Yojimbo, mostly becuase Fistful of Dollars had the same gimmick with a rifle vs a revolver. And I know it was Leone's remake of Yojimbo
I remember in Golden Kamuy (set in the beginning of 1900s) there were several old samurai, at least one of which was proficient at using firearms, too. Though, sadly, they didn't have any Coca Cola there.
Looks like coke wasn't widely sold outside the US until around the time samurai were abolished. Unlikely that any of them drank it, but not impossible. I'd love to read some short stories that have those kinds of seeming anachronisms.