Terminate vc-disable-async-diff with extreme prejudice.
* vc/vc.el, and all backends: API cleanup; the backend diff method takes an explicit async flag. This eliminates a particularly ugly global.
This commit is contained in:
parent
4f54f7b376
commit
ed6ce56e23
13 changed files with 59 additions and 49 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2014-12-01 Eric S. Raymond <esr@snark.thyrsus.com>
|
||||||
|
|
||||||
|
* vc/vc.el, and all backends: API cleanup; the backend diff method
|
||||||
|
takes an explicit async flag. This eliminates a particularly ugly
|
||||||
|
global.
|
||||||
|
|
||||||
2014-12-01 Stefan Monnier <monnier@iro.umontreal.ca>
|
2014-12-01 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
Merge some of the differences from the standalone CC-mode.
|
Merge some of the differences from the standalone CC-mode.
|
||||||
|
|
|
@ -447,7 +447,7 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
|
||||||
(vc-arch-command nil 0 files "commit" "-s" summary "-L" comment "--"
|
(vc-arch-command nil 0 files "commit" "-s" summary "-L" comment "--"
|
||||||
(vc-switches 'Arch 'checkin))))
|
(vc-switches 'Arch 'checkin))))
|
||||||
|
|
||||||
(defun vc-arch-diff (files &optional oldvers newvers buffer)
|
(defun vc-arch-diff (files &optional async oldvers newvers buffer)
|
||||||
"Get a difference report using Arch between two versions of FILES."
|
"Get a difference report using Arch between two versions of FILES."
|
||||||
;; FIXME: This implementation only works for singleton filesets. To make
|
;; FIXME: This implementation only works for singleton filesets. To make
|
||||||
;; it work for more cases, we have to either call `file-diffs' manually on
|
;; it work for more cases, we have to either call `file-diffs' manually on
|
||||||
|
@ -464,7 +464,6 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
|
||||||
(if newvers
|
(if newvers
|
||||||
(error "Diffing specific revisions not implemented")
|
(error "Diffing specific revisions not implemented")
|
||||||
(let* (process-file-side-effects
|
(let* (process-file-side-effects
|
||||||
(async (not vc-disable-async-diff))
|
|
||||||
;; Run the command from the root dir.
|
;; Run the command from the root dir.
|
||||||
(default-directory (vc-arch-root file))
|
(default-directory (vc-arch-root file))
|
||||||
(status
|
(status
|
||||||
|
|
|
@ -779,7 +779,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
|
|
||||||
(autoload 'vc-switches "vc")
|
(autoload 'vc-switches "vc")
|
||||||
|
|
||||||
(defun vc-bzr-diff (files &optional rev1 rev2 buffer)
|
(defun vc-bzr-diff (files &optional async rev1 rev2 buffer)
|
||||||
"VC bzr backend for diff."
|
"VC bzr backend for diff."
|
||||||
(let* ((switches (vc-switches 'bzr 'diff))
|
(let* ((switches (vc-switches 'bzr 'diff))
|
||||||
(args
|
(args
|
||||||
|
@ -795,7 +795,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
(or rev2 "")))))))
|
(or rev2 "")))))))
|
||||||
;; `bzr diff' exits with code 1 if diff is non-empty.
|
;; `bzr diff' exits with code 1 if diff is non-empty.
|
||||||
(apply #'vc-bzr-command "diff" (or buffer "*vc-diff*")
|
(apply #'vc-bzr-command "diff" (or buffer "*vc-diff*")
|
||||||
(if vc-disable-async-diff 1 'async) files
|
(if async 1 'async) files
|
||||||
args)))
|
args)))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -569,11 +569,10 @@ Remaining arguments are ignored."
|
||||||
(autoload 'vc-version-backup-file "vc")
|
(autoload 'vc-version-backup-file "vc")
|
||||||
(declare-function vc-coding-system-for-diff "vc" (file))
|
(declare-function vc-coding-system-for-diff "vc" (file))
|
||||||
|
|
||||||
(defun vc-cvs-diff (files &optional oldvers newvers buffer)
|
(defun vc-cvs-diff (files &optional async oldvers newvers buffer)
|
||||||
"Get a difference report using CVS between two revisions of FILE."
|
"Get a difference report using CVS between two revisions of FILE."
|
||||||
(let* (process-file-side-effects
|
(let* (process-file-side-effects
|
||||||
(async (and (not vc-disable-async-diff)
|
(async (and async (vc-cvs-stay-local-p files)))
|
||||||
(vc-cvs-stay-local-p files)))
|
|
||||||
(invoke-cvs-diff-list nil)
|
(invoke-cvs-diff-list nil)
|
||||||
status)
|
status)
|
||||||
;; Look through the file list and see if any files have backups
|
;; Look through the file list and see if any files have backups
|
||||||
|
|
|
@ -117,7 +117,7 @@ only needs to update the status of URL within the backend.
|
||||||
"Insert the revision log of URL into the *vc* buffer."
|
"Insert the revision log of URL into the *vc* buffer."
|
||||||
)
|
)
|
||||||
|
|
||||||
(defun vc-dav-diff (url &optional rev1 rev2)
|
(defun vc-dav-diff (url &optional async rev1 rev2)
|
||||||
"Insert the diff for URL into the *vc-diff* buffer.
|
"Insert the diff for URL into the *vc-diff* buffer.
|
||||||
If REV1 and REV2 are non-nil report differences from REV1 to REV2.
|
If REV1 and REV2 are non-nil report differences from REV1 to REV2.
|
||||||
If REV1 is nil, use the current workfile version as the older version.
|
If REV1 is nil, use the current workfile version as the older version.
|
||||||
|
|
|
@ -984,11 +984,13 @@ or BRANCH^ (where \"^\" can be repeated)."
|
||||||
|
|
||||||
(autoload 'vc-switches "vc")
|
(autoload 'vc-switches "vc")
|
||||||
|
|
||||||
(defun vc-git-diff (files &optional rev1 rev2 buffer)
|
(defun vc-git-diff (files &optional async rev1 rev2 buffer)
|
||||||
"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)
|
||||||
(if vc-git-diff-switches
|
(if vc-git-diff-switches
|
||||||
(apply #'vc-git-command (or buffer "*vc-diff*") 1 files
|
(apply #'vc-git-command (or buffer "*vc-diff*")
|
||||||
|
(if async 'async 1)
|
||||||
|
files
|
||||||
(if (and rev1 rev2) "diff-tree" "diff-index")
|
(if (and rev1 rev2) "diff-tree" "diff-index")
|
||||||
"--exit-code"
|
"--exit-code"
|
||||||
(append (vc-switches 'git 'diff)
|
(append (vc-switches 'git 'diff)
|
||||||
|
|
|
@ -316,7 +316,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
|
|
||||||
(autoload 'vc-switches "vc")
|
(autoload 'vc-switches "vc")
|
||||||
|
|
||||||
(defun vc-hg-diff (files &optional oldvers newvers buffer)
|
(defun vc-hg-diff (files &optional async oldvers newvers buffer)
|
||||||
"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))))
|
||||||
|
@ -324,7 +324,10 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
(setq oldvers nil))
|
(setq oldvers nil))
|
||||||
(when (and (not oldvers) newvers)
|
(when (and (not oldvers) newvers)
|
||||||
(setq oldvers working))
|
(setq oldvers working))
|
||||||
(apply #'vc-hg-command (or buffer "*vc-diff*") nil files "diff"
|
(apply #'vc-hg-command
|
||||||
|
(or buffer "*vc-diff*")
|
||||||
|
(if async 'async nil)
|
||||||
|
files "diff"
|
||||||
(append
|
(append
|
||||||
(vc-switches 'hg 'diff)
|
(vc-switches 'hg 'diff)
|
||||||
(when oldvers
|
(when oldvers
|
||||||
|
|
|
@ -238,9 +238,11 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
|
|
||||||
(autoload 'vc-switches "vc")
|
(autoload 'vc-switches "vc")
|
||||||
|
|
||||||
(defun vc-mtn-diff (files &optional rev1 rev2 buffer)
|
(defun vc-mtn-diff (files &optional async rev1 rev2 buffer)
|
||||||
"Get a difference report using monotone between two revisions of FILES."
|
"Get a difference report using monotone between two revisions of FILES."
|
||||||
(apply 'vc-mtn-command (or buffer "*vc-diff*") 1 files "diff"
|
(apply 'vc-mtn-command (or buffer "*vc-diff*")
|
||||||
|
(if async 'async 1)
|
||||||
|
files "diff"
|
||||||
(append
|
(append
|
||||||
(vc-switches 'mtn 'diff)
|
(vc-switches 'mtn 'diff)
|
||||||
(if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2)))))
|
(if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2)))))
|
||||||
|
|
|
@ -565,10 +565,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)
|
(defun vc-rcs-diff (files &optional async oldvers newvers buffer)
|
||||||
"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*")
|
||||||
1 ;; Always go synchronous, the repo is local
|
(if async 'async 1)
|
||||||
"rcsdiff" (vc-expand-dirs files)
|
"rcsdiff" (vc-expand-dirs files)
|
||||||
(append (list "-q"
|
(append (list "-q"
|
||||||
(and oldvers (concat "-r" oldvers))
|
(and oldvers (concat "-r" oldvers))
|
||||||
|
|
|
@ -342,7 +342,7 @@ Remaining arguments are ignored."
|
||||||
(defvar w32-quote-process-args)
|
(defvar w32-quote-process-args)
|
||||||
|
|
||||||
;; FIXME use sccsdiff if present?
|
;; FIXME use sccsdiff if present?
|
||||||
(defun vc-sccs-diff (files &optional oldvers newvers buffer)
|
(defun vc-sccs-diff (files &optional _async oldvers newvers buffer)
|
||||||
"Get a difference report using SCCS between two filesets."
|
"Get a difference report using SCCS between two filesets."
|
||||||
(setq files (vc-expand-dirs files))
|
(setq files (vc-expand-dirs files))
|
||||||
(setq oldvers (vc-sccs-lookup-triple (car files) oldvers))
|
(setq oldvers (vc-sccs-lookup-triple (car files) oldvers))
|
||||||
|
|
|
@ -295,7 +295,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
(when limit (list "-l" (format "%s" limit)))
|
(when limit (list "-l" (format "%s" limit)))
|
||||||
vc-src-log-switches)))))
|
vc-src-log-switches)))))
|
||||||
|
|
||||||
(defun vc-src-diff (files &optional oldvers newvers buffer)
|
(defun vc-src-diff (files &optional _async oldvers newvers buffer)
|
||||||
"Get a difference report using src between two revisions of FILES."
|
"Get a difference report using src 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))))
|
||||||
|
|
|
@ -573,8 +573,7 @@ If LIMIT is non-nil, show no more than this many entries."
|
||||||
(vc-switches 'SVN 'diff)
|
(vc-switches 'SVN 'diff)
|
||||||
(list (concat "--diff-cmd=" diff-command) "-x"
|
(list (concat "--diff-cmd=" diff-command) "-x"
|
||||||
(mapconcat 'identity (vc-switches nil 'diff) " "))))
|
(mapconcat 'identity (vc-switches nil 'diff) " "))))
|
||||||
(async (and (not vc-disable-async-diff)
|
(async (or oldvers newvers))) ; Svn diffs those locally.
|
||||||
(or oldvers newvers)))) ; Svn diffs those locally.
|
|
||||||
(apply 'vc-svn-command buffer
|
(apply 'vc-svn-command buffer
|
||||||
(if async 'async 0)
|
(if async 'async 0)
|
||||||
files "diff"
|
files "diff"
|
||||||
|
|
|
@ -382,17 +382,19 @@
|
||||||
;; default implementation runs rcs2log, which handles RCS- and
|
;; default implementation runs rcs2log, which handles RCS- and
|
||||||
;; CVS-style logs.
|
;; CVS-style logs.
|
||||||
;;
|
;;
|
||||||
;; * diff (files &optional rev1 rev2 buffer)
|
;; * diff (files &optional async rev1 rev2 buffer)
|
||||||
;;
|
;;
|
||||||
;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if
|
;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if
|
||||||
;; BUFFER is nil. If REV1 and REV2 are non-nil, report differences
|
;; BUFFER is nil. If ASYNC is non-nil, run asynchronously.If REV1
|
||||||
;; from REV1 to REV2. If REV1 is nil, use the working revision (as
|
;; and REV2 are non-nil, report differences from REV1 to REV2. If
|
||||||
;; found in the repository) as the older revision; if REV2 is nil,
|
;; REV1 is nil, use the working revision (as found in the
|
||||||
;; use the current working-copy contents as the newer revision. This
|
;; repository) as the older revision; if REV2 is nil, use the
|
||||||
|
;; current working-copy contents as the newer revision. This
|
||||||
;; function should pass the value of (vc-switches BACKEND 'diff) to
|
;; function should pass the value of (vc-switches BACKEND 'diff) to
|
||||||
;; the backend command. It should return a status of either 0 (no
|
;; the backend command. It should return a status of either 0 (no
|
||||||
;; differences found), or 1 (either non-empty diff or the diff is
|
;; differences found), or 1 (either non-empty diff or the diff is
|
||||||
;; run asynchronously).
|
;; run asynchronously).
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; - revision-completion-table (files)
|
;; - revision-completion-table (files)
|
||||||
;;
|
;;
|
||||||
|
@ -569,10 +571,25 @@
|
||||||
|
|
||||||
;;; Changes from the pre-25.1 API:
|
;;; Changes from the pre-25.1 API:
|
||||||
;;
|
;;
|
||||||
;; - The 'editable' optional argument of vc-checkout is gone. The
|
;; - INCOMPATIBLE CHANGE: The 'editable' optional argument of
|
||||||
;; upper level assumes that all files are checked out editable. This
|
;; vc-checkout is gone. The upper level assumes that all files are
|
||||||
;; moves closer to emulating modern non-locking behavior even on very
|
;; checked out editable. This moves closer to emulating modern
|
||||||
;; old VCSes.
|
;; non-locking behavior even on very old VCSes.
|
||||||
|
;;
|
||||||
|
;; - INCOMPATIBLE CHANGE: The vc-register function and its backend
|
||||||
|
;; implementations no longer take a first optional revision
|
||||||
|
;; argument, since on no system since RCS has setting the initial
|
||||||
|
;; revision been even possible, let alone sane.
|
||||||
|
;;
|
||||||
|
;; INCOMPATIBLE CHANGE: In older versions of the API, vc-diff did
|
||||||
|
;; not take an async-mode flag as a first optional argument. (This
|
||||||
|
;; change eliminated a particularly ugly global.)
|
||||||
|
;;
|
||||||
|
;; - INCOMPATIBLE CHANGE: The backend operation for non-distributed
|
||||||
|
;; VCSes formerly called "merge" is now "merge-file" (to contrast
|
||||||
|
;; with merge-branch), and does its own prompting for revisions.
|
||||||
|
;; (This fixes a layer violation that produced bad behavior under
|
||||||
|
;; SVN.)
|
||||||
;;
|
;;
|
||||||
;; - vc-state-heuristic is no longer a public method (the CVS backend
|
;; - vc-state-heuristic is no longer a public method (the CVS backend
|
||||||
;; retains it as a private one).
|
;; retains it as a private one).
|
||||||
|
@ -590,20 +607,11 @@
|
||||||
;; variable are gone. These have't made sense on anything shipped
|
;; variable are gone. These have't made sense on anything shipped
|
||||||
;; since RCS, and using them was a dumb stunt even on RCS.
|
;; since RCS, and using them was a dumb stunt even on RCS.
|
||||||
;;
|
;;
|
||||||
;; - The vc-register function and its backend implementations no longer
|
|
||||||
;; take a first optional revision argument, since on no system since
|
|
||||||
;; RCS has setting the initial revision been even possible, let alone
|
|
||||||
;; sane.
|
|
||||||
;;
|
|
||||||
;; - The backend operation for non-distributed VCSes formerly called
|
|
||||||
;; "merge" is now "merge-file" (to contrast with merge-branch), and
|
|
||||||
;; does its own prompting for revisions. (This fixes a layer violation
|
|
||||||
;; that produced bad behavior under SVN.)
|
|
||||||
;;
|
|
||||||
;; workfile-unchanged-p is no longer a public back-end method. It
|
;; workfile-unchanged-p is no longer a public back-end method. It
|
||||||
;; was redundant with vc-state and usually implemented with a trivial
|
;; was redundant with vc-state and usually implemented with a trivial
|
||||||
;; call to it. A few older back ends retain versions for internal use in
|
;; call to it. A few older back ends retain versions for internal use in
|
||||||
;; their vc-state functions.
|
;; their vc-state functions.
|
||||||
|
;;
|
||||||
|
|
||||||
;;; Todo:
|
;;; Todo:
|
||||||
|
|
||||||
|
@ -865,13 +873,6 @@ is sensitive to blank lines."
|
||||||
:group 'vc)
|
:group 'vc)
|
||||||
|
|
||||||
|
|
||||||
;; Variables users don't need to see
|
|
||||||
|
|
||||||
(defvar vc-disable-async-diff nil
|
|
||||||
"VC sets this to t locally to disable some async diff operations.
|
|
||||||
Backends that offer asynchronous diffs should respect this variable
|
|
||||||
in their implementation of vc-BACKEND-diff.")
|
|
||||||
|
|
||||||
;; File property caching
|
;; File property caching
|
||||||
|
|
||||||
(defun vc-clear-context ()
|
(defun vc-clear-context ()
|
||||||
|
@ -1717,11 +1718,10 @@ Return t if the buffer had changes, nil otherwise."
|
||||||
;; We regard this as "changed".
|
;; We regard this as "changed".
|
||||||
;; Diff it against /dev/null.
|
;; Diff it against /dev/null.
|
||||||
(apply 'vc-do-command buffer
|
(apply 'vc-do-command buffer
|
||||||
1 "diff" file
|
(async 'async 1) "diff" file
|
||||||
(append (vc-switches nil 'diff) '("/dev/null"))))))
|
(append (vc-switches nil 'diff) '("/dev/null"))))))
|
||||||
(setq files (nreverse filtered))))
|
(setq files (nreverse filtered))))
|
||||||
(let ((vc-disable-async-diff (not async)))
|
(vc-call-backend (car vc-fileset) 'diff files async rev1 rev2 buffer)
|
||||||
(vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer))
|
|
||||||
(set-buffer buffer)
|
(set-buffer buffer)
|
||||||
(diff-mode)
|
(diff-mode)
|
||||||
(set (make-local-variable 'diff-vc-backend) (car vc-fileset))
|
(set (make-local-variable 'diff-vc-backend) (car vc-fileset))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue