Fix up a variety of unicode/bytes issues with SVN.

Review Request #9627 - Created Feb. 12, 2018 and submitted

David Trowbridge
RBTools
master
4547
4f91bf4...
rbtools

The SVN client was handling a variety of things using the wrong string
types, most notably filenames. In Python 3, filenames are expected to be
treated as str internally, and then serialized/deserialized using the
filesystem encoding (theoretically this is also the case in Python 2,
but the implicit casting makes it easy to be sloppy). This change fixes
those up so that we're at least sucessfully running the tests.

This also incidentally fixes bug 4547, which involves using
Popen.communicate() instead of Popen.wait().

Ran unit tests on Python 2.7 and 3.6.

  • 0
  • 0
  • 5
  • 0
  • 5
Description From Last Updated
Christian Hammond
  1. 
      
  2. rbtools/clients/svn.py (Diff revision 1)
     
     

    I'm confused about this, and feel like it's something I'm likely going to hit. What's the reason for the explicit ending index?

    1. Pulling a single index out of bytes returns an int, not a bytes.

  3. rbtools/clients/svn.py (Diff revision 1)
     
     

    Maybe worth doing this at the module level, sicne we need it a few times?

  4. rbtools/clients/svn.py (Diff revision 1)
     
     
     

    Feels like this might be more readable as:

    return (diff_line.split(b'\n')[0].decode(fs_encoding),
            b'\n')
    
  5. rbtools/utils/process.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     

    Oh man thank you.

  6. rbtools/utils/process.py (Diff revision 1)
     
     
     

    For Python, object is probably fine, but if we don't have an explicit type in a Returns, we can leave off the type. That will leave off the type portion of the docs in the field, showing only the description.

  7. rbtools/utils/process.py (Diff revision 1)
     
     

    Can be six.PY3.

  8. 
      
David Trowbridge
Review request changed

Commit:

-415850f7b386c1b3ca1b8b47a42c0351d20be2c2
+dbddf3a8856e08cc718a1e233b201559d47da9a0

Diff:

Revision 2 (+229 -206)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

David Trowbridge
Christian Hammond
  1. Ship It!
  2. 
      
David Trowbridge
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (f158f41)
Loading...