mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
VC outgoing commands for Git: Don't unconditionally fetch
* lisp/vc/vc-bzr.el (vc-bzr-incoming-revision): * lisp/vc/vc-hg.el (vc-hg-incoming-revision): * lisp/vc/vc.el (vc-diff-incoming, vc--incoming-revision): New REFRESH optional argument. (vc-default-log-incoming): Pass it. * lisp/vc/vc-git.el (vc-git-incoming-revision): New REFRESH optional argument. When nil, use cached info (bug#62940).
This commit is contained in:
parent
3c94ae5a37
commit
fa256f11ed
4 changed files with 26 additions and 21 deletions
|
|
@ -822,7 +822,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
|||
(list "--theirs-only" (and (not (string-empty-p remote-location))
|
||||
remote-location))))
|
||||
|
||||
(defun vc-bzr-incoming-revision (remote-location)
|
||||
(defun vc-bzr-incoming-revision (remote-location &optional _refresh)
|
||||
(with-temp-buffer
|
||||
(vc-bzr-command "missing" t 1 nil
|
||||
"--log-format=long" "--show-ids"
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
;; - get-change-comment (files rev) OK
|
||||
;; HISTORY FUNCTIONS
|
||||
;; * print-log (files buffer &optional shortlog start-revision limit) OK
|
||||
;; * incoming-revision (remote-location) OK
|
||||
;; * incoming-revision (remote-location &optional refresh) OK
|
||||
;; - log-search (buffer pattern) OK
|
||||
;; - log-view-mode () OK
|
||||
;; - show-log-entry (revision) OK
|
||||
|
|
@ -1605,19 +1605,20 @@ If LIMIT is a non-empty string, use it as a base revision."
|
|||
start-revision))
|
||||
'("--")))))))
|
||||
|
||||
(defun vc-git-incoming-revision (remote-location)
|
||||
(vc-git-command nil 0 nil "fetch"
|
||||
(and (not (string-empty-p remote-location))
|
||||
;; Extract remote from "remote/branch".
|
||||
(replace-regexp-in-string "/.*" ""
|
||||
remote-location)))
|
||||
(ignore-errors ; in order to return nil if no such branch
|
||||
(with-output-to-string
|
||||
(vc-git-command standard-output 0 nil
|
||||
"log" "--max-count=1" "--pretty=format:%H"
|
||||
(if (string-empty-p remote-location)
|
||||
"@{upstream}"
|
||||
remote-location)))))
|
||||
(defun vc-git-incoming-revision (remote-location &optional refresh)
|
||||
(let ((rev (if (string-empty-p remote-location)
|
||||
"@{upstream}"
|
||||
remote-location)))
|
||||
(when (or refresh (null (vc-git--rev-parse rev)))
|
||||
(vc-git-command nil 0 nil "fetch"
|
||||
(and (not (string-empty-p remote-location))
|
||||
;; Extract remote from "remote/branch".
|
||||
(replace-regexp-in-string "/.*" ""
|
||||
remote-location))))
|
||||
(ignore-errors ; in order to return nil if no such branch
|
||||
(with-output-to-string
|
||||
(vc-git-command standard-output 0 nil
|
||||
"log" "--max-count=1" "--pretty=format:%H" rev)))))
|
||||
|
||||
(defun vc-git-log-search (buffer pattern)
|
||||
"Search the log of changes for PATTERN and output results into BUFFER.
|
||||
|
|
|
|||
|
|
@ -1531,7 +1531,7 @@ This runs the command \"hg summary\"."
|
|||
(nreverse result))
|
||||
"\n"))))
|
||||
|
||||
(defun vc-hg-incoming-revision (remote-location)
|
||||
(defun vc-hg-incoming-revision (remote-location &optional _refresh)
|
||||
(let* ((remote-location (if (string-empty-p remote-location)
|
||||
"default"
|
||||
remote-location))
|
||||
|
|
|
|||
|
|
@ -408,13 +408,16 @@
|
|||
;; received when performing a pull operation from REMOTE-LOCATION.
|
||||
;; Deprecated: implement incoming-revision and mergebase instead.
|
||||
;;
|
||||
;; * incoming-revision (remote-location)
|
||||
;; * incoming-revision (remote-location &optional refresh)
|
||||
;;
|
||||
;; Return revision at the head of the branch at REMOTE-LOCATION.
|
||||
;; If there is no such branch there, return nil. (Should signal an
|
||||
;; error, not return nil, in the case that fetching data fails.)
|
||||
;; For a distributed VCS, should also fetch that revision into local
|
||||
;; storage for operating on by subsequent calls into the backend.
|
||||
;; The backend may rely on cached information from a previous fetch
|
||||
;; from REMOTE-LOCATION unless REFRESH is non-nil, which means that
|
||||
;; the most up-to-date information possible is required.
|
||||
;;
|
||||
;; - log-search (buffer pattern)
|
||||
;;
|
||||
|
|
@ -2562,7 +2565,8 @@ global binding."
|
|||
(let* ((fileset (or fileset (vc-deduce-fileset t)))
|
||||
(backend (car fileset))
|
||||
(incoming (vc--incoming-revision backend
|
||||
(or remote-location ""))))
|
||||
(or remote-location "")
|
||||
'refresh)))
|
||||
(vc-diff-internal vc-allow-async-diff fileset
|
||||
(vc-call-backend backend 'mergebase incoming)
|
||||
incoming
|
||||
|
|
@ -3548,8 +3552,8 @@ The command prompts for the branch whose change log to show."
|
|||
(read-string "Remote location/branch (empty for default): " nil
|
||||
'vc-remote-location-history)))
|
||||
|
||||
(defun vc--incoming-revision (backend remote-location)
|
||||
(or (vc-call-backend backend 'incoming-revision remote-location)
|
||||
(defun vc--incoming-revision (backend remote-location &optional refresh)
|
||||
(or (vc-call-backend backend 'incoming-revision remote-location refresh)
|
||||
(user-error "No incoming revision -- local-only branch?")))
|
||||
|
||||
;;;###autoload
|
||||
|
|
@ -3565,7 +3569,7 @@ In some version control systems REMOTE-LOCATION can be a remote branch name."
|
|||
|
||||
(defun vc-default-log-incoming (_backend buffer remote-location)
|
||||
(vc--with-backend-in-rootdir ""
|
||||
(let ((incoming (vc--incoming-revision backend remote-location)))
|
||||
(let ((incoming (vc--incoming-revision backend remote-location 'refresh)))
|
||||
(vc-call-backend backend 'print-log (list rootdir) buffer t
|
||||
incoming
|
||||
(vc-call-backend backend 'mergebase incoming)))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue