ClearCase updates part 2: typing and consolidation.

Review Request #13606 — Created March 4, 2024 and submitted — Latest diff uploaded

Information

RBTools
release-5.x

Reviewers

This change is a somewhat more invasive refactor of the ClearCase
backend in RBTools.

To start with, we had several different definitions of what a
"changeset" was throughout the code. Some places used it to mean a list
of 2-tuples containing extended path pairs. Some places used it to mean
a list of 3-tuples containing a path and two versions. And finally, our
diff implementation used it to mean a list of ChangesetEntry objects.

I've reworked this to define a "changelist" as the list of extended path
pairs (aliased as _ChangedEntry), which is what gets returned by all
of the different methods for the various types of revision specs. This
then gets processed and turned into a "changeset" which is the list of
_ChangesetEntry objects. A couple of the revision types use one
additional type, _BranchedChangedEntry, which is the 3-tuple form.

We also had a number of methods that were unnecessarily implemented as
their own functions. These have for the most part been folded back into
the one place they got called from.

Most of the code that deals with changelists has been updated to yield
items rather than build new lists. In some cases we were rebuilding
lists up to 7 times.

This change also adds type hints to the rest of the implementation.

Ran unit tests.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

orig
1
2
3

Commits

First Last Summary ID Author
ClearCase updates part 2: typing and consolidation.
This change is a somewhat more invasive refactor of the ClearCase backend in RBTools. To start with, we had several different definitions of what a "changeset" was throughout the code. Some places used it to mean a list of 2-tuples containing extended path pairs. Some places used it to mean a list of 3-tuples containing a path and two versions. And finally, our diff implementation used it to mean a list of `ChangesetEntry` objects. I've reworked this to define a "changelist" as the list of extended path pairs (aliased as `_ChangedEntry`), which is what gets returned by all of the different methods for the various types of revision specs. This then gets processed and turned into a "changeset" which is the list of `_ChangesetEntry` objects. A couple of the revision types use one additional type, `_BranchedChangedEntry`, which is the 3-tuple form. We also had a number of methods that were unnecessarily implemented as their own functions. These have for the most part been folded back into the one place they got called from. Most of the code that deals with changelists has been updated to yield items rather than build new lists. In some cases we were rebuilding lists up to 7 times. This change also adds type hints to the rest of the implementation. Testing Done: - Ran unit tests.
bffbfe8e57ab3ef2c7d6e0c00cf7d7b2377951a3 David Trowbridge
rbtools/clients/clearcase.py
rbtools/clients/tests/test_clearcase.py
Loading...