Fix supplying Unicode content to p4 change when modifying a commit description.
Fix supplying Unicode content to p4 change when modifying a commit description.

When posting a change on Perforce using `--stamp` or explicitly stamping
with `rbt stamp`, the Perforce backend would invoke `p4 change -i` with
a new change description. While the code for this worked reasonably well
on Python 2, due to its rough compatibility between bytes and Unicode
string types, it didn't work on Python 3. This wasn't the default
operation, so not all users encountered this, but ones that did on
Python 3 would see a crash.

The content being sent to `p4 change -i` needed to be a byte string, so
we now ensure that's the case, encoding it if necessary and erroring out
if we're given an unexpected type.

This change is based on a patch by Keith Kelly, with a description
update by Christian Hammond.

Testing Done:
Manually verified by Keith Kelly on Windows, Linux, and macOS that this
resolves the error they were hitting when using Python 3. Manually
verified that this also still works fine for the same scenario when
using Python 2.

Reviewed at https://reviews.reviewboard.org/r/11061/

reviewboard/rbtools,reviewboard/rbtools,reviewboard/rbtools