stgit
stgit copied to clipboard
Patch guard support?
Mercurial Queues have an extremely useful feature when trying to maintain a patch queue for e.g. multiple base branches: patch guards.
Basically, each patch can be "tagged" positively or negatively, then qselect
can be used to enable (or disable) guards.
Tags which have a positive guard which is not enabled, or a negative guard which is, will not be applied on push. This is rather useful when maintaning a number of patches against multiple branches but some of those patches only apply to a subset e.g. they patch features which have since been removed, or patch features recently added.
Is there anything similar in StGit currently, or being planned? Or a way to handle the general use case of "multiple patch queues which are largely identical but have some minor divergences"?
Complement I wasn't aware of when I created this issue: the quilt
distribution provides a guards(1)
utility which processes "guarded" files, though I don't quite understand its format it seems different than mq's, and it's unclear whether that's intended as a "static" preprocessor or can be integrated to quilt the way mq does.
With the latest change to format StGit's stack metadata in JSON instead of the prior custom format (7641796), it becomes a bit more straightforward to capture patch guards in the stack metadata.
For example:
{
"version": 5,
"prev": "113d9bb567523ae0fd4355534d4131da2b262c9f",
"head": "5369f4cdf8cd0e516becab39ec559e36fbd8e73a",
"applied": [
"p0"
],
"unapplied": [
"p1"
],
"hidden": [],
"patches": {
"p0": {
"oid": "a2f7228037db176a0465d963699415b761857407"
},
"p1": {
"oid": "fa0ccc54091a6405a20bcc803209b689e82a3959"
}
}
}
In this new format, each patch has a dict which can be used to associate arbitrary metadata with each patch. Currently we only associate the object id of the patch's commit, but we could easily extend to having a "guards" list for each patch.
At some point in the future I intend to look at implementing patch guards.