Add support for patchset dependencies.
The following is a summary of my changes:
* A new endpoint "get_depends_on_patchset" has been added. This endpoint will be called by apply_issue to form a chain of dependencies to apply to the local checkout. The apply_issue change is here: https://codereview.chromium.org/1149653002/
* I extracted majority of the new logic into a new module (dependency_utils) and added comprehensive unit tests.
* This CL adds two new fields to the PatchSet model. These fields define the dependency and the dependents of the patchset.
* The dependency and dependents of a patchset are displayed to the user but only in the new UI. I figure we are close enough to making the new UI the default that I can stop doing double UI work.
* I tried to cover all interactions among dependent patchsets, here is a example of dependencies and how different Rietveld actions will impact those dependencies-
CL1#PS2 -> CL2#PS1 -> CL3.1#PS1
Explanation of the above: CL3#PS2 & CL3.1#PS1 & CL3.1#PS2 all depend on CL2#PS1 which depends on CL1#PS2.
==Rietveld action: issue is closed and reopened==
- If CL2 is closed then CL2#PS1 shows up with a strikethrough in CL3#PS2 & CL3.1#PS1 & CL3.1#PS2.
- If CL2 is reopened then CL2#PS1 shows up normally (without a strikethrough) in CL3#PS2 & CL3.1#PS1 & CL3.1#PS2.
==Rietveld action: issue is deleted==
- If CL2 is deleted then CL3#PS2 & CL3.1#PS1 & CL3.1#PS2 are updated to remove their dependency on CL2#PS1.
Additionally, if any patchset of CL2 is a dependent then its dependency is removed. i.e. CL1#PS2 will be updated to remove CL2#PS1 as a dependent.
==Rietveld action: patchset is deleted==
- If CL2#PS1 is deleted then CL3#PS2 & CL3.1#PS1 & CL3.1#PS2 are updated to remove their dependency on CL2#PS1.
Additionally, if CL2#PS1 is a dependent then its dependency is removed. i.e. CL1#PS2 will be updated to remove CL2#PS1 as a dependent.
Tested end-to-end using a test Git repository (https://skia.googlesource.com/skiabot-test/
) and the following CLs created in my test Rietveld instance:
Opt into the new UI and observe the new 'Depends on Patchset' and 'Dependent Patchsets' sections in the above CLs.
Design doc is here: https://docs.google.com/document/d/1KZGFKZpOPvco81sYVRCzwlnjGctup71RAzY0MSb0ntc/edit#heading=h.6r6lt4tsvssw