mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
New incoming-revision VC backend action
* lisp/vc/vc.el: New incoming-revision backend action (bug#62940). * lisp/vc/vc-git.el (vc-git--fetch-incoming): New function, factored out of vc-git-log-incoming. (vc-git-log-incoming): Use it. (vc-git-incoming-revision): * lisp/vc/vc-hg.el (vc-hg-incoming-revision): New functions.
This commit is contained in:
parent
f77c8c7d45
commit
59516a75eb
3 changed files with 43 additions and 12 deletions
|
|
@ -1581,29 +1581,41 @@ If LIMIT is a revision string, use it as an end-revision."
|
|||
,(format "--pretty=tformat:%s" (car vc-git-root-log-format))
|
||||
"--abbrev-commit"
|
||||
,@(ensure-list vc-git-shortlog-switches)
|
||||
,(concat (if (string= remote-location "")
|
||||
,(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"
|
||||
(and (not (string-empty-p remote-location))
|
||||
;; Extract remote from "remote/branch".
|
||||
(replace-regexp-in-string "/.*" ""
|
||||
remote-location))))
|
||||
|
||||
(defun vc-git-log-incoming (buffer remote-location)
|
||||
(vc-setup-buffer buffer)
|
||||
(vc-git-command nil 0 nil "fetch"
|
||||
(unless (string= remote-location "")
|
||||
;; `remote-location' is in format "repository/branch",
|
||||
;; so remove everything except a repository name.
|
||||
(replace-regexp-in-string
|
||||
"/.*" "" remote-location)))
|
||||
(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= remote-location "")
|
||||
,(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
|
||||
(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-log-search (buffer pattern)
|
||||
"Search the log of changes for PATTERN and output results into BUFFER.
|
||||
|
||||
|
|
|
|||
|
|
@ -1452,13 +1452,26 @@ This runs the command \"hg summary\"."
|
|||
|
||||
(defun vc-hg-log-incoming (buffer remote-location)
|
||||
(vc-setup-buffer buffer)
|
||||
(vc-hg-command buffer 1 nil "incoming" "-n" (unless (string= remote-location "")
|
||||
remote-location)))
|
||||
(vc-hg-command buffer 1 nil "incoming" "-n"
|
||||
(and (not (string-empty-p remote-location))
|
||||
remote-location)))
|
||||
|
||||
(defun vc-hg-incoming-revision (remote-location)
|
||||
(let ((output (with-output-to-string
|
||||
;; Exits 1 to mean nothing to pull.
|
||||
(vc-hg-command standard-output 1 nil
|
||||
"incoming" "-qn" "--limit=1"
|
||||
"--template={node}"
|
||||
(and (not (string-empty-p remote-location))
|
||||
remote-location)))))
|
||||
(and (not (string-empty-p output))
|
||||
output)))
|
||||
|
||||
(defun vc-hg-log-outgoing (buffer remote-location)
|
||||
(vc-setup-buffer buffer)
|
||||
(vc-hg-command buffer 1 nil "outgoing" "-n" (unless (string= remote-location "")
|
||||
remote-location)))
|
||||
(vc-hg-command buffer 1 nil "outgoing" "-n"
|
||||
(and (not (string-empty-p remote-location))
|
||||
remote-location)))
|
||||
|
||||
(defvar vc-hg-error-regexp-alist
|
||||
'(("^M \\(.+\\)" 1 nil nil 0))
|
||||
|
|
|
|||
|
|
@ -357,6 +357,12 @@
|
|||
;; Insert in BUFFER the revision log for the changes that will be
|
||||
;; received when performing a pull operation from REMOTE-LOCATION.
|
||||
;;
|
||||
;; * incoming-revision (remote-location)
|
||||
;;
|
||||
;; 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.)
|
||||
;;
|
||||
;; - log-search (buffer pattern)
|
||||
;;
|
||||
;; Search for PATTERN in the revision log and output results into BUFFER.
|
||||
|
|
|
|||
Loading…
Reference in a new issue