]> git.eshelyaron.com Git - emacs.git/commitdiff
VC: ability to skip update buffers prompt
authorAndrii Kolomoiets <andreyk.mad@gmail.com>
Thu, 14 Nov 2019 05:55:28 +0000 (06:55 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 14 Nov 2019 05:55:28 +0000 (06:55 +0100)
* lisp/vc/vc.el (vc-default-update-on-retrieve-tag): New function.
(vc-retrieve-tag): Call `update-on-retrieve-tag' backend function
to determine if prompt for update buffers is needed; Include tag
name into the "Retrieving tag" message.
* lisp/vc/vc-git.el (vc-git-update-on-retrieve-tag):
* lisp/vc/vc-hg.el (vc-hg-update-on-retrieve-tag):
* lisp/vc/vc-svn.el (vc-svn-udate-on-retrieve-tag): New functions.
Buffers update prompt on `vc-retrieve-tag' is omitted (bug#38156).

lisp/vc/vc-git.el
lisp/vc/vc-hg.el
lisp/vc/vc-svn.el
lisp/vc/vc.el

index 2046a9dceca2361602b5da5c02ac8cd0dfcca8e3..5ab8e7ec53eb9c769dc830e00cba79c562e74b3c 100644 (file)
@@ -47,6 +47,7 @@
 ;; FUNCTION NAME                                   STATUS
 ;; BACKEND PROPERTIES
 ;; * revision-granularity                          OK
+;; - update-on-retrieve-tag                        OK
 ;; STATE-QUERYING FUNCTIONS
 ;; * registered (file)                             OK
 ;; * state (file)                                  OK
@@ -218,6 +219,7 @@ toggle display of the entire list."
 
 (defun vc-git-revision-granularity () 'repository)
 (defun vc-git-checkout-model (_files) 'implicit)
+(defun vc-git-update-on-retrieve-tag () nil)
 
 ;;; STATE-QUERYING FUNCTIONS
 
index cc737b30b15dfae710b0304926259a2d87743cc0..16e5dd6db001083b26b192453c99b3c6e8230f55 100644 (file)
@@ -40,6 +40,7 @@
 ;; FUNCTION NAME                               STATUS
 ;; BACKEND PROPERTIES
 ;; * revision-granularity                      OK
+;; - update-on-retrieve-tag                    OK
 ;; STATE-QUERYING FUNCTIONS
 ;; * registered (file)                         OK
 ;; * state (file)                              OK
@@ -194,6 +195,7 @@ highlighting the Log View buffer."
 
 (defun vc-hg-revision-granularity () 'repository)
 (defun vc-hg-checkout-model (_files) 'implicit)
+(defun vc-hg-update-on-retrieve-tag () nil)
 
 ;;; State querying functions
 
index 942dbd5fa5afcbafbc6548968b9d445765e4046d..ed34b357f9bd61a8e147def18dd35c1a982ec3e0 100644 (file)
@@ -127,6 +127,7 @@ switches."
 
 (defun vc-svn-revision-granularity () 'repository)
 (defun vc-svn-checkout-model (_files) 'implicit)
+(defun vc-svn-update-on-retrieve-tag () nil)
 
 ;;;
 ;;; State-querying functions
index 20056dec7f901db6e75162917aac8bced64f1b18..401b39145c868168edeb570a7671885e2b9c911a 100644 (file)
 ;;   that return 'file have per-file revision numbering; backends
 ;;   that return 'repository have per-repository revision numbering,
 ;;   so a revision level implicitly identifies a changeset
+;;
+;; - update-on-retrieve-tag
+;;
+;;   Takes no arguments.  Backends that return non-nil can update
+;;   buffers on `vc-retrieve-tag' based on user input.  In this case
+;;   user will be prompted to update buffers on `vc-retrieve-tag'.
 
 ;; STATE-QUERYING FUNCTIONS
 ;;
@@ -2302,14 +2308,15 @@ This function runs the hook `vc-retrieve-tag-hook' when finished."
       (vc-read-revision "Tag name to retrieve (default latest revisions): "
                         (list dir)
                         (vc-responsible-backend dir)))))
-  (let ((update (yes-or-no-p "Update any affected buffers? "))
-       (msg (if (or (not name) (string= name ""))
-                (format "Updating %s... " (abbreviate-file-name dir))
-              (format "Retrieving tag into %s... "
-                      (abbreviate-file-name dir)))))
+  (let* ((backend (vc-responsible-backend dir))
+         (update (when (vc-call-backend backend 'update-on-retrieve-tag)
+                   (yes-or-no-p "Update any affected buffers? ")))
+        (msg (if (or (not name) (string= name ""))
+                 (format "Updating %s... " (abbreviate-file-name dir))
+               (format "Retrieving tag %s into %s... "
+                       name (abbreviate-file-name dir)))))
     (message "%s" msg)
-    (vc-call-backend (vc-responsible-backend dir)
-                    'retrieve-tag dir name update)
+    (vc-call-backend backend 'retrieve-tag dir name update)
     (vc-resynch-buffer dir t t t)
     (run-hooks 'vc-retrieve-tag-hook)
     (message "%s" (concat msg "done"))))
@@ -3025,6 +3032,10 @@ to provide the `find-revision' operation instead."
   "Let BACKEND receive FILE from another version control system."
   (vc-call-backend backend 'register (list file) rev ""))
 
+(defun vc-default-update-on-retrieve-tag ()
+  "Prompt for update buffers on `vc-retrieve-tag'."
+  t)
+
 (defun vc-default-retrieve-tag (backend dir name update)
   (if (string= name "")
       (progn