emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vc-jj 413ecc82c5 52/58: add vc-jj-pull


From: ELPA Syncer
Subject: [elpa] externals/vc-jj 413ecc82c5 52/58: add vc-jj-pull
Date: Sat, 15 Mar 2025 07:01:58 -0400 (EDT)

branch: externals/vc-jj
commit 413ecc82c55ea0fd6ca009428f8923e6d15ce8a1
Author: Rudi Schlatte <rudi@constantly.at>
Commit: Rudi Schlatte <rudi@constantly.at>

    add vc-jj-pull
---
 vc-jj.el | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/vc-jj.el b/vc-jj.el
index 2968aa45fc..f9b0a2c372 100644
--- a/vc-jj.el
+++ b/vc-jj.el
@@ -433,6 +433,39 @@ four groups: change id, author, datetime, line number.")
           `(metadata . ((display-sort-function . ,#'identity)))
         (complete-with-action action revisions string pred)))))
 
+(defvar vc-jj-pull-history (list "jj git fetch")
+  "History variable for `vc-jj-pull'.")
+
+(defun vc-jj-pull (prompt)
+  "Pull changes from an upstream repository.
+Normally, this runs \"jj git fetch\".  If PROMPT is non-nil, prompt for
+the jj command to run."
+  (let* ((command (if prompt
+                      (split-string
+                      (read-shell-command
+                        (format "jj git fetch command: ")
+                        "jj git fetch"
+                        'vc-jj-pull-history)
+                      " " t)
+                    `(,vc-jj-program "git" "fetch")))
+         (jj-program (car command))
+         (args (cdr command))
+         (root (vc-jj-root default-directory))
+         (buffer (format "*vc-jj : %s*" (expand-file-name root))))
+    (apply #'vc-do-async-command buffer root jj-program args)
+    (with-current-buffer buffer
+      (vc-run-delayed
+        (vc-compilation-mode 'jj)
+        (setq-local compile-command (string-join command " "))
+        (setq-local compilation-directory root)
+        ;; Either set `compilation-buffer-name-function' locally to nil
+        ;; or use `compilation-arguments' to set `name-function'.
+        ;; See `compilation-buffer-name'.
+        (setq-local compilation-arguments
+                    (list compile-command nil
+                          (lambda (_name-of-mode) buffer)
+                          nil))))
+    (vc-set-async-update buffer)))
 
 (provide 'vc-jj)
 ;;; vc-jj.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]