Commit ed6ce56e authored by Eric S. Raymond's avatar Eric S. Raymond

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.
parent 4f54f7b3
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>
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-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."
;; FIXME: This implementation only works for singleton filesets. To make
;; 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
(error "Diffing specific revisions not implemented")
(let* (process-file-side-effects
(async (not vc-disable-async-diff))
;; Run the command from the root dir.
(default-directory (vc-arch-root file))
(status
......
......@@ -779,7 +779,7 @@ If LIMIT is non-nil, show no more than this many entries."
(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."
(let* ((switches (vc-switches 'bzr 'diff))
(args
......@@ -795,7 +795,7 @@ If LIMIT is non-nil, show no more than this many entries."
(or rev2 "")))))))
;; `bzr diff' exits with code 1 if diff is non-empty.
(apply #'vc-bzr-command "diff" (or buffer "*vc-diff*")
(if vc-disable-async-diff 1 'async) files
(if async 1 'async) files
args)))
......
......@@ -569,11 +569,10 @@ Remaining arguments are ignored."
(autoload 'vc-version-backup-file "vc")
(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."
(let* (process-file-side-effects
(async (and (not vc-disable-async-diff)
(vc-cvs-stay-local-p files)))
(async (and async (vc-cvs-stay-local-p files)))
(invoke-cvs-diff-list nil)
status)
;; 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."
)
(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.
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.
......
......@@ -984,11 +984,13 @@ or BRANCH^ (where \"^\" can be repeated)."
(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."
(let (process-file-side-effects)
(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")
"--exit-code"
(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")
(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."
(let* ((firstfile (car files))
(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))
(when (and (not oldvers) newvers)
(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
(vc-switches 'hg 'diff)
(when oldvers
......
......@@ -238,9 +238,11 @@ If LIMIT is non-nil, show no more than this many entries."
(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."
(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
(vc-switches 'mtn 'diff)
(if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2)))))
......
......@@ -565,10 +565,10 @@ files beneath it."
(vc-rcs-print-log-cleanup))
(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."
(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)
(append (list "-q"
(and oldvers (concat "-r" oldvers))
......
......@@ -342,7 +342,7 @@ Remaining arguments are ignored."
(defvar w32-quote-process-args)
;; 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."
(setq files (vc-expand-dirs files))
(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)))
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."
(let* ((firstfile (car files))
(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)
(list (concat "--diff-cmd=" diff-command) "-x"
(mapconcat 'identity (vc-switches nil 'diff) " "))))
(async (and (not vc-disable-async-diff)
(or oldvers newvers)))) ; Svn diffs those locally.
(async (or oldvers newvers))) ; Svn diffs those locally.
(apply 'vc-svn-command buffer
(if async 'async 0)
files "diff"
......
......@@ -382,17 +382,19 @@
;; default implementation runs rcs2log, which handles RCS- and
;; 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
;; BUFFER is nil. If REV1 and REV2 are non-nil, report differences
;; from REV1 to REV2. If REV1 is nil, use the working revision (as
;; found in the repository) as the older revision; if REV2 is nil,
;; use the current working-copy contents as the newer revision. This
;; BUFFER is nil. If ASYNC is non-nil, run asynchronously.If REV1
;; and REV2 are non-nil, report differences from REV1 to REV2. If
;; REV1 is nil, use the working revision (as found in the
;; 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
;; the backend command. It should return a status of either 0 (no
;; differences found), or 1 (either non-empty diff or the diff is
;; run asynchronously).
;;
;; - revision-completion-table (files)
;;
......@@ -569,10 +571,25 @@
;;; Changes from the pre-25.1 API:
;;
;; - The 'editable' optional argument of vc-checkout is gone. The
;; upper level assumes that all files are checked out editable. This
;; moves closer to emulating modern non-locking behavior even on very
;; old VCSes.
;; - INCOMPATIBLE CHANGE: The 'editable' optional argument of
;; vc-checkout is gone. The upper level assumes that all files are
;; checked out editable. This moves closer to emulating modern
;; 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
;; retains it as a private one).
......@@ -590,20 +607,11 @@
;; variable are gone. These have't made sense on anything shipped
;; 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
;; 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
;; their vc-state functions.
;;
;;; Todo:
......@@ -865,13 +873,6 @@ is sensitive to blank lines."
: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
(defun vc-clear-context ()
......@@ -1717,11 +1718,10 @@ Return t if the buffer had changes, nil otherwise."
;; We regard this as "changed".
;; Diff it against /dev/null.
(apply 'vc-do-command buffer
1 "diff" file
(async 'async 1) "diff" file
(append (vc-switches nil 'diff) '("/dev/null"))))))
(setq files (nreverse filtered))))
(let ((vc-disable-async-diff (not async)))
(vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer))
(vc-call-backend (car vc-fileset) 'diff files async rev1 rev2 buffer)
(set-buffer buffer)
(diff-mode)
(set (make-local-variable 'diff-vc-backend) (car vc-fileset))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment