diff options
-rw-r--r-- | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/vc/vc-arch.el | 3 | ||||
-rw-r--r-- | lisp/vc/vc-bzr.el | 4 | ||||
-rw-r--r-- | lisp/vc/vc-cvs.el | 5 | ||||
-rw-r--r-- | lisp/vc/vc-dav.el | 2 | ||||
-rw-r--r-- | lisp/vc/vc-git.el | 6 | ||||
-rw-r--r-- | lisp/vc/vc-hg.el | 7 | ||||
-rw-r--r-- | lisp/vc/vc-mtn.el | 6 | ||||
-rw-r--r-- | lisp/vc/vc-rcs.el | 4 | ||||
-rw-r--r-- | lisp/vc/vc-sccs.el | 2 | ||||
-rw-r--r-- | lisp/vc/vc-src.el | 2 | ||||
-rw-r--r-- | lisp/vc/vc-svn.el | 3 | ||||
-rw-r--r-- | lisp/vc/vc.el | 58 |
13 files changed, 59 insertions, 49 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 106849b4686..022a7e23418 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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> Merge some of the differences from the standalone CC-mode. diff --git a/lisp/vc/vc-arch.el b/lisp/vc/vc-arch.el index eb6ea7d26a0..1bdad2a04f9 100644 --- a/lisp/vc/vc-arch.el +++ b/lisp/vc/vc-arch.el @@ -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 diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index 7f30378227f..48476dc9654 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -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))) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index fc1e8572578..41c53261464 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -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 diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el index fe93e732fee..46aa027c6c5 100644 --- a/lisp/vc/vc-dav.el +++ b/lisp/vc/vc-dav.el @@ -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. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 53db340146f..8fdea8c216b 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -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) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index bc704e7a03d..0f636c01848 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -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 diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index b32a1db744d..e03d8551d6e 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el @@ -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))))) diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 940d967d68b..c9e4d409924 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el @@ -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)) diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index cd4c054b07d..8a9e0b11289 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el @@ -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)) diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index b780161d5dd..49c799c44e1 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -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)))) diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index 03fb32154c2..54b998df9d5 100644 --- a/lisp/vc/vc-svn.el +++ b/lisp/vc/vc-svn.el @@ -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" diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index d3315ca08b3..121e32925da 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -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)) |