Skip to content

Commit eca5965

Browse files
committed
git: option not to update series on tags
Currently, when a new tag is sent on the mailing list, the series is updated in the Git repository. The push is done with '-o ci.skip', but this seems to be something specific to GitLab. It has no effects with GitHub for example. Not to waste resources on retesting everything and sending notifications once a tag is shared, a new per-project option has been added: update_series_on_tags Not to change the current behaviour, series will continue to be updated on new tags by default, except if this option is explicitly disabled. A new test has been added to validate the new option, when disabled. No need to add a new test for the default case (True) as it is already implicitly tested before. Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 831a92b commit eca5965

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

mods/git.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ class GitModule(PatchewModule):
8787
desc="Publicly visible URL template for applied branch, where %t will be replaced by the applied tag name",
8888
required=True,
8989
),
90+
schema.BooleanSchema(
91+
"update_series_on_tags",
92+
"Update series on new tags",
93+
desc="Whether series are pushed (overriden) when new tags are sent on the mailing list, on by default",
94+
default=True,
95+
),
9096
],
9197
)
9298

@@ -109,7 +115,10 @@ def mark_as_pending_apply(self, series, data={}):
109115
r.save()
110116

111117
def on_tags_update(self, event, series, **params):
112-
if series.is_complete:
118+
config = self.get_project_config(series.project)
119+
update_series_on_tags = config.get("update_series_on_tags", True)
120+
121+
if update_series_on_tags and series.is_complete:
113122
self.mark_as_pending_apply(
114123
series,
115124
{

tests/test_git.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,5 +257,17 @@ def test_git_push_options(self):
257257
out, err = self.do_apply(True)
258258
self.assertIn("ci.skip", out)
259259

260+
def test_no_update_series_on_tags(self):
261+
# No need to test the opposite (default value), implicitly tested before
262+
self.p.config["git"]["update_series_on_tags"] = False
263+
self.p.save()
264+
self.cli_import("0013-foo-patch.mbox.gz")
265+
self.do_apply(True)
266+
267+
# Getting a new reviewed-by shouldn't trigger re-push
268+
self.cli_import("0025-foo-patch-review.mbox.gz")
269+
out, err = self.do_apply(True)
270+
self.assertIn("No series need apply", out)
271+
260272
if __name__ == "__main__":
261273
main()

0 commit comments

Comments
 (0)