From 19fd812c7a991409620c38a4d84f4ed883e96fd5 Mon Sep 17 00:00:00 2001
From: "James E. Blair" <jim@acmegating.com>
Date: Wed, 7 Feb 2024 10:57:23 -0800
Subject: [PATCH] Document gerrit comment deletion procedure

Change-Id: Iedc9446ea12415c8f9ba49b7f8390442045762fa
---
 doc/source/gerrit.rst | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/doc/source/gerrit.rst b/doc/source/gerrit.rst
index 0eeb1534fe..167b75f4fd 100644
--- a/doc/source/gerrit.rst
+++ b/doc/source/gerrit.rst
@@ -575,6 +575,35 @@ must follow that steps:
 
    A 200 return code means the account is active, and 204 means account inactive.
 
+Deleting Messages or Comments
+-----------------------------
+
+Review messages or comments can not be completely deleted, but they
+can have their content completely replaced with text indicating that
+they have been deleted.  The process is described below, and the
+actual deletion command requires a reason.  You may want to use
+something like "removed by user request" or other similar text to
+indicate why the comment was deleted.
+
+To manually delete a review comment or message:
+
+#. Get an HTTP password for your Gerrit admin account:
+
+   .. code-block:: shell-session
+
+      $ ssh -p 29418 username.admin@review.opendev.org gerrit set-account --generate-http-password username.admin
+
+#. Use that along with the :git_file:`tools/gerrit-delete-comment.py`
+   script to delete the desired message or comment.  Use the script to
+   list the messages or comments in order to obtain their internal
+   IDs, then run it again to delete the specified message or comment.
+
+#. To reduce the attack surface, clear your HTTP password:
+
+   .. code-block:: shell-session
+
+      $ ssh -p 29418 username.admin@review.opendev.org gerrit set-account --clear-http-password username.admin
+
 Generating a Thread Dump for Debugging
 --------------------------------------