Fix Python 3.x compatibility issues with demarshalling Perforce data.

Review Request #10666 — Created Aug. 21, 2019 and submitted

Information

RBTools
release-1.0.x
f50f73c...

Reviewers

When we call out to p4, we often request data in a marshalled form.
These come back as byte strings, and on Python 3.x, this prevents us
from properly looking up all sorts of data from them (error results,
change status, etc.). We had a single place that attempted to handle
this, which was the fetching of a change description, but nowhere else.

We now normalize the string types before we hand it back to the caller,
ensuring that all keys and string values are Unicode. This is based in
part on Perforce's own documentation on demarshalling on Python 3.x
(though fixes an issue they have involving int values, found in error
payloads).

Ran a handful of tests locally, including rbt diff and rbt post
commands, testing againt Perforce change numbers and with change
descriptions utilizing various Unicode characters (including Emoji).

While these failed before (with rbt post claiming the path was
invalid and rbt diff just raising a KeyError), both now work
as expected.

Description From Last Updated

typo: Perfore -> Perforce. This sentence also reads a little clunky.

daviddavid
david
  1. 
      
  2. rbtools/clients/perforce.py (Diff revision 1)
     
     
    Show all issues

    typo: Perfore -> Perforce. This sentence also reads a little clunky.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-1.0.x (d9f9f2d)