Rename arg REMOTE-LOCATION -> UPSTREAM-LOCATION

* lisp/vc/vc-bzr.el (vc-bzr-log-incoming)
(vc-bzr-incoming-revision, vc-bzr-log-outgoing):
* lisp/vc/vc-git.el (vc-git-incoming-revision):
* lisp/vc/vc-hg.el (vc-hg-incoming-revision):
* lisp/vc/vc.el (vc-root-diff-incoming, vc-diff-incoming)
(vc-root-diff-outgoing, vc-diff-outgoing)
(vc-root-diff-outgoing-base, vc-diff-outgoing-base)
(vc-incoming-outgoing-internal, vc-remote-location-history)
(vc--incoming-revision, vc-log-incoming, vc-default-log-incoming)
(vc-log-outgoing, vc-default-log-outgoing): Rename arguments
REMOTE-LOCATION -> UPSTREAM-LOCATION.  Adjust strings.
(vc--maybe-read-remote-location): Rename ...
(vc--maybe-read-upstream-location): ... to this.
This commit is contained in:
Sean Whitton 2025-09-01 09:41:40 +01:00
parent fa256f11ed
commit 66ef930ebe
5 changed files with 117 additions and 108 deletions

View file

@ -817,27 +817,27 @@ If LIMIT is non-nil, show no more than this many entries."
(buffer-substring (match-end 0) (point-max)))))
;; FIXME: Implement `vc-bzr-mergebase' and then delete this.
(defun vc-bzr-log-incoming (buffer remote-location)
(defun vc-bzr-log-incoming (buffer upstream-location)
(apply #'vc-bzr-command "missing" buffer 'async nil
(list "--theirs-only" (and (not (string-empty-p remote-location))
remote-location))))
(list "--theirs-only" (and (not (string-empty-p upstream-location))
upstream-location))))
(defun vc-bzr-incoming-revision (remote-location &optional _refresh)
(defun vc-bzr-incoming-revision (upstream-location &optional _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 remote-location))
remote-location))
(and (not (string-empty-p upstream-location))
upstream-location))
(goto-char (point-min))
(and (re-search-forward "^revision-id: " nil t)
(buffer-substring (point) (pos-eol)))))
;; FIXME: Implement `vc-bzr-mergebase' and then delete this.
(defun vc-bzr-log-outgoing (buffer remote-location)
(defun vc-bzr-log-outgoing (buffer upstream-location)
(apply #'vc-bzr-command "missing" buffer 'async nil
(list "--mine-only" (and (not (string-empty-p remote-location))
remote-location))))
(list "--mine-only" (and (not (string-empty-p upstream-location))
upstream-location))))
(defun vc-bzr-show-log-entry (revision)
"Find entry for patch name REVISION in bzr change log buffer."

View file

@ -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 &optional refresh) OK
;; * incoming-revision (upstream-location &optional refresh) OK
;; - log-search (buffer pattern) OK
;; - log-view-mode () OK
;; - show-log-entry (revision) OK
@ -1605,16 +1605,16 @@ If LIMIT is a non-empty string, use it as a base revision."
start-revision))
'("--")))))))
(defun vc-git-incoming-revision (remote-location &optional refresh)
(let ((rev (if (string-empty-p remote-location)
(defun vc-git-incoming-revision (upstream-location &optional refresh)
(let ((rev (if (string-empty-p upstream-location)
"@{upstream}"
remote-location)))
upstream-location)))
(when (or refresh (null (vc-git--rev-parse rev)))
(vc-git-command nil 0 nil "fetch"
(and (not (string-empty-p remote-location))
(and (not (string-empty-p upstream-location))
;; Extract remote from "remote/branch".
(replace-regexp-in-string "/.*" ""
remote-location))))
upstream-location))))
(ignore-errors ; in order to return nil if no such branch
(with-output-to-string
(vc-git-command standard-output 0 nil

View file

@ -1531,19 +1531,19 @@ This runs the command \"hg summary\"."
(nreverse result))
"\n"))))
(defun vc-hg-incoming-revision (remote-location &optional _refresh)
(let* ((remote-location (if (string-empty-p remote-location)
(defun vc-hg-incoming-revision (upstream-location &optional _refresh)
(let* ((upstream-location (if (string-empty-p upstream-location)
"default"
remote-location))
upstream-location))
;; 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.
(rev (with-output-to-string
(vc-hg-command standard-output 0 nil "identify" "--id"
remote-location "--template={node}"))))
upstream-location "--template={node}"))))
(condition-case _ (vc-hg-command nil 0 nil "log" "-r" rev)
;; We don't have the revision locally. Pull it.
(error (vc-hg-command nil 0 nil "pull" remote-location)))
(error (vc-hg-command nil 0 nil "pull" upstream-location)))
rev))
(defun vc-hg-mergebase (rev1 &optional rev2)

View file

@ -396,27 +396,27 @@
;; revision shown, rather than the working revision, which is normally
;; the case). Not all backends support this.
;;
;; - log-outgoing (buffer remote-location) (DEPRECATED)
;; - log-outgoing (buffer upstream-location) (DEPRECATED)
;;
;; Insert in BUFFER the revision log for the changes that will be
;; sent when performing a push operation to REMOTE-LOCATION.
;; sent when performing a push operation to UPSTREAM-LOCATION.
;; Deprecated: implement incoming-revision and mergebase instead.
;;
;; - log-incoming (buffer remote-location) (DEPRECATED)
;; - log-incoming (buffer upstream-location) (DEPRECATED)
;;
;; Insert in BUFFER the revision log for the changes that will be
;; received when performing a pull operation from REMOTE-LOCATION.
;; received when performing a pull operation from UPSTREAM-LOCATION.
;; Deprecated: implement incoming-revision and mergebase instead.
;;
;; * incoming-revision (remote-location &optional refresh)
;; * incoming-revision (upstream-location &optional refresh)
;;
;; Return revision at the head of the branch at REMOTE-LOCATION.
;; Return revision at the head of the branch at UPSTREAM-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
;; from UPSTREAM-LOCATION unless REFRESH is non-nil, which means that
;; the most up-to-date information possible is required.
;;
;; - log-search (buffer pattern)
@ -2539,33 +2539,36 @@ The merge base is a common ancestor between REV1 and REV2 revisions."
(called-interactively-p 'interactive)))))
;;;###autoload
(defun vc-root-diff-incoming (&optional remote-location)
"Report diff of all changes that would be pulled from REMOTE-LOCATION.
When unspecified REMOTE-LOCATION is the place \\[vc-update] would pull from.
When called interactively with a prefix argument, prompt for REMOTE-LOCATION.
In some version control systems REMOTE-LOCATION can be a remote branch name.
(defun vc-root-diff-incoming (&optional upstream-location)
"Report diff of all changes that would be pulled from UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-update] would pull
from. When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION
can be a remote branch name.
See `vc-use-incoming-outgoing-prefixes' regarding giving this command a
global binding."
(interactive (list (vc--maybe-read-remote-location)))
(interactive (list (vc--maybe-read-upstream-location)))
(vc--with-backend-in-rootdir "VC root-diff"
(vc-diff-incoming remote-location `(,backend (,rootdir)))))
(vc-diff-incoming upstream-location `(,backend (,rootdir)))))
;;;###autoload
(defun vc-diff-incoming (&optional remote-location fileset)
"Report changes to VC fileset that would be pulled from REMOTE-LOCATION.
When unspecified REMOTE-LOCATION is the place \\[vc-update] would pull from.
When called interactively with a prefix argument, prompt for REMOTE-LOCATION.
In some version control systems REMOTE-LOCATION can be a remote branch name.
When called from Lisp optional argument FILESET overrides the VC fileset.
(defun vc-diff-incoming (&optional upstream-location fileset)
"Report changes to VC fileset that would be pulled from UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-update] would pull
from. When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION
can be a remote branch name.
When called from Lisp optional argument FILESET overrides the VC
fileset.
See `vc-use-incoming-outgoing-prefixes' regarding giving this command a
global binding."
(interactive (list (vc--maybe-read-remote-location) nil))
(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 remote-location "")
(or upstream-location "")
'refresh)))
(vc-diff-internal vc-allow-async-diff fileset
(vc-call-backend backend 'mergebase incoming)
@ -2573,28 +2576,31 @@ global binding."
(called-interactively-p 'interactive))))
;;;###autoload
(defun vc-root-diff-outgoing (&optional remote-location)
"Report diff of all changes that would be pushed to REMOTE-LOCATION.
When unspecified REMOTE-LOCATION is the place \\[vc-push] would push to.
When called interactively with a prefix argument, prompt for REMOTE-LOCATION.
In some version control systems REMOTE-LOCATION can be a remote branch name.
(defun vc-root-diff-outgoing (&optional upstream-location)
"Report diff of all changes that would be pushed to UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-push] would push
to. When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION
can be a remote branch name.
This command is like `vc-root-diff-outgoing-base' except that it does
not include uncommitted changes.
See `vc-use-incoming-outgoing-prefixes' regarding giving this command a
global binding."
(interactive (list (vc--maybe-read-remote-location)))
(interactive (list (vc--maybe-read-upstream-location)))
(vc--with-backend-in-rootdir "VC root-diff"
(vc-diff-outgoing remote-location `(,backend (,rootdir)))))
(vc-diff-outgoing upstream-location `(,backend (,rootdir)))))
;;;###autoload
(defun vc-diff-outgoing (&optional remote-location fileset)
"Report changes to VC fileset that would be pushed to REMOTE-LOCATION.
When unspecified REMOTE-LOCATION is the place \\[vc-push] would push to.
When called interactively with a prefix argument, prompt for REMOTE-LOCATION.
In some version control systems REMOTE-LOCATION can be a remote branch name.
When called from Lisp optional argument FILESET overrides the VC fileset.
(defun vc-diff-outgoing (&optional upstream-location fileset)
"Report changes to VC fileset that would be pushed to UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-push] would push
to. When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION
can be a remote branch name.
When called from Lisp optional argument FILESET overrides the VC
fileset.
This command is like `vc-diff-outgoing-base' except that it does not
include uncommitted changes.
@ -2606,11 +2612,11 @@ global binding."
;; for those VCS is to make a comparison between locally committed
;; changes and remote committed changes.
;; (Hence why we don't call `vc-buffer-sync-fileset'.)
(interactive (list (vc--maybe-read-remote-location)))
(interactive (list (vc--maybe-read-upstream-location)))
(let* ((fileset (or fileset (vc-deduce-fileset t)))
(backend (car fileset))
(incoming (vc--incoming-revision backend
(or remote-location ""))))
(or upstream-location ""))))
(vc-diff-internal vc-allow-async-diff fileset
(vc-call-backend backend 'mergebase incoming)
;; FIXME: In order to exclude uncommitted
@ -2640,7 +2646,7 @@ global binding."
(called-interactively-p 'interactive))))
;; For the following two commands, the default meaning for
;; REMOTE-LOCATION may become dependent on whether we are on a
;; UPSTREAM-LOCATION may become dependent on whether we are on a
;; shorter-lived or longer-lived ("trunk") branch. If we are on the
;; trunk then it will always be the place `vc-push' would push to. If
;; we are on a shorter-lived branch, it may instead become the remote
@ -2656,49 +2662,49 @@ global binding."
;; --spwhitton
;;;###autoload
(defun vc-root-diff-outgoing-base (&optional remote-location)
"Report diff of all changes since the merge base with REMOTE-LOCATION.
The merge base with REMOTE-LOCATION means the common ancestor of the
working revision and REMOTE-LOCATION.
(defun vc-root-diff-outgoing-base (&optional upstream-location)
"Report diff of all changes since the merge base with UPSTREAM-LOCATION.
The merge base with UPSTREAM-LOCATION means the common ancestor of the
working revision and UPSTREAM-LOCATION.
Uncommitted changes are included in the diff.
When unspecified REMOTE-LOCATION is the place \\[vc-push] would push to.
This default meaning for REMOTE-LOCATION may change in a future release
of Emacs.
When unspecified UPSTREAM-LOCATION is the place \\[vc-push] would push
to. This default meaning for UPSTREAM-LOCATION may change in a future
release of Emacs.
When called interactively with a prefix argument, prompt for
REMOTE-LOCATION. In some version control systems, REMOTE-LOCATION can
be a remote branch name.
UPSTREAM-LOCATION. In some version control systems, UPSTREAM-LOCATION
can be a remote branch name.
This command is like `vc-root-diff-outgoing' except that it includes
uncommitted changes."
(interactive (list (vc--maybe-read-remote-location)))
(interactive (list (vc--maybe-read-upstream-location)))
(vc--with-backend-in-rootdir "VC root-diff"
(vc-diff-outgoing-base remote-location `(,backend (,rootdir)))))
(vc-diff-outgoing-base upstream-location `(,backend (,rootdir)))))
;;;###autoload
(defun vc-diff-outgoing-base (&optional remote-location fileset)
"Report changes to VC fileset since the merge base with REMOTE-LOCATION.
(defun vc-diff-outgoing-base (&optional upstream-location fileset)
"Report changes to VC fileset since the merge base with UPSTREAM-LOCATION.
The merge base with REMOTE-LOCATION means the common ancestor of the
working revision and REMOTE-LOCATION.
The merge base with UPSTREAM-LOCATION means the common ancestor of the
working revision and UPSTREAM-LOCATION.
Uncommitted changes are included in the diff.
When unspecified REMOTE-LOCATION is the place \\[vc-push] would push to.
This default meaning for REMOTE-LOCATION may change in a future release
of Emacs.
When unspecified UPSTREAM-LOCATION is the place \\[vc-push] would push
to. This default meaning for UPSTREAM-LOCATION may change in a future
release of Emacs.
When called interactively with a prefix argument, prompt for
REMOTE-LOCATION. In some version control systems, REMOTE-LOCATION can
be a remote branch name.
UPSTREAM-LOCATION. In some version control systems, UPSTREAM-LOCATION
can be a remote branch name.
This command is like to `vc-fileset-diff-outgoing' except that it
includes uncommitted changes."
(interactive (list (vc--maybe-read-remote-location) nil))
(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 remote-location ""))))
(or upstream-location ""))))
(vc-diff-internal vc-allow-async-diff fileset
(vc-call-backend backend 'mergebase incoming)
nil
@ -3442,15 +3448,15 @@ Each function runs in the log output buffer without args.")
(set-buffer-modified-p nil)
(run-hooks 'vc-log-finish-functions)))))
(defun vc-incoming-outgoing-internal (backend remote-location buffer-name type)
(defun vc-incoming-outgoing-internal (backend upstream-location buffer-name type)
(vc-log-internal-common
backend buffer-name nil type
(lambda (bk buf type-arg _files)
(vc-call-backend bk type-arg buf remote-location))
(vc-call-backend bk type-arg buf upstream-location))
(lambda (_bk _files-arg _ret) nil)
nil ;; Don't move point.
(lambda (_ignore-auto _noconfirm)
(vc-incoming-outgoing-internal backend remote-location buffer-name type))))
(vc-incoming-outgoing-internal backend upstream-location buffer-name type))))
;;;###autoload
(defun vc-print-log (&optional working-revision limit)
@ -3544,50 +3550,53 @@ The command prompts for the branch whose change log to show."
(list rootdir) branch t
(when (> vc-log-show-limit 0) vc-log-show-limit))))
;; FIXME: Consider renaming to `vc-upstream-location-history'.
(defvar vc-remote-location-history nil
"History for remote locations for VC incoming and outgoing commands.")
"History of upstream locations for VC incoming and outgoing commands.")
(defun vc--maybe-read-remote-location ()
(defun vc--maybe-read-upstream-location ()
(and current-prefix-arg
(read-string "Remote location/branch (empty for default): " nil
(read-string "Upstream location/branch (empty for default): " nil
'vc-remote-location-history)))
(defun vc--incoming-revision (backend remote-location &optional refresh)
(or (vc-call-backend backend 'incoming-revision remote-location refresh)
(defun vc--incoming-revision (backend upstream-location &optional refresh)
(or (vc-call-backend backend 'incoming-revision upstream-location refresh)
(user-error "No incoming revision -- local-only branch?")))
;;;###autoload
(defun vc-log-incoming (&optional remote-location)
"Show log of changes that will be received with pull from REMOTE-LOCATION.
When unspecified REMOTE-LOCATION is the place \\[vc-update] would pull from.
When called interactively with a prefix argument, prompt for REMOTE-LOCATION.
In some version control systems REMOTE-LOCATION can be a remote branch name."
(interactive (list (vc--maybe-read-remote-location)))
(defun vc-log-incoming (&optional upstream-location)
"Show log of changes that will be received with pull from UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-update] would pull
from. When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION
can be a remote branch name."
(interactive (list (vc--maybe-read-upstream-location)))
(vc--with-backend-in-rootdir "VC root-log"
(vc-incoming-outgoing-internal backend (or remote-location "")
(vc-incoming-outgoing-internal backend (or upstream-location "")
"*vc-incoming*" 'log-incoming)))
(defun vc-default-log-incoming (_backend buffer remote-location)
(defun vc-default-log-incoming (_backend buffer upstream-location)
(vc--with-backend-in-rootdir ""
(let ((incoming (vc--incoming-revision backend remote-location 'refresh)))
(let ((incoming (vc--incoming-revision backend upstream-location 'refresh)))
(vc-call-backend backend 'print-log (list rootdir) buffer t
incoming
(vc-call-backend backend 'mergebase incoming)))))
;;;###autoload
(defun vc-log-outgoing (&optional remote-location)
"Show log of changes that will be sent with a push operation to REMOTE-LOCATION.
When unspecified REMOTE-LOCATION is the place \\[vc-push] would push to.
When called interactively with a prefix argument, prompt for REMOTE-LOCATION.
In some version control systems REMOTE-LOCATION can be a remote branch name."
(interactive (list (vc--maybe-read-remote-location)))
(defun vc-log-outgoing (&optional upstream-location)
"Show log of changes that will be sent with a push to UPSTREAM-LOCATION.
When unspecified UPSTREAM-LOCATION is the place \\[vc-push] would push
to. When called interactively with a prefix argument, prompt for
UPSTREAM-LOCATION. In some version control systems UPSTREAM-LOCATION
can be a remote branch name."
(interactive (list (vc--maybe-read-upstream-location)))
(vc--with-backend-in-rootdir "VC root-log"
(vc-incoming-outgoing-internal backend (or remote-location "")
(vc-incoming-outgoing-internal backend (or upstream-location "")
"*vc-outgoing*" 'log-outgoing)))
(defun vc-default-log-outgoing (_backend buffer remote-location)
(defun vc-default-log-outgoing (_backend buffer upstream-location)
(vc--with-backend-in-rootdir ""
(let ((incoming (vc--incoming-revision backend remote-location)))
(let ((incoming (vc--incoming-revision backend upstream-location)))
(vc-call-backend backend 'print-log (list rootdir) buffer t
""
(vc-call-backend backend 'mergebase incoming)))))

View file

@ -73,8 +73,8 @@
;; HISTORY FUNCTIONS
;;
;; * print-log (files buffer &optional shortlog start-revision limit)
;; - log-outgoing (backend remote-location)
;; - log-incoming (backend remote-location)
;; - log-outgoing (backend upstream-location)
;; - log-incoming (backend upstream-location)
;; - log-view-mode ()
;; - show-log-entry (revision)
;; - comment-history (file)