hgext/clonebundles.py
changeset 50471 10318b88b1d6
parent 50469 23db5f15cc0c
child 50472 3973b1dc3ee3
--- a/hgext/clonebundles.py	Tue Mar 14 04:46:53 2023 +0100
+++ b/hgext/clonebundles.py	Tue Mar 14 05:09:16 2023 +0100
@@ -977,3 +977,20 @@
         update_bundle_list(repo, new_bundles=[result])
         update_ondisk_manifest(repo)
         cleanup_tmp_bundle(repo, generating_bundle)
+
+
+@command(b'admin::clone-bundles-clear', [], b'')
+def cmd_admin_clone_bundles_clear(ui, repo: localrepo.localrepository):
+    """remove existing clone bundle caches
+
+    See `hg help admin::clone-bundles-refresh` for details on how to regenerate
+    them.
+
+    This command will only affect bundles currently available, it will not
+    affect bundles being asynchronously generated.
+    """
+    bundles = read_auto_gen(repo)
+    delete = [b for b in bundles if b.ready]
+    for o in delete:
+        delete_bundle(repo, o)
+    update_bundle_list(repo, del_bundles=delete)