Fix problems parsing revision specs in TFS.

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

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.

Commits

Files