aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond2014-12-01 17:56:41 -0500
committerEric S. Raymond2014-12-01 17:56:41 -0500
commited6ce56e2326fb8b257e63e015598ad74b5fd35c (patch)
tree1ed8dd3c30e61b12e7243c3a6a9e8da29aa38623
parent4f54f7b3760218d53743e5f8e3f0d3065a03ee23 (diff)
downloademacs-ed6ce56e2326fb8b257e63e015598ad74b5fd35c.tar.gz
emacs-ed6ce56e2326fb8b257e63e015598ad74b5fd35c.zip
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.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/vc/vc-arch.el3
-rw-r--r--lisp/vc/vc-bzr.el4
-rw-r--r--lisp/vc/vc-cvs.el5
-rw-r--r--lisp/vc/vc-dav.el2
-rw-r--r--lisp/vc/vc-git.el6
-rw-r--r--lisp/vc/vc-hg.el7
-rw-r--r--lisp/vc/vc-mtn.el6
-rw-r--r--lisp/vc/vc-rcs.el4
-rw-r--r--lisp/vc/vc-sccs.el2
-rw-r--r--lisp/vc/vc-src.el2
-rw-r--r--lisp/vc/vc-svn.el3
-rw-r--r--lisp/vc/vc.el58
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 @@
12014-12-01 Eric S. Raymond <esr@snark.thyrsus.com>
2
3 * vc/vc.el, and all backends: API cleanup; the backend diff method
4 takes an explicit async flag. This eliminates a particularly ugly
5 global.
6
12014-12-01 Stefan Monnier <monnier@iro.umontreal.ca> 72014-12-01 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 Merge some of the differences from the standalone CC-mode. 9 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
447 (vc-arch-command nil 0 files "commit" "-s" summary "-L" comment "--" 447 (vc-arch-command nil 0 files "commit" "-s" summary "-L" comment "--"
448 (vc-switches 'Arch 'checkin)))) 448 (vc-switches 'Arch 'checkin))))
449 449
450(defun vc-arch-diff (files &optional oldvers newvers buffer) 450(defun vc-arch-diff (files &optional async oldvers newvers buffer)
451 "Get a difference report using Arch between two versions of FILES." 451 "Get a difference report using Arch between two versions of FILES."
452 ;; FIXME: This implementation only works for singleton filesets. To make 452 ;; FIXME: This implementation only works for singleton filesets. To make
453 ;; it work for more cases, we have to either call `file-diffs' manually on 453 ;; 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
464 (if newvers 464 (if newvers
465 (error "Diffing specific revisions not implemented") 465 (error "Diffing specific revisions not implemented")
466 (let* (process-file-side-effects 466 (let* (process-file-side-effects
467 (async (not vc-disable-async-diff))
468 ;; Run the command from the root dir. 467 ;; Run the command from the root dir.
469 (default-directory (vc-arch-root file)) 468 (default-directory (vc-arch-root file))
470 (status 469 (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."
779 779
780(autoload 'vc-switches "vc") 780(autoload 'vc-switches "vc")
781 781
782(defun vc-bzr-diff (files &optional rev1 rev2 buffer) 782(defun vc-bzr-diff (files &optional async rev1 rev2 buffer)
783 "VC bzr backend for diff." 783 "VC bzr backend for diff."
784 (let* ((switches (vc-switches 'bzr 'diff)) 784 (let* ((switches (vc-switches 'bzr 'diff))
785 (args 785 (args
@@ -795,7 +795,7 @@ If LIMIT is non-nil, show no more than this many entries."
795 (or rev2 ""))))))) 795 (or rev2 "")))))))
796 ;; `bzr diff' exits with code 1 if diff is non-empty. 796 ;; `bzr diff' exits with code 1 if diff is non-empty.
797 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 797 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*")
798 (if vc-disable-async-diff 1 'async) files 798 (if async 1 'async) files
799 args))) 799 args)))
800 800
801 801
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."
569(autoload 'vc-version-backup-file "vc") 569(autoload 'vc-version-backup-file "vc")
570(declare-function vc-coding-system-for-diff "vc" (file)) 570(declare-function vc-coding-system-for-diff "vc" (file))
571 571
572(defun vc-cvs-diff (files &optional oldvers newvers buffer) 572(defun vc-cvs-diff (files &optional async oldvers newvers buffer)
573 "Get a difference report using CVS between two revisions of FILE." 573 "Get a difference report using CVS between two revisions of FILE."
574 (let* (process-file-side-effects 574 (let* (process-file-side-effects
575 (async (and (not vc-disable-async-diff) 575 (async (and async (vc-cvs-stay-local-p files)))
576 (vc-cvs-stay-local-p files)))
577 (invoke-cvs-diff-list nil) 576 (invoke-cvs-diff-list nil)
578 status) 577 status)
579 ;; Look through the file list and see if any files have backups 578 ;; 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.
117 "Insert the revision log of URL into the *vc* buffer." 117 "Insert the revision log of URL into the *vc* buffer."
118 ) 118 )
119 119
120(defun vc-dav-diff (url &optional rev1 rev2) 120(defun vc-dav-diff (url &optional async rev1 rev2)
121 "Insert the diff for URL into the *vc-diff* buffer. 121 "Insert the diff for URL into the *vc-diff* buffer.
122If REV1 and REV2 are non-nil report differences from REV1 to REV2. 122If REV1 and REV2 are non-nil report differences from REV1 to REV2.
123If REV1 is nil, use the current workfile version as the older version. 123If 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)."
984 984
985(autoload 'vc-switches "vc") 985(autoload 'vc-switches "vc")
986 986
987(defun vc-git-diff (files &optional rev1 rev2 buffer) 987(defun vc-git-diff (files &optional async rev1 rev2 buffer)
988 "Get a difference report using Git between two revisions of FILES." 988 "Get a difference report using Git between two revisions of FILES."
989 (let (process-file-side-effects) 989 (let (process-file-side-effects)
990 (if vc-git-diff-switches 990 (if vc-git-diff-switches
991 (apply #'vc-git-command (or buffer "*vc-diff*") 1 files 991 (apply #'vc-git-command (or buffer "*vc-diff*")
992 (if async 'async 1)
993 files
992 (if (and rev1 rev2) "diff-tree" "diff-index") 994 (if (and rev1 rev2) "diff-tree" "diff-index")
993 "--exit-code" 995 "--exit-code"
994 (append (vc-switches 'git 'diff) 996 (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."
316 316
317(autoload 'vc-switches "vc") 317(autoload 'vc-switches "vc")
318 318
319(defun vc-hg-diff (files &optional oldvers newvers buffer) 319(defun vc-hg-diff (files &optional async oldvers newvers buffer)
320 "Get a difference report using hg between two revisions of FILES." 320 "Get a difference report using hg between two revisions of FILES."
321 (let* ((firstfile (car files)) 321 (let* ((firstfile (car files))
322 (working (and firstfile (vc-working-revision firstfile)))) 322 (working (and firstfile (vc-working-revision firstfile))))
@@ -324,7 +324,10 @@ If LIMIT is non-nil, show no more than this many entries."
324 (setq oldvers nil)) 324 (setq oldvers nil))
325 (when (and (not oldvers) newvers) 325 (when (and (not oldvers) newvers)
326 (setq oldvers working)) 326 (setq oldvers working))
327 (apply #'vc-hg-command (or buffer "*vc-diff*") nil files "diff" 327 (apply #'vc-hg-command
328 (or buffer "*vc-diff*")
329 (if async 'async nil)
330 files "diff"
328 (append 331 (append
329 (vc-switches 'hg 'diff) 332 (vc-switches 'hg 'diff)
330 (when oldvers 333 (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."
238 238
239(autoload 'vc-switches "vc") 239(autoload 'vc-switches "vc")
240 240
241(defun vc-mtn-diff (files &optional rev1 rev2 buffer) 241(defun vc-mtn-diff (files &optional async rev1 rev2 buffer)
242 "Get a difference report using monotone between two revisions of FILES." 242 "Get a difference report using monotone between two revisions of FILES."
243 (apply 'vc-mtn-command (or buffer "*vc-diff*") 1 files "diff" 243 (apply 'vc-mtn-command (or buffer "*vc-diff*")
244 (if async 'async 1)
245 files "diff"
244 (append 246 (append
245 (vc-switches 'mtn 'diff) 247 (vc-switches 'mtn 'diff)
246 (if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2))))) 248 (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."
565 (vc-rcs-print-log-cleanup)) 565 (vc-rcs-print-log-cleanup))
566 (when limit 'limit-unsupported)) 566 (when limit 'limit-unsupported))
567 567
568(defun vc-rcs-diff (files &optional oldvers newvers buffer) 568(defun vc-rcs-diff (files &optional async oldvers newvers buffer)
569 "Get a difference report using RCS between two sets of files." 569 "Get a difference report using RCS between two sets of files."
570 (apply #'vc-do-command (or buffer "*vc-diff*") 570 (apply #'vc-do-command (or buffer "*vc-diff*")
571 1 ;; Always go synchronous, the repo is local 571 (if async 'async 1)
572 "rcsdiff" (vc-expand-dirs files) 572 "rcsdiff" (vc-expand-dirs files)
573 (append (list "-q" 573 (append (list "-q"
574 (and oldvers (concat "-r" oldvers)) 574 (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."
342(defvar w32-quote-process-args) 342(defvar w32-quote-process-args)
343 343
344;; FIXME use sccsdiff if present? 344;; FIXME use sccsdiff if present?
345(defun vc-sccs-diff (files &optional oldvers newvers buffer) 345(defun vc-sccs-diff (files &optional _async oldvers newvers buffer)
346 "Get a difference report using SCCS between two filesets." 346 "Get a difference report using SCCS between two filesets."
347 (setq files (vc-expand-dirs files)) 347 (setq files (vc-expand-dirs files))
348 (setq oldvers (vc-sccs-lookup-triple (car files) oldvers)) 348 (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."
295 (when limit (list "-l" (format "%s" limit))) 295 (when limit (list "-l" (format "%s" limit)))
296 vc-src-log-switches))))) 296 vc-src-log-switches)))))
297 297
298(defun vc-src-diff (files &optional oldvers newvers buffer) 298(defun vc-src-diff (files &optional _async oldvers newvers buffer)
299 "Get a difference report using src between two revisions of FILES." 299 "Get a difference report using src between two revisions of FILES."
300 (let* ((firstfile (car files)) 300 (let* ((firstfile (car files))
301 (working (and firstfile (vc-working-revision firstfile)))) 301 (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."
573 (vc-switches 'SVN 'diff) 573 (vc-switches 'SVN 'diff)
574 (list (concat "--diff-cmd=" diff-command) "-x" 574 (list (concat "--diff-cmd=" diff-command) "-x"
575 (mapconcat 'identity (vc-switches nil 'diff) " ")))) 575 (mapconcat 'identity (vc-switches nil 'diff) " "))))
576 (async (and (not vc-disable-async-diff) 576 (async (or oldvers newvers))) ; Svn diffs those locally.
577 (or oldvers newvers)))) ; Svn diffs those locally.
578 (apply 'vc-svn-command buffer 577 (apply 'vc-svn-command buffer
579 (if async 'async 0) 578 (if async 'async 0)
580 files "diff" 579 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 @@
382;; default implementation runs rcs2log, which handles RCS- and 382;; default implementation runs rcs2log, which handles RCS- and
383;; CVS-style logs. 383;; CVS-style logs.
384;; 384;;
385;; * diff (files &optional rev1 rev2 buffer) 385;; * diff (files &optional async rev1 rev2 buffer)
386;; 386;;
387;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if 387;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if
388;; BUFFER is nil. If REV1 and REV2 are non-nil, report differences 388;; BUFFER is nil. If ASYNC is non-nil, run asynchronously.If REV1
389;; from REV1 to REV2. If REV1 is nil, use the working revision (as 389;; and REV2 are non-nil, report differences from REV1 to REV2. If
390;; found in the repository) as the older revision; if REV2 is nil, 390;; REV1 is nil, use the working revision (as found in the
391;; use the current working-copy contents as the newer revision. This 391;; repository) as the older revision; if REV2 is nil, use the
392;; current working-copy contents as the newer revision. This
392;; function should pass the value of (vc-switches BACKEND 'diff) to 393;; function should pass the value of (vc-switches BACKEND 'diff) to
393;; the backend command. It should return a status of either 0 (no 394;; the backend command. It should return a status of either 0 (no
394;; differences found), or 1 (either non-empty diff or the diff is 395;; differences found), or 1 (either non-empty diff or the diff is
395;; run asynchronously). 396;; run asynchronously).
397
396;; 398;;
397;; - revision-completion-table (files) 399;; - revision-completion-table (files)
398;; 400;;
@@ -569,10 +571,25 @@
569 571
570;;; Changes from the pre-25.1 API: 572;;; Changes from the pre-25.1 API:
571;; 573;;
572;; - The 'editable' optional argument of vc-checkout is gone. The 574;; - INCOMPATIBLE CHANGE: The 'editable' optional argument of
573;; upper level assumes that all files are checked out editable. This 575;; vc-checkout is gone. The upper level assumes that all files are
574;; moves closer to emulating modern non-locking behavior even on very 576;; checked out editable. This moves closer to emulating modern
575;; old VCSes. 577;; non-locking behavior even on very old VCSes.
578;;
579;; - INCOMPATIBLE CHANGE: The vc-register function and its backend
580;; implementations no longer take a first optional revision
581;; argument, since on no system since RCS has setting the initial
582;; revision been even possible, let alone sane.
583;;
584;; INCOMPATIBLE CHANGE: In older versions of the API, vc-diff did
585;; not take an async-mode flag as a first optional argument. (This
586;; change eliminated a particularly ugly global.)
587;;
588;; - INCOMPATIBLE CHANGE: The backend operation for non-distributed
589;; VCSes formerly called "merge" is now "merge-file" (to contrast
590;; with merge-branch), and does its own prompting for revisions.
591;; (This fixes a layer violation that produced bad behavior under
592;; SVN.)
576;; 593;;
577;; - vc-state-heuristic is no longer a public method (the CVS backend 594;; - vc-state-heuristic is no longer a public method (the CVS backend
578;; retains it as a private one). 595;; retains it as a private one).
@@ -590,20 +607,11 @@
590;; variable are gone. These have't made sense on anything shipped 607;; variable are gone. These have't made sense on anything shipped
591;; since RCS, and using them was a dumb stunt even on RCS. 608;; since RCS, and using them was a dumb stunt even on RCS.
592;; 609;;
593;; - The vc-register function and its backend implementations no longer
594;; take a first optional revision argument, since on no system since
595;; RCS has setting the initial revision been even possible, let alone
596;; sane.
597;;
598;; - The backend operation for non-distributed VCSes formerly called
599;; "merge" is now "merge-file" (to contrast with merge-branch), and
600;; does its own prompting for revisions. (This fixes a layer violation
601;; that produced bad behavior under SVN.)
602;;
603;; workfile-unchanged-p is no longer a public back-end method. It 610;; workfile-unchanged-p is no longer a public back-end method. It
604;; was redundant with vc-state and usually implemented with a trivial 611;; was redundant with vc-state and usually implemented with a trivial
605;; call to it. A few older back ends retain versions for internal use in 612;; call to it. A few older back ends retain versions for internal use in
606;; their vc-state functions. 613;; their vc-state functions.
614;;
607 615
608;;; Todo: 616;;; Todo:
609 617
@@ -865,13 +873,6 @@ is sensitive to blank lines."
865 :group 'vc) 873 :group 'vc)
866 874
867 875
868;; Variables users don't need to see
869
870(defvar vc-disable-async-diff nil
871 "VC sets this to t locally to disable some async diff operations.
872Backends that offer asynchronous diffs should respect this variable
873in their implementation of vc-BACKEND-diff.")
874
875;; File property caching 876;; File property caching
876 877
877(defun vc-clear-context () 878(defun vc-clear-context ()
@@ -1717,11 +1718,10 @@ Return t if the buffer had changes, nil otherwise."
1717 ;; We regard this as "changed". 1718 ;; We regard this as "changed".
1718 ;; Diff it against /dev/null. 1719 ;; Diff it against /dev/null.
1719 (apply 'vc-do-command buffer 1720 (apply 'vc-do-command buffer
1720 1 "diff" file 1721 (async 'async 1) "diff" file
1721 (append (vc-switches nil 'diff) '("/dev/null")))))) 1722 (append (vc-switches nil 'diff) '("/dev/null"))))))
1722 (setq files (nreverse filtered)))) 1723 (setq files (nreverse filtered))))
1723 (let ((vc-disable-async-diff (not async))) 1724 (vc-call-backend (car vc-fileset) 'diff files async rev1 rev2 buffer)
1724 (vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer))
1725 (set-buffer buffer) 1725 (set-buffer buffer)
1726 (diff-mode) 1726 (diff-mode)
1727 (set (make-local-variable 'diff-vc-backend) (car vc-fileset)) 1727 (set (make-local-variable 'diff-vc-backend) (car vc-fileset))