mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-07 16:10:46 -08:00
Make UPSTREAM-LOCATION argument to incoming-revision optional
Using an empty string to mean the location from which vc-update would pull was inherited from the old incoming/outgoing functions, but we have opportunity to simplify things for this new one. * lisp/vc/vc-bzr.el (vc-bzr-incoming-revision): * lisp/vc/vc-git.el (vc-git-incoming-revision): * lisp/vc/vc-hg.el (vc-hg-incoming-revision): * lisp/vc/vc.el (vc-diff-incoming, vc-diff-outgoing) (vc-diff-outgoing-base, vc--incoming-revision): Make UPSTREAM-LOCATION parameter optional. Use nil, rather than an empty string, to mean the default.
This commit is contained in:
parent
68e07ef8b2
commit
d0bcbc7ada
4 changed files with 14 additions and 21 deletions
|
|
@ -822,13 +822,12 @@ If LIMIT is non-nil, show no more than this many entries."
|
|||
(list "--theirs-only" (and (not (string-empty-p upstream-location))
|
||||
upstream-location))))
|
||||
|
||||
(defun vc-bzr-incoming-revision (upstream-location &optional _refresh)
|
||||
(defun vc-bzr-incoming-revision (&optional upstream-location _refresh)
|
||||
(with-temp-buffer
|
||||
(vc-bzr-command "missing" t 1 nil
|
||||
"--log-format=long" "--show-ids"
|
||||
"--theirs-only" "-r-1.."
|
||||
(and (not (string-empty-p upstream-location))
|
||||
upstream-location))
|
||||
upstream-location)
|
||||
(goto-char (point-min))
|
||||
(and (re-search-forward "^revision-id: " nil t)
|
||||
(buffer-substring (point) (pos-eol)))))
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
;; - get-change-comment (files rev) OK
|
||||
;; HISTORY FUNCTIONS
|
||||
;; * print-log (files buffer &optional shortlog start-revision limit) OK
|
||||
;; * incoming-revision (upstream-location &optional refresh) OK
|
||||
;; * incoming-revision (&optional upstream-location refresh) OK
|
||||
;; - log-search (buffer pattern) OK
|
||||
;; - log-view-mode () OK
|
||||
;; - show-log-entry (revision) OK
|
||||
|
|
@ -1741,13 +1741,11 @@ If LIMIT is a non-empty string, use it as a base revision."
|
|||
start-revision))
|
||||
'("--")))))))
|
||||
|
||||
(defun vc-git-incoming-revision (upstream-location &optional refresh)
|
||||
(let ((rev (if (string-empty-p upstream-location)
|
||||
"@{upstream}"
|
||||
upstream-location)))
|
||||
(defun vc-git-incoming-revision (&optional upstream-location refresh)
|
||||
(let ((rev (or upstream-location "@{upstream}")))
|
||||
(when (or refresh (null (vc-git--rev-parse rev)))
|
||||
(vc-git-command nil 0 nil "fetch"
|
||||
(and (not (string-empty-p upstream-location))
|
||||
(and upstream-location
|
||||
;; Extract remote from "remote/branch".
|
||||
(replace-regexp-in-string "/.*" ""
|
||||
upstream-location))))
|
||||
|
|
|
|||
|
|
@ -1549,10 +1549,8 @@ This runs the command \"hg summary\"."
|
|||
(nreverse result))
|
||||
"\n"))))
|
||||
|
||||
(defun vc-hg-incoming-revision (upstream-location &optional _refresh)
|
||||
(let* ((upstream-location (if (string-empty-p upstream-location)
|
||||
"default"
|
||||
upstream-location))
|
||||
(defun vc-hg-incoming-revision (&optional upstream-location _refresh)
|
||||
(let* ((upstream-location (or upstream-location "default"))
|
||||
;; Use 'hg identify' like this, and not 'hg incoming', because
|
||||
;; this will give a sensible answer regardless of whether the
|
||||
;; incoming revision has been pulled yet.
|
||||
|
|
|
|||
|
|
@ -427,9 +427,10 @@
|
|||
;; received when performing a pull operation from UPSTREAM-LOCATION.
|
||||
;; Deprecated: implement incoming-revision and mergebase instead.
|
||||
;;
|
||||
;; * incoming-revision (upstream-location &optional refresh)
|
||||
;; * incoming-revision (&optional upstream-location refresh)
|
||||
;;
|
||||
;; Return revision at the head of the branch at UPSTREAM-LOCATION.
|
||||
;; UPSTREAM-LOCATION defaults to where `vc-update' would pull from.
|
||||
;; 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
|
||||
|
|
@ -2752,8 +2753,7 @@ global binding."
|
|||
(let* ((fileset (or fileset (vc-deduce-fileset t)))
|
||||
(backend (car fileset))
|
||||
(incoming (vc--incoming-revision backend
|
||||
(or upstream-location "")
|
||||
'refresh)))
|
||||
upstream-location 'refresh)))
|
||||
(vc-diff-internal vc-allow-async-diff fileset
|
||||
(vc-call-backend backend 'mergebase incoming)
|
||||
incoming
|
||||
|
|
@ -2799,8 +2799,7 @@ global binding."
|
|||
(interactive (list (vc--maybe-read-upstream-location)))
|
||||
(let* ((fileset (or fileset (vc-deduce-fileset t)))
|
||||
(backend (car fileset))
|
||||
(incoming (vc--incoming-revision backend
|
||||
(or upstream-location ""))))
|
||||
(incoming (vc--incoming-revision backend upstream-location)))
|
||||
(vc-diff-internal vc-allow-async-diff fileset
|
||||
(vc-call-backend backend 'mergebase incoming)
|
||||
;; FIXME: In order to exclude uncommitted
|
||||
|
|
@ -2885,8 +2884,7 @@ includes uncommitted changes."
|
|||
(interactive (list (vc--maybe-read-upstream-location) nil))
|
||||
(let* ((fileset (or fileset (vc-deduce-fileset t)))
|
||||
(backend (car fileset))
|
||||
(incoming (vc--incoming-revision backend
|
||||
(or upstream-location ""))))
|
||||
(incoming (vc--incoming-revision backend upstream-location)))
|
||||
(vc-diff-internal vc-allow-async-diff fileset
|
||||
(vc-call-backend backend 'mergebase incoming)
|
||||
nil
|
||||
|
|
@ -3744,7 +3742,7 @@ The command prompts for the branch whose change log to show."
|
|||
(read-string "Upstream location/branch (empty for default): " nil
|
||||
'vc-remote-location-history)))
|
||||
|
||||
(defun vc--incoming-revision (backend upstream-location &optional refresh)
|
||||
(defun vc--incoming-revision (backend &optional upstream-location refresh)
|
||||
(or (vc-call-backend backend 'incoming-revision upstream-location refresh)
|
||||
(user-error "No incoming revision -- local-only branch?")))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue