mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Merge branch 'feature/package+vc'
This commit is contained in:
commit
5fa2f11679
11 changed files with 1146 additions and 78 deletions
|
|
@ -532,6 +532,12 @@ in the branch repository (or whose status not be determined)."
|
|||
(add-hook 'after-save-hook #'vc-bzr-resolve-when-done nil t)
|
||||
(vc-message-unresolved-conflicts buffer-file-name)))
|
||||
|
||||
(defun vc-bzr-clone (remote directory rev)
|
||||
(if rev
|
||||
(vc-bzr-command nil 0 '() "branch" "-r" rev remote directory)
|
||||
(vc-bzr-command nil 0 '() "branch" remote directory))
|
||||
directory)
|
||||
|
||||
(defun vc-bzr-version-dirstate (dir)
|
||||
"Try to return as a string the bzr revision ID of directory DIR.
|
||||
This uses the dirstate file's parent revision entry.
|
||||
|
|
|
|||
|
|
@ -1268,6 +1268,12 @@ This prompts for a branch to merge from."
|
|||
(add-hook 'after-save-hook #'vc-git-resolve-when-done nil 'local))
|
||||
(vc-message-unresolved-conflicts buffer-file-name)))
|
||||
|
||||
(defun vc-git-clone (remote directory rev)
|
||||
(if rev
|
||||
(vc-git--out-ok "clone" "--branch" rev remote directory)
|
||||
(vc-git--out-ok "clone" remote directory))
|
||||
directory)
|
||||
|
||||
;;; HISTORY FUNCTIONS
|
||||
|
||||
(autoload 'vc-setup-buffer "vc-dispatcher")
|
||||
|
|
@ -1626,6 +1632,19 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
|
|||
(expand-file-name fname (vc-git-root default-directory))))
|
||||
revision)))))
|
||||
|
||||
(defun vc-git-last-change (file line)
|
||||
(vc-buffer-sync)
|
||||
(let ((file (file-relative-name file (vc-git-root (buffer-file-name)))))
|
||||
(with-temp-buffer
|
||||
(when (vc-git--out-ok
|
||||
"blame" "--porcelain"
|
||||
(format "-L%d,+1" line)
|
||||
file)
|
||||
(goto-char (point-min))
|
||||
(save-match-data
|
||||
(when (looking-at "\\`\\([[:alnum:]]+\\)[[:space:]]+")
|
||||
(match-string 1)))))))
|
||||
|
||||
;;; TAG/BRANCH SYSTEM
|
||||
|
||||
(declare-function vc-read-revision "vc"
|
||||
|
|
|
|||
|
|
@ -1266,6 +1266,12 @@ REV is the revision to check out into WORKFILE."
|
|||
(add-hook 'after-save-hook #'vc-hg-resolve-when-done nil t)
|
||||
(vc-message-unresolved-conflicts buffer-file-name)))
|
||||
|
||||
(defun vc-hg-clone (remote directory rev)
|
||||
(if rev
|
||||
(vc-hg-command nil 0 '() "clone" "--rev" rev remote directory)
|
||||
(vc-hg-command nil 0 '() "clone" remote directory))
|
||||
|
||||
directory)
|
||||
|
||||
;; Modeled after the similar function in vc-bzr.el
|
||||
(defun vc-hg-revert (file &optional contents-done)
|
||||
|
|
|
|||
|
|
@ -817,6 +817,13 @@ Set file properties accordingly. If FILENAME is non-nil, return its status."
|
|||
"info" "--show-item" "repos-root-url")
|
||||
(buffer-substring-no-properties (point-min) (1- (point-max))))))
|
||||
|
||||
(defun vc-svn-clone (remote directory rev)
|
||||
(if rev
|
||||
(vc-svn-command nil 0 '() "checkout" "--revision" rev remote directory)
|
||||
(vc-svn-command nil 0 '() "checkout" remote directory))
|
||||
|
||||
(file-name-concat directory "trunk"))
|
||||
|
||||
(provide 'vc-svn)
|
||||
|
||||
;;; vc-svn.el ends here
|
||||
|
|
|
|||
|
|
@ -448,6 +448,11 @@
|
|||
;; - mergebase (rev1 &optional rev2)
|
||||
;;
|
||||
;; Return the common ancestor between REV1 and REV2 revisions.
|
||||
;;
|
||||
;; - last-change (file line)
|
||||
;;
|
||||
;; Return the most recent revision of FILE that made a change
|
||||
;; on LINE.
|
||||
|
||||
;; TAG/BRANCH SYSTEM
|
||||
;;
|
||||
|
|
@ -584,6 +589,15 @@
|
|||
;; buffer should be inserted into an inline patch. If the two last
|
||||
;; properties are omitted, `point-min' and `point-max' will
|
||||
;; respectively be used instead.
|
||||
;;
|
||||
;; - clone (remote directory rev)
|
||||
;;
|
||||
;; Attempt to clone a REMOTE repository, into a local DIRECTORY.
|
||||
;; Returns a string with the directory with the contents of the
|
||||
;; repository if successful, otherwise nil. With a non-nil value
|
||||
;; for REV the backend will attempt to check out a specific
|
||||
;; revision, if possible without first checking out the default
|
||||
;; branch.
|
||||
|
||||
;;; Changes from the pre-25.1 API:
|
||||
;;
|
||||
|
|
@ -3551,6 +3565,43 @@ to provide the `find-revision' operation instead."
|
|||
(interactive)
|
||||
(vc-call-backend (vc-backend buffer-file-name) 'check-headers))
|
||||
|
||||
(defun vc-clone (remote &optional backend directory rev)
|
||||
"Use BACKEND to clone REMOTE into DIRECTORY.
|
||||
If successful, returns the a string with the directory of the
|
||||
checkout. If BACKEND is nil, iterate through every known backend
|
||||
in `vc-handled-backends' until one succeeds. If REV is non-nil,
|
||||
it indicates a specific revision to check out."
|
||||
(unless directory
|
||||
(setq directory default-directory))
|
||||
(if backend
|
||||
(progn
|
||||
(unless (memq backend vc-handled-backends)
|
||||
(error "Unknown VC backend %s" backend))
|
||||
(vc-call-backend backend 'clone remote directory rev))
|
||||
(catch 'ok
|
||||
(dolist (backend vc-handled-backends)
|
||||
(ignore-error vc-not-supported
|
||||
(when-let ((res (vc-call-backend
|
||||
backend 'clone
|
||||
remote directory rev)))
|
||||
(throw 'ok res)))))))
|
||||
|
||||
(declare-function log-view-current-tag "log-view" (&optional pos))
|
||||
(defun vc-default-last-change (_backend file line)
|
||||
"Default `last-change' implementation.
|
||||
It returns the last revision that changed LINE number in FILE."
|
||||
(unless (file-exists-p file)
|
||||
(signal 'file-error "File doesn't exist"))
|
||||
(with-temp-buffer
|
||||
(vc-call-backend (vc-backend file) 'annotate-command
|
||||
file (current-buffer))
|
||||
(goto-char (point-min))
|
||||
(forward-line (1- line))
|
||||
(let ((rev (vc-call-backend
|
||||
(vc-backend file)
|
||||
'annotate-extract-revision-at-line)))
|
||||
(if (consp rev) (car rev) rev))))
|
||||
|
||||
|
||||
|
||||
;; These things should probably be generally available
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue