Add revert_to_published method.

STUD-1860

OK, @dmitchell has patiently helped me through writing this method. Please review, @dmitchell and @nasthagiri.
It feels odd to be using these primitive methods to get the published and draft items, when higher-level APIs exist. @dmitchell is this really the way to go?