mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
New user option: vc-allow-async-diff
Centralize the control for whether 'vc-diff' is asynchronous across the backends, while also allowing 'vc-BACKEND-diff' to be called asynchronously when needed. Previously in bug#21969. * lisp/vc/vc.el (vc-allow-async-diff): New user option. * lisp/vc/vc.el (vc-version-diff, vc-diff, vc-diff-mergebase) (vc-root-diff): Obey it. * lisp/vc/log-view.el (log-view-diff-common): Same. * lisp/vc/vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal): Same. * lisp/vc/vc-git.el (vc-git-diff): Follow the ASYNC argument. * lisp/vc/vc-hg.el (vc-hg-diff): Same. * lisp/vc/vc-rcs.el (vc-rcs-diff): Same.
This commit is contained in:
parent
76f422da26
commit
bec823b107
6 changed files with 34 additions and 23 deletions
|
|
@ -637,6 +637,7 @@ considered file(s)."
|
||||||
(log-view-diff-common beg end t)))
|
(log-view-diff-common beg end t)))
|
||||||
|
|
||||||
(defun log-view-diff-common (beg end &optional whole-changeset)
|
(defun log-view-diff-common (beg end &optional whole-changeset)
|
||||||
|
(defvar vc-allow-async-diff)
|
||||||
(let* ((to (log-view-current-tag beg))
|
(let* ((to (log-view-current-tag beg))
|
||||||
(fr-entry (log-view-current-entry end))
|
(fr-entry (log-view-current-entry end))
|
||||||
(fr (cadr fr-entry)))
|
(fr (cadr fr-entry)))
|
||||||
|
|
@ -650,7 +651,8 @@ considered file(s)."
|
||||||
(point))))
|
(point))))
|
||||||
(setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
|
(setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
|
||||||
(vc-diff-internal
|
(vc-diff-internal
|
||||||
t (list log-view-vc-backend
|
vc-allow-async-diff
|
||||||
|
(list log-view-vc-backend
|
||||||
;; The value passed here should follow what
|
;; The value passed here should follow what
|
||||||
;; `vc-deduce-fileset' returns. If we want to see the
|
;; `vc-deduce-fileset' returns. If we want to see the
|
||||||
;; diff for all the files in the changeset, pass NIL for
|
;; diff for all the files in the changeset, pass NIL for
|
||||||
|
|
|
||||||
|
|
@ -594,6 +594,7 @@ the file in question, search for the log entry required and move point."
|
||||||
(car rev-at-line) t 1)))))))
|
(car rev-at-line) t 1)))))))
|
||||||
|
|
||||||
(defun vc-annotate-show-diff-revision-at-line-internal (filediff)
|
(defun vc-annotate-show-diff-revision-at-line-internal (filediff)
|
||||||
|
(defvar vc-allow-async-diff)
|
||||||
(if (not (derived-mode-p 'vc-annotate-mode))
|
(if (not (derived-mode-p 'vc-annotate-mode))
|
||||||
(message "Cannot be invoked outside of a vc annotate buffer")
|
(message "Cannot be invoked outside of a vc annotate buffer")
|
||||||
(let* ((rev-at-line (vc-annotate-extract-revision-at-line))
|
(let* ((rev-at-line (vc-annotate-extract-revision-at-line))
|
||||||
|
|
@ -606,7 +607,7 @@ the file in question, search for the log entry required and move point."
|
||||||
(vc-call-backend vc-annotate-backend 'previous-revision
|
(vc-call-backend vc-annotate-backend 'previous-revision
|
||||||
(if filediff fname nil) rev))
|
(if filediff fname nil) rev))
|
||||||
(vc-diff-internal
|
(vc-diff-internal
|
||||||
t
|
vc-allow-async-diff
|
||||||
;; The value passed here should follow what
|
;; The value passed here should follow what
|
||||||
;; `vc-deduce-fileset' returns.
|
;; `vc-deduce-fileset' returns.
|
||||||
(list vc-annotate-backend
|
(list vc-annotate-backend
|
||||||
|
|
|
||||||
|
|
@ -1805,7 +1805,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
|
||||||
samp coding-system-for-read t)))
|
samp coding-system-for-read t)))
|
||||||
(setq coding-system-for-read 'undecided)))
|
(setq coding-system-for-read 'undecided)))
|
||||||
|
|
||||||
(defun vc-git-diff (files &optional rev1 rev2 buffer _async)
|
(defun vc-git-diff (files &optional rev1 rev2 buffer async)
|
||||||
"Get a difference report using Git between two revisions of FILES."
|
"Get a difference report using Git between two revisions of FILES."
|
||||||
(let (process-file-side-effects
|
(let (process-file-side-effects
|
||||||
(command "diff-tree"))
|
(command "diff-tree"))
|
||||||
|
|
@ -1817,7 +1817,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
|
||||||
(unless rev1 (setq rev1 "HEAD")))
|
(unless rev1 (setq rev1 "HEAD")))
|
||||||
(if vc-git-diff-switches
|
(if vc-git-diff-switches
|
||||||
(apply #'vc-git-command (or buffer "*vc-diff*")
|
(apply #'vc-git-command (or buffer "*vc-diff*")
|
||||||
1 ; bug#21969
|
(if async 'async 1)
|
||||||
files
|
files
|
||||||
command
|
command
|
||||||
"--exit-code"
|
"--exit-code"
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,7 @@ This requires hg 4.4 or later, for the \"-L\" option of \"hg log\"."
|
||||||
(cons 'vc-hg-region-history-font-lock-keywords
|
(cons 'vc-hg-region-history-font-lock-keywords
|
||||||
(cdr font-lock-defaults))))
|
(cdr font-lock-defaults))))
|
||||||
|
|
||||||
(defun vc-hg-diff (files &optional oldvers newvers buffer _async)
|
(defun vc-hg-diff (files &optional oldvers newvers buffer async)
|
||||||
"Get a difference report using hg between two revisions of FILES."
|
"Get a difference report using hg between two revisions of FILES."
|
||||||
(let* ((firstfile (car files))
|
(let* ((firstfile (car files))
|
||||||
(working (and firstfile (vc-working-revision firstfile))))
|
(working (and firstfile (vc-working-revision firstfile))))
|
||||||
|
|
@ -535,7 +535,7 @@ This requires hg 4.4 or later, for the \"-L\" option of \"hg log\"."
|
||||||
(setq oldvers working))
|
(setq oldvers working))
|
||||||
(apply #'vc-hg-command
|
(apply #'vc-hg-command
|
||||||
(or buffer "*vc-diff*")
|
(or buffer "*vc-diff*")
|
||||||
nil ; bug#21969
|
(if async 'async 1)
|
||||||
files "diff"
|
files "diff"
|
||||||
(append
|
(append
|
||||||
(vc-switches 'hg 'diff)
|
(vc-switches 'hg 'diff)
|
||||||
|
|
|
||||||
|
|
@ -554,11 +554,10 @@ files beneath it."
|
||||||
(vc-rcs-print-log-cleanup))
|
(vc-rcs-print-log-cleanup))
|
||||||
(when limit 'limit-unsupported))
|
(when limit 'limit-unsupported))
|
||||||
|
|
||||||
(defun vc-rcs-diff (files &optional oldvers newvers buffer _async)
|
(defun vc-rcs-diff (files &optional oldvers newvers buffer async)
|
||||||
"Get a difference report using RCS between two sets of files."
|
"Get a difference report using RCS between two sets of files."
|
||||||
(apply #'vc-do-command (or buffer "*vc-diff*")
|
(apply #'vc-do-command (or buffer "*vc-diff*")
|
||||||
;; The repo is local, so this is fast anyway.
|
(if async 'async 1)
|
||||||
1 ; bug#21969
|
|
||||||
"rcsdiff" (vc-expand-dirs files 'RCS)
|
"rcsdiff" (vc-expand-dirs files 'RCS)
|
||||||
(append (list "-q"
|
(append (list "-q"
|
||||||
(and oldvers (concat "-r" oldvers))
|
(and oldvers (concat "-r" oldvers))
|
||||||
|
|
|
||||||
|
|
@ -876,6 +876,14 @@ if the local changes in the file have not been found and displayed yet."
|
||||||
(const :tag "Yes" t))
|
(const :tag "Yes" t))
|
||||||
:version "22.1")
|
:version "22.1")
|
||||||
|
|
||||||
|
(defcustom vc-allow-async-diff nil
|
||||||
|
"Non-nil to allow asynchronous diff process.
|
||||||
|
Enabling this means the buffer will be displayed before the diff is
|
||||||
|
generated, and so might only say \"No changes ...\"."
|
||||||
|
:type '(choice (const :tag "No" nil)
|
||||||
|
(const :tag "Yes" t))
|
||||||
|
:version "31.1")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defcustom vc-checkout-hook nil
|
(defcustom vc-checkout-hook nil
|
||||||
"Normal hook (list of functions) run after checking out a file.
|
"Normal hook (list of functions) run after checking out a file.
|
||||||
|
|
@ -2352,7 +2360,7 @@ state of each file in the fileset."
|
||||||
(error "Not a valid revision range"))
|
(error "Not a valid revision range"))
|
||||||
;; Yes, it's painful to call (vc-deduce-fileset) again. Alas, the
|
;; Yes, it's painful to call (vc-deduce-fileset) again. Alas, the
|
||||||
;; placement rules for (interactive) don't actually leave us a choice.
|
;; placement rules for (interactive) don't actually leave us a choice.
|
||||||
(vc-diff-internal t (vc-deduce-fileset t) rev1 rev2
|
(vc-diff-internal vc-allow-async-diff (vc-deduce-fileset t) rev1 rev2
|
||||||
(called-interactively-p 'interactive)))
|
(called-interactively-p 'interactive)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
@ -2367,7 +2375,7 @@ state of each file in the fileset."
|
||||||
(error "Not a valid revision range"))
|
(error "Not a valid revision range"))
|
||||||
(vc--with-backend-in-rootdir "VC root-diff"
|
(vc--with-backend-in-rootdir "VC root-diff"
|
||||||
(let ((default-directory rootdir))
|
(let ((default-directory rootdir))
|
||||||
(vc-diff-internal t (list backend (list rootdir)) rev1 rev2
|
(vc-diff-internal vc-allow-async-diff (list backend (list rootdir)) rev1 rev2
|
||||||
(called-interactively-p 'interactive)))))
|
(called-interactively-p 'interactive)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
@ -2385,7 +2393,7 @@ Optional argument FILESET, if non-nil, overrides the fileset."
|
||||||
(call-interactively 'vc-version-diff)
|
(call-interactively 'vc-version-diff)
|
||||||
(let ((fileset (or fileset (vc-deduce-fileset t))))
|
(let ((fileset (or fileset (vc-deduce-fileset t))))
|
||||||
(vc-buffer-sync-fileset fileset not-essential)
|
(vc-buffer-sync-fileset fileset not-essential)
|
||||||
(vc-diff-internal t fileset nil nil
|
(vc-diff-internal vc-allow-async-diff fileset nil nil
|
||||||
(called-interactively-p 'interactive)))))
|
(called-interactively-p 'interactive)))))
|
||||||
|
|
||||||
(defun vc-buffer-sync-fileset (fileset &optional not-essential missing-in-dirs)
|
(defun vc-buffer-sync-fileset (fileset &optional not-essential missing-in-dirs)
|
||||||
|
|
@ -2437,7 +2445,8 @@ The merge base is a common ancestor between REV1 and REV2 revisions."
|
||||||
(vc--with-backend-in-rootdir "VC root-diff"
|
(vc--with-backend-in-rootdir "VC root-diff"
|
||||||
(let ((default-directory rootdir)
|
(let ((default-directory rootdir)
|
||||||
(rev1 (vc-call-backend backend 'mergebase rev1 rev2)))
|
(rev1 (vc-call-backend backend 'mergebase rev1 rev2)))
|
||||||
(vc-diff-internal t (list backend (list rootdir)) rev1 rev2
|
(vc-diff-internal
|
||||||
|
vc-allow-async-diff (list backend (list rootdir)) rev1 rev2
|
||||||
(called-interactively-p 'interactive)))))
|
(called-interactively-p 'interactive)))))
|
||||||
|
|
||||||
(declare-function ediff-load-version-control "ediff" (&optional silent))
|
(declare-function ediff-load-version-control "ediff" (&optional silent))
|
||||||
|
|
@ -2514,7 +2523,7 @@ saving the buffer."
|
||||||
(let ((default-directory rootdir)
|
(let ((default-directory rootdir)
|
||||||
(fileset `(,backend (,rootdir))))
|
(fileset `(,backend (,rootdir))))
|
||||||
(vc-buffer-sync-fileset fileset not-essential)
|
(vc-buffer-sync-fileset fileset not-essential)
|
||||||
(vc-diff-internal t fileset nil nil
|
(vc-diff-internal vc-allow-async-diff fileset nil nil
|
||||||
(called-interactively-p 'interactive))))))
|
(called-interactively-p 'interactive))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue