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

    fix: Calling `vc-jj-expanded-log-entry' on a divergent revision
    
    A divergent revision is one whose change ID is non-unique: there are
    multiple revisions with that change ID. Previously,
    `vc-jj-expanded-log-entry' would error in such cases.
    
    Instead, show the details for all the divergent commits.
---
 vc-jj.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/vc-jj.el b/vc-jj.el
index 59c3d30725..1916b81bf4 100644
--- a/vc-jj.el
+++ b/vc-jj.el
@@ -594,14 +594,18 @@ If REV is not specified, revert the file as with 
`vc-jj-revert'."
 
 
 (defun vc-jj-expanded-log-entry (revision)
+  "Return a string of the commit details of REVISION.
+Called by `log-view-toggle-entry-display' in a JJ Log View buffer."
   (with-temp-buffer
-    (vc-jj--command-dispatched t 0 nil
-      "log"
-      "-r" revision
-      "-T" "builtin_log_detailed"
-      "--color" "never"
-      "--no-graph"
-      "--")
+    (vc-jj--command-dispatched
+     t 0 nil "log"
+     ;; REVISION may be divergent (i.e., several revisions with the
+     ;; same change ID).  In those cases, we opt to avoid jj erroring
+     ;; via "-r change_id(REVISION)" and show only all the divergent
+     ;; commits.  This is preferable to confusing or misinforming the
+     ;; user by showing only some of the divergent commits.
+     "-r" (format "change_id(%s)" revision)
+     "--no-graph" "-T" "builtin_log_detailed")
     (buffer-string)))
 
 (defun vc-jj-previous-revision (file rev)

Reply via email to