summary refs log tree commit diff
path: root/maintainers/scripts
diff options
context:
space:
mode:
authorMatthieu Coudron <teto@users.noreply.github.com>2021-04-22 03:21:36 +0200
committerGitHub <noreply@github.com>2021-04-22 03:21:36 +0200
commit3eb8f4d15c6b3fbb0170045df40b43cfd07d5d10 (patch)
tree7ae411179748726a057bf13298565260b98438ac /maintainers/scripts
parent1d0542c07bcb25b763c8d4e6c26fc7658d1884ff (diff)
downloadnixpkgs-3eb8f4d15c6b3fbb0170045df40b43cfd07d5d10.tar
nixpkgs-3eb8f4d15c6b3fbb0170045df40b43cfd07d5d10.tar.gz
nixpkgs-3eb8f4d15c6b3fbb0170045df40b43cfd07d5d10.tar.bz2
nixpkgs-3eb8f4d15c6b3fbb0170045df40b43cfd07d5d10.tar.lz
nixpkgs-3eb8f4d15c6b3fbb0170045df40b43cfd07d5d10.tar.xz
nixpkgs-3eb8f4d15c6b3fbb0170045df40b43cfd07d5d10.tar.zst
nixpkgs-3eb8f4d15c6b3fbb0170045df40b43cfd07d5d10.zip
update.py: allow to disable autocommit (#119182)
Diffstat (limited to 'maintainers/scripts')
-rw-r--r--maintainers/scripts/pluginupdate.py36
1 files changed, 23 insertions, 13 deletions
diff --git a/maintainers/scripts/pluginupdate.py b/maintainers/scripts/pluginupdate.py
index 00a205313be..e7a183952b0 100644
--- a/maintainers/scripts/pluginupdate.py
+++ b/maintainers/scripts/pluginupdate.py
@@ -460,6 +460,10 @@ def parse_args(editor: Editor):
         default=30,
         help="Number of concurrent processes to spawn.",
     )
+    parser.add_argument(
+        "--no-commit", "-n", action="store_true", default=False,
+        help="Whether to autocommit changes"
+    )
     return parser.parse_args()
 
 
@@ -504,24 +508,30 @@ def update_plugins(editor: Editor):
 
     redirects = update()
     rewrite_input(args.input_file, editor.deprecated, redirects)
-    commit(nixpkgs_repo, f"{editor.name}Plugins: update", [args.outfile])
+
+    autocommit = not args.no_commit
+
+    if autocommit:
+        commit(nixpkgs_repo, f"{editor.name}Plugins: update", [args.outfile])
 
     if redirects:
         update()
-        commit(
-            nixpkgs_repo,
-            f"{editor.name}Plugins: resolve github repository redirects",
-            [args.outfile, args.input_file, editor.deprecated],
-        )
+        if autocommit:
+            commit(
+                nixpkgs_repo,
+                f"{editor.name}Plugins: resolve github repository redirects",
+                [args.outfile, args.input_file, editor.deprecated],
+            )
 
     for plugin_line in args.add_plugins:
         rewrite_input(args.input_file, editor.deprecated, append=(plugin_line + "\n",))
         update()
         plugin = fetch_plugin_from_pluginline(plugin_line)
-        commit(
-            nixpkgs_repo,
-            "{editor}Plugins.{name}: init at {version}".format(
-                editor=editor.name, name=plugin.normalized_name, version=plugin.version
-            ),
-            [args.outfile, args.input_file],
-        )
+        if autocommit:
+            commit(
+                nixpkgs_repo,
+                "{editor}Plugins.{name}: init at {version}".format(
+                    editor=editor.name, name=plugin.normalized_name, version=plugin.version
+                ),
+                [args.outfile, args.input_file],
+            )