mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
Fix vc-pull from buffers visiting untracked files
* lisp/vc/vc.el (vc-pull): Don't fail when called from buffers visiting unregistered or ignored files so long as there is a 'pull' function available from the backend.
This commit is contained in:
parent
bc763572a9
commit
768c68942e
1 changed files with 19 additions and 7 deletions
|
|
@ -4668,13 +4668,25 @@ file, this simply replaces the work file with the latest revision
|
|||
on its branch. If the file contains changes, any changes in the
|
||||
tip revision are merged into the working file."
|
||||
(interactive "P")
|
||||
(let* ((vc-fileset (vc-deduce-fileset t))
|
||||
(backend (car vc-fileset))
|
||||
(files (cadr vc-fileset)))
|
||||
(let (backend files fn)
|
||||
(condition-case ret (vc-deduce-fileset 'not-state-changing)
|
||||
(error
|
||||
;; If `vc-deduce-fileset' failed then try again with
|
||||
;; ALLOW-UNREGISTERED non-nil, but in this case we require a
|
||||
;; `pull' function because that doesn't need a list of files.
|
||||
(unless
|
||||
(setq fn
|
||||
(and-let* ((fileset (vc-deduce-fileset 'not-state-changing
|
||||
'allow-unregistered)))
|
||||
(vc-find-backend-function (car fileset) 'pull)))
|
||||
(signal (car ret) (cdr ret))))
|
||||
(:success
|
||||
(setq backend (car ret) files (cadr ret)
|
||||
fn (vc-find-backend-function backend 'pull))))
|
||||
(cond
|
||||
;; If a pull operation is defined, use it.
|
||||
((vc-find-backend-function backend 'pull)
|
||||
(vc-call-backend backend 'pull arg)
|
||||
(fn
|
||||
(funcall fn arg)
|
||||
;; FIXME: Ideally we would only clear out the stored value for the
|
||||
;; REMOTE-LOCATION from which we are pulling.
|
||||
(vc-run-delayed
|
||||
|
|
@ -4687,14 +4699,14 @@ tip revision are merged into the working file."
|
|||
(let ((file (buffer-file-name)))
|
||||
(and file (member file files))))))
|
||||
(dolist (file files)
|
||||
(if (vc-up-to-date-p file)
|
||||
(if (vc-up-to-date-p file)
|
||||
(vc-checkout file t)
|
||||
(vc-maybe-resolve-conflicts
|
||||
file (vc-call-backend backend 'merge-news file)))))
|
||||
;; For a locking VCS, check out each file.
|
||||
((eq (vc-checkout-model backend files) 'locking)
|
||||
(dolist (file files)
|
||||
(if (vc-up-to-date-p file)
|
||||
(if (vc-up-to-date-p file)
|
||||
(vc-checkout file t))))
|
||||
(t
|
||||
(error "VC update is unsupported for `%s'" backend)))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue