• 
      

    Fix problems parsing revision specs in TFS.

    Review Request #12563 — Created Aug. 23, 2022 and submitted

    Information

    RBTools
    release-4.x

    Reviewers

    Each TFS wrapper class implemented their own version of
    parse_revision_spec(), and due to lack of tests, we had some
    regressions in the move to Python 3, plus one wrapper that just never
    returned correct results.

    TFExeWrapper.parse_revision_spec() always returned None results, or
    crashed. This was due to _convert_symbolic_revision() missing a
    return statement, causing a None to always be returned. When fixed,
    this was still returning a mix of integers and strings, where strings
    are the expected type.

    TEEWrapper.parse_revision_spec() worked, but produced a mix of
    integers and strings.

    TFHelperWrapper.parse_revision_spec() produced byte strings, which
    weren't compatible with other calls on Python 3. It could also produce
    error messages that were empty.

    There was also some dead code in these.

    These methods have all been updated to work correctly in all conditions.
    Result types are all Unicode strings. Dead code has been removed. Errors
    given defaults. Assertions added for type safety.

    Unit tests have been added to test each of these based on simulated data.

    Unit tests pass on Python 3.7-3.11.

    Summary ID
    Fix problems parsing revision specs in TFS.
    Each TFS wrapper class implemented their own version of `parse_revision_spec()`, and due to lack of tests, we had some regressions in the move to Python 3, plus one wrapper that just never returned correct results. `TFExeWrapper.parse_revision_spec()` always returned `None` results, or crashed. This was due to `_convert_symbolic_revision()` missing a `return` statement, causing a `None` to always be returned. When fixed, this was still returning a mix of integers and strings, where strings are the expected type. `TEEWrapper.parse_revision_spec()` worked, but produced a mix of integers and strings. `TFHelperWrapper.parse_revision_spec()` produced byte strings, which weren't compatible with other calls on Python 3. It could also produce error messages that were empty. There was also some dead code in these. These methods have all been updated to work correctly in all conditions. Result types are all Unicode strings. Dead code has been removed. Errors given defaults. Assertions added for type safety. Unit tests have been added to test each of these based on simulated data.
    00b5a34adea008f4e23b480c747d73b2b8f651c7
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.x (30bd823)