Terminate vc-disable-async-diff with extreme prejudice.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 1 Dec 2014 22:56:41 +0000 (17:56 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 1 Dec 2014 22:56:41 +0000 (17:56 -0500)
* vc/vc.el, and all backends: API cleanup; the backend diff method
takes an explicit async flag.  This eliminates a particularly ugly
global.

13 files changed:
lisp/ChangeLog
lisp/vc/vc-arch.el
lisp/vc/vc-bzr.el
lisp/vc/vc-cvs.el
lisp/vc/vc-dav.el
lisp/vc/vc-git.el
lisp/vc/vc-hg.el
lisp/vc/vc-mtn.el
lisp/vc/vc-rcs.el
lisp/vc/vc-sccs.el
lisp/vc/vc-src.el
lisp/vc/vc-svn.el
lisp/vc/vc.el

index 106849b468699415c4d23a08da850c611b807637..022a7e23418abd85805332bebd9b5469589dff59 100644 (file)
@@ -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.
index eb6ea7d26a01af21d41c78624d8c05895c6778c8..1bdad2a04f96d0d261f5a36f0bbc8b304fdc182c 100644 (file)
@@ -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
index 7f30378227fa7ad20b9d6c6bf24333fe36fdf039..48476dc96543a6f8269059e40e5c2c0eb2da2b29 100644 (file)
@@ -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)))
 
 
index fc1e8572578fb1ec68addfc4b32406a1e4343f7a..41c5326146443764c17482b708d137de3e8a1ca9 100644 (file)
@@ -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
index fe93e732fee9c2172c0bfa9df390d2bca5988fd9..46aa027c6c5b2c26ae817afcaf946c58f95bf912 100644 (file)
@@ -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.
index 53db340146fdbfb4d8ef092e1fb9914e79dc636d..8fdea8c216bcb1484b08b404308e6ac930a090c0 100644 (file)
@@ -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)
index bc704e7a03dda3c27feba84d1e4b00e541462d22..0f636c0184816b2a49171f0b1625961f191b2f6a 100644 (file)
@@ -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
index b32a1db744db90db261db4bb7e31dc4cf6641cbd..e03d8551d6e4efeb06aab522b20b9da2c95dc47d 100644 (file)
@@ -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)))))
index 940d967d68bea1d065abd863bea8cd6a16b476c2..c9e4d409924535bcabcfacd70231a5ec0972758a 100644 (file)
@@ -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))
index cd4c054b07d9c85b390a5b4bf3e77fc047d51f36..8a9e0b112894a40a18a5bde62693050de6e2a3b9 100644 (file)
@@ -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))
index b780161d5dda17ed216e9568e6966a386188c7e1..49c799c44e11074ecdcd88fef45ddff2c7711d35 100644 (file)
@@ -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))))
index 03fb32154c2ebfacf44c8664c366e5cdcb46735a..54b998df9d5b7d969f6bcda5b1dd67187d0d5794 100644 (file)
@@ -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"
index d3315ca08b3cd678abd77cd4eb7ab51a9d324b41..121e32925dad726fe93eb559b41f4dd60fa14113 100644 (file)
 ;;   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)
 ;;
 
 ;;; 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).
 ;;   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)
 
 \f
-;; 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))