branch: externals/vc-jj
commit 88e37de56007d994e259a34d6d6b2e2d92e908e5
Author: Kristoffer Balintona <[email protected]>
Commit: Kristoffer Balintona <[email protected]>

    Add confirmation prompt to `vc-jj-log-view-abandon-change`
    
    Also add docstrings and MODES to the `interactive` form of the
    command.  Do the same to `vc-jj-log-view-edit-change` as well as
    `vc-jj-log-view-new-change`.
---
 NEWS.org |  2 ++
 vc-jj.el | 25 ++++++++++++++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index cdce014e73..8b0aa60cb9 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -21,6 +21,8 @@
 
 *** Changed
 
+- Only abandon revision with ~vc-jj-log-view-abandon-change~ once the user 
confirms their decision.
+
 *** Removed
 
 *** Fixed
diff --git a/vc-jj.el b/vc-jj.el
index f730c3a152..e7e78f1458 100644
--- a/vc-jj.el
+++ b/vc-jj.el
@@ -777,21 +777,32 @@ Called by `log-view-toggle-entry-display' in a JJ Log 
View buffer."
   (revert-buffer))
 
 (defun vc-jj-log-view-edit-change ()
-  (interactive)
+  "Edit the jj revision at point.
+Call \"jj edit\" on the revision at point."
+  (interactive nil vc-jj-log-view-mode)
   (let ((rev (log-view-current-tag)))
     (vc-jj-retrieve-tag nil rev nil)
     (vc-jj--reload-log-buffers)))
 
 (defun vc-jj-log-view-abandon-change ()
-  (interactive)
-  ;; TODO: should probably ask for confirmation, although this would be
-  ;; different from the cli
+  "Abandon the jj revision at point.
+Call \"jj abandon\" on the revision at point."
+  (interactive nil vc-jj-log-view-mode)
   (let ((rev (log-view-current-tag)))
-    (vc-jj--command-dispatched nil 0 nil "abandon" rev "--quiet")
-    (vc-jj--reload-log-buffers)))
+    (when (y-or-n-p (format "Abandon revision %s?"
+                            (propertize
+                             (vc-jj--command-parseable "show" "--no-patch"
+                                                       "-r" rev
+                                                       "-T" 
"change_id.shortest()")
+                             'face 'log-view-message)))
+      (vc-jj--command-dispatched nil 0 nil "abandon" rev "--quiet")
+      (vc-jj--reload-log-buffers))))
 
 (defun vc-jj-log-view-new-change ()
-  (interactive)
+  "Create a new, empty change on the revision at point.
+Call \"jj new\", creating a new revision whose parent is the revision at
+point."
+  (interactive nil vc-jj-log-view-mode)
   (let ((rev (log-view-current-tag)))
     (vc-jj--command-dispatched nil 0 nil "new" rev "--quiet")
     (vc-jj--reload-log-buffers)))

Reply via email to