[PATCH 2/4] b&m: checkout and branch use context manager