Make convert_to_unicode handle bytearray.

Some SCM backends (notably Perforce), when dealing with files which are marked
as binary but aren't actually binary, will return a bytearray instead of bytes.
This wasn't properly handled in our unicode conversion step. I've fixed it to
check if the input is a bytearray, and convert it to bytes if needed.

Testing done:
Manually called convert_to_unicode with a bytearray and saw that it no longer
raised an error.

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