Add public API for SquashedDiff and DiffHistory.
Review Request #12676 — Created Oct. 7, 2022 and updated
rbtools.commands.posthad two classes for managing diff results:
SquashedDiffrepresents a single diff result for any range of commits,
without any commit history information.
DiffHistoryrepresents commits across multiple commits, with a
cumulative diff spanning all changes.
These have been internal to the
rbt postcommand, defined as
namedtuples(despite not used tuple functionality for these). With
some work planned for cleaning up the posting logic, it was time to
clean up these classes and move them out of this command.
Both of these now live in
rbtools.clients.base.diffs. They contain
standard utility methods for building an instance from a diff result
from a SCMClient, and inherit from a base class that holds common
One API change here is that
DiffHistory.diff. This was done to simplify code that may
take either object and needs to extract the diff, and to let us leverage
as many common fields as possible.
These are still just used in
rbt post, but RBTools 5 will begin to
make use of these in other modules.
Unit tests pass.
Successfully posted using both commit histories and squashed diffs.
- Removed an unused import.
- Added missing
Optionalimports (didn't affect runtime, just type checking).
Revision 2 (+1122 -520)