[PATCH v2 53/60] buildman: Move checkout code to a separate function