Skip to content

Patch guard support? #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xmo-odoo opened this issue Sep 8, 2020 · 2 comments
Open

Patch guard support? #70

xmo-odoo opened this issue Sep 8, 2020 · 2 comments

Comments

@xmo-odoo
Copy link

xmo-odoo commented Sep 8, 2020

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"?

@xmo-odoo
Copy link
Author

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.

@jpgrayson
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants