Convert PerforceClient.run_worker to be a context manager.
Review Request #8943 — Created May 16, 2017 and submitted — Latest diff uploaded
run_worker()
, which establishes a Perforce session, used to take a
function as a parameter to run, which meant that callers had to define
an extra function or provide a lambda. Now it works as a context
manager, reducing the work needed by the callers.As part of this,
run_worker()
now handles converting exceptions by
itself, without needing the old_convert_p4exception_to_scmexception()
utility method, simplifying code a bit more.This also fleshes out the documentation for the affected functions.
Unit tests passed.
Tested Perforce functionality manually. Everything works as it did
before.