mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-16 02:50:26 -08:00
VC: Deprecate log-incoming and log-outgoing backend functions
* lisp/vc/vc-git.el (vc-git-incoming-revision): Inline vc-git--fetch-incoming. (vc-git--fetch-incoming, vc-git-log-incoming) (vc-git-log-outgoing): Delete. * lisp/vc/vc-hg.el (vc-hg-mergebase): * lisp/vc/vc.el (vc-default-log-incoming) (vc-default-log-outgoing): New functions. * lisp/vc/vc.el: * etc/NEWS: Document the deprecation.
This commit is contained in:
parent
b3f4486b04
commit
ac4869c712
6 changed files with 49 additions and 37 deletions
6
etc/NEWS
6
etc/NEWS
|
|
@ -1809,6 +1809,12 @@ This replaces and generalizes the old 'vc-annotate-parent-rev'.
|
||||||
---
|
---
|
||||||
*** vc-dav.el is now obsolete.
|
*** vc-dav.el is now obsolete.
|
||||||
|
|
||||||
|
---
|
||||||
|
*** The 'log-incoming' and 'log-outgoing' functions are deprecated.
|
||||||
|
Backend authors should implement the 'incoming-revision' and 'mergebase'
|
||||||
|
backend functions instead. These are jointly sufficient to support the
|
||||||
|
'C-x v I' and 'C-x v O' commands.
|
||||||
|
|
||||||
** Diff mode
|
** Diff mode
|
||||||
|
|
||||||
+++
|
+++
|
||||||
|
|
|
||||||
|
|
@ -816,6 +816,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
(indent-region (match-end 0) (point-max) 2)
|
(indent-region (match-end 0) (point-max) 2)
|
||||||
(buffer-substring (match-end 0) (point-max)))))
|
(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 remote-location)
|
||||||
(apply #'vc-bzr-command "missing" buffer 'async nil
|
(apply #'vc-bzr-command "missing" buffer 'async nil
|
||||||
(list "--theirs-only" (and (not (string-empty-p remote-location))
|
(list "--theirs-only" (and (not (string-empty-p remote-location))
|
||||||
|
|
@ -832,6 +833,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
(and (re-search-forward "^revision-id: " nil t)
|
(and (re-search-forward "^revision-id: " nil t)
|
||||||
(buffer-substring (point) (pos-eol)))))
|
(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 remote-location)
|
||||||
(apply #'vc-bzr-command "missing" buffer 'async nil
|
(apply #'vc-bzr-command "missing" buffer 'async nil
|
||||||
(list "--mine-only" (and (not (string-empty-p remote-location))
|
(list "--mine-only" (and (not (string-empty-p remote-location))
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,7 @@
|
||||||
;; - get-change-comment (files rev) OK
|
;; - get-change-comment (files rev) OK
|
||||||
;; HISTORY FUNCTIONS
|
;; HISTORY FUNCTIONS
|
||||||
;; * print-log (files buffer &optional shortlog start-revision limit) OK
|
;; * print-log (files buffer &optional shortlog start-revision limit) OK
|
||||||
;; * log-outgoing (buffer remote-location) OK
|
;; * incoming-revision (remote-location) OK
|
||||||
;; * log-incoming (buffer remote-location) OK
|
|
||||||
;; - log-search (buffer pattern) OK
|
;; - log-search (buffer pattern) OK
|
||||||
;; - log-view-mode () OK
|
;; - log-view-mode () OK
|
||||||
;; - show-log-entry (revision) OK
|
;; - show-log-entry (revision) OK
|
||||||
|
|
@ -1577,41 +1576,12 @@ If LIMIT is a revision string, use it as an end-revision."
|
||||||
(list "-p"))
|
(list "-p"))
|
||||||
'("--")))))))
|
'("--")))))))
|
||||||
|
|
||||||
(defun vc-git-log-outgoing (buffer remote-location)
|
(defun vc-git-incoming-revision (remote-location)
|
||||||
(vc-setup-buffer buffer)
|
|
||||||
(apply #'vc-git-command buffer 'async nil
|
|
||||||
`("log"
|
|
||||||
"--no-color" "--graph" "--decorate" "--date=short"
|
|
||||||
,(format "--pretty=tformat:%s" (car vc-git-root-log-format))
|
|
||||||
"--abbrev-commit"
|
|
||||||
,@(ensure-list vc-git-shortlog-switches)
|
|
||||||
,(concat (if (string-empty-p remote-location)
|
|
||||||
"@{upstream}"
|
|
||||||
remote-location)
|
|
||||||
"..HEAD"))))
|
|
||||||
|
|
||||||
(defun vc-git--fetch-incoming (remote-location)
|
|
||||||
(vc-git-command nil 0 nil "fetch"
|
(vc-git-command nil 0 nil "fetch"
|
||||||
(and (not (string-empty-p remote-location))
|
(and (not (string-empty-p remote-location))
|
||||||
;; Extract remote from "remote/branch".
|
;; Extract remote from "remote/branch".
|
||||||
(replace-regexp-in-string "/.*" ""
|
(replace-regexp-in-string "/.*" ""
|
||||||
remote-location))))
|
remote-location)))
|
||||||
|
|
||||||
(defun vc-git-log-incoming (buffer remote-location)
|
|
||||||
(vc-setup-buffer buffer)
|
|
||||||
(vc-git--fetch-incoming remote-location)
|
|
||||||
(apply #'vc-git-command buffer 'async nil
|
|
||||||
`("log"
|
|
||||||
"--no-color" "--graph" "--decorate" "--date=short"
|
|
||||||
,(format "--pretty=tformat:%s" (car vc-git-root-log-format))
|
|
||||||
"--abbrev-commit"
|
|
||||||
,@(ensure-list vc-git-shortlog-switches)
|
|
||||||
,(concat "HEAD.." (if (string-empty-p remote-location)
|
|
||||||
"@{upstream}"
|
|
||||||
remote-location)))))
|
|
||||||
|
|
||||||
(defun vc-git-incoming-revision (remote-location)
|
|
||||||
(vc-git--fetch-incoming remote-location)
|
|
||||||
(ignore-errors ; in order to return nil if no such branch
|
(ignore-errors ; in order to return nil if no such branch
|
||||||
(with-output-to-string
|
(with-output-to-string
|
||||||
(vc-git-command standard-output 0 nil
|
(vc-git-command standard-output 0 nil
|
||||||
|
|
|
||||||
|
|
@ -1458,6 +1458,7 @@ This runs the command \"hg summary\"."
|
||||||
(nreverse result))
|
(nreverse result))
|
||||||
"\n"))))
|
"\n"))))
|
||||||
|
|
||||||
|
;; FIXME: Resolve issue with `vc-hg-mergebase' and then delete this.
|
||||||
(defun vc-hg-log-incoming (buffer remote-location)
|
(defun vc-hg-log-incoming (buffer remote-location)
|
||||||
(vc-setup-buffer buffer)
|
(vc-setup-buffer buffer)
|
||||||
(vc-hg-command buffer 1 nil "incoming" "-n"
|
(vc-hg-command buffer 1 nil "incoming" "-n"
|
||||||
|
|
@ -1475,12 +1476,23 @@ This runs the command \"hg summary\"."
|
||||||
(and (not (string-empty-p output))
|
(and (not (string-empty-p output))
|
||||||
output)))
|
output)))
|
||||||
|
|
||||||
|
;; FIXME: Resolve issue with `vc-hg-mergebase' and then delete this.
|
||||||
(defun vc-hg-log-outgoing (buffer remote-location)
|
(defun vc-hg-log-outgoing (buffer remote-location)
|
||||||
(vc-setup-buffer buffer)
|
(vc-setup-buffer buffer)
|
||||||
(vc-hg-command buffer 1 nil "outgoing" "-n"
|
(vc-hg-command buffer 1 nil "outgoing" "-n"
|
||||||
(and (not (string-empty-p remote-location))
|
(and (not (string-empty-p remote-location))
|
||||||
remote-location)))
|
remote-location)))
|
||||||
|
|
||||||
|
;; FIXME: This works only when both rev1 and rev2 have already been pulled.
|
||||||
|
;; That means it can't do the work
|
||||||
|
;; `vc-default-log-incoming' and `vc-default-log-outgoing' need it to do.
|
||||||
|
(defun vc-hg-mergebase (rev1 &optional rev2)
|
||||||
|
(or (vc-hg--run-log "{node}"
|
||||||
|
(format "last(ancestors(%s) and ancestors(%s))"
|
||||||
|
rev1 (or rev2 "tip"))
|
||||||
|
nil)
|
||||||
|
(error "No common ancestor for merge base")))
|
||||||
|
|
||||||
(defvar vc-hg-error-regexp-alist
|
(defvar vc-hg-error-regexp-alist
|
||||||
'(("^M \\(.+\\)" 1 nil nil 0))
|
'(("^M \\(.+\\)" 1 nil nil 0))
|
||||||
"Value of `compilation-error-regexp-alist' in *vc-hg* buffers.")
|
"Value of `compilation-error-regexp-alist' in *vc-hg* buffers.")
|
||||||
|
|
|
||||||
|
|
@ -347,15 +347,17 @@
|
||||||
;; revision shown, rather than the working revision, which is normally
|
;; revision shown, rather than the working revision, which is normally
|
||||||
;; the case). Not all backends support this.
|
;; the case). Not all backends support this.
|
||||||
;;
|
;;
|
||||||
;; * log-outgoing (buffer remote-location)
|
;; - log-outgoing (buffer remote-location) (DEPRECATED)
|
||||||
;;
|
;;
|
||||||
;; Insert in BUFFER the revision log for the changes that will be
|
;; 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 REMOTE-LOCATION.
|
||||||
|
;; Deprecated: implement incoming-revision and mergebase instead.
|
||||||
;;
|
;;
|
||||||
;; * log-incoming (buffer remote-location)
|
;; - log-incoming (buffer remote-location) (DEPRECATED)
|
||||||
;;
|
;;
|
||||||
;; Insert in BUFFER the revision log for the changes that will be
|
;; 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 REMOTE-LOCATION.
|
||||||
|
;; Deprecated: implement incoming-revision and mergebase instead.
|
||||||
;;
|
;;
|
||||||
;; * incoming-revision (remote-location)
|
;; * incoming-revision (remote-location)
|
||||||
;;
|
;;
|
||||||
|
|
@ -3252,6 +3254,16 @@ In some version control systems REMOTE-LOCATION can be a remote branch name."
|
||||||
(vc-incoming-outgoing-internal backend (or remote-location "")
|
(vc-incoming-outgoing-internal backend (or remote-location "")
|
||||||
"*vc-incoming*" 'log-incoming)))
|
"*vc-incoming*" 'log-incoming)))
|
||||||
|
|
||||||
|
(defun vc-default-log-incoming (_backend buffer remote-location)
|
||||||
|
(vc--with-backend-in-rootdir ""
|
||||||
|
(let ((incoming (or (vc-call-backend backend
|
||||||
|
'incoming-revision
|
||||||
|
remote-location)
|
||||||
|
(user-error "No incoming revision -- local-only branch?"))))
|
||||||
|
(vc-call-backend backend 'print-log (list rootdir) buffer t
|
||||||
|
(vc-call-backend backend 'mergebase incoming)
|
||||||
|
incoming))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun vc-log-outgoing (&optional remote-location)
|
(defun vc-log-outgoing (&optional remote-location)
|
||||||
"Show log of changes that will be sent with a push operation to REMOTE-LOCATION.
|
"Show log of changes that will be sent with a push operation to REMOTE-LOCATION.
|
||||||
|
|
@ -3264,6 +3276,16 @@ In some version control systems REMOTE-LOCATION can be a remote branch name."
|
||||||
(vc-incoming-outgoing-internal backend (or remote-location "")
|
(vc-incoming-outgoing-internal backend (or remote-location "")
|
||||||
"*vc-outgoing*" 'log-outgoing)))
|
"*vc-outgoing*" 'log-outgoing)))
|
||||||
|
|
||||||
|
(defun vc-default-log-outgoing (_backend buffer remote-location)
|
||||||
|
(vc--with-backend-in-rootdir ""
|
||||||
|
(let ((incoming (or (vc-call-backend backend
|
||||||
|
'incoming-revision
|
||||||
|
remote-location)
|
||||||
|
(user-error "No incoming revision -- local-only branch?"))))
|
||||||
|
(vc-call-backend backend 'print-log (list rootdir) buffer t
|
||||||
|
(vc-call-backend backend 'mergebase incoming)
|
||||||
|
""))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun vc-log-search (pattern)
|
(defun vc-log-search (pattern)
|
||||||
"Search the VC log of changes for PATTERN and show log of matching changes.
|
"Search the VC log of changes for PATTERN and show log of matching changes.
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@
|
||||||
;; HISTORY FUNCTIONS
|
;; HISTORY FUNCTIONS
|
||||||
;;
|
;;
|
||||||
;; * print-log (files buffer &optional shortlog start-revision limit)
|
;; * print-log (files buffer &optional shortlog start-revision limit)
|
||||||
;; * log-outgoing (backend remote-location)
|
;; - log-outgoing (backend remote-location)
|
||||||
;; * log-incoming (backend remote-location)
|
;; - log-incoming (backend remote-location)
|
||||||
;; - log-view-mode ()
|
;; - log-view-mode ()
|
||||||
;; - show-log-entry (revision)
|
;; - show-log-entry (revision)
|
||||||
;; - comment-history (file)
|
;; - comment-history (file)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue