patches.py: Add "next" handling to update-patch/remove-patch
Augment scap update-patch and scap remove-patch so that they have
special handling for "next" patches while retaining their old behavior
for weekly train branches.
If the target patch is in /srv/patches/next, then
update_next_patches() as the start of a scap update-patch or
scap remove-patch operation.
update-patch:
Installs the patch as an .updated patch if it differs from the
corresponding patch that would be inherited from this week's train.
If the installed patch is the same as the would-be-inherited patch,
then use the regular filename (which means that inheritance is
retained).
remove-patch:
If the target patch is in /srv/patches/next, replace the patch with
a .dropped patch.
Other stuff:
- Added
_gitcmd()to factor out a common pattern.
Bug: T295925