aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2007-11-12 03:56:38 +0000
committerDan Nicolaescu2007-11-12 03:56:38 +0000
commit2e7a8a21c95558e1e0236aaaea5bcb29a1e548d8 (patch)
tree524401762a86810aecd817571633b96914a4164d
parent4cbf3aa72e398b35ab2f0f5272e1642737472d39 (diff)
downloademacs-2e7a8a21c95558e1e0236aaaea5bcb29a1e548d8.tar.gz
emacs-2e7a8a21c95558e1e0236aaaea5bcb29a1e548d8.zip
(vc-cvs-diff): If backup files exist, diff them
instead of doing "cvs diff" in order to avoid accessing the repository.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/vc-cvs.el41
2 files changed, 42 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 28533a7a177..083934494fc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12007-11-12 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * vc-cvs.el (vc-cvs-diff): If backup files exist, diff them
4 instead of doing "cvs diff" in order to avoid accessing the
5 repository.
6
12007-11-12 Kevin Ryde <user42@zip.com.au> 72007-11-12 Kevin Ryde <user42@zip.com.au>
2 8
3 * progmodes/compilation-perl.el: 9 * progmodes/compilation-perl.el:
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index d6573db9df2..c9c50fceba2 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -513,15 +513,46 @@ The changes are between FIRST-REVISION and SECOND-REVISION."
513 513
514(defun vc-cvs-diff (files &optional oldvers newvers buffer) 514(defun vc-cvs-diff (files &optional oldvers newvers buffer)
515 "Get a difference report using CVS between two revisions of FILE." 515 "Get a difference report using CVS between two revisions of FILE."
516 (let* ((async (and (not vc-disable-async-diff) 516 (let* ((async (and (not vc-disable-async-diff)
517 (vc-stay-local-p files))) 517 (vc-stay-local-p files)))
518 (status (apply 'vc-cvs-command (or buffer "*vc-diff*") 518 (invoke-cvs-diff-list nil)
519 status)
520 ;; Look through the file list and see if any files have backups
521 ;; that can be used to do a plain "diff" instead of "cvs diff".
522 (dolist (file files)
523 (let ((ov oldvers)
524 (nv newvers))
525 (when (or (not ov) (string-equal ov ""))
526 (setq ov (vc-working-revision file)))
527 (when (string-equal nv "")
528 (setq nv nil))
529 (let ((file-oldvers (vc-version-backup-file file ov))
530 (file-newvers (if (not nv)
531 file
532 (vc-version-backup-file file nv)))
533 (coding-system-for-read (vc-coding-system-for-diff file)))
534 (if (and file-oldvers file-newvers)
535 (progn
536 (apply 'vc-do-command (or buffer "*vc-diff*") 1 "diff" nil
537 (append (if (listp diff-switches)
538 diff-switches
539 (list diff-switches))
540 (if (listp vc-diff-switches)
541 vc-diff-switches
542 (list vc-diff-switches))
543 (list (file-relative-name file-oldvers)
544 (file-relative-name file-newvers))))
545 (setq status 0))
546 (push file invoke-cvs-diff-list)))))
547 (when invoke-cvs-diff-list
548 (setq status (apply 'vc-cvs-command (or buffer "*vc-diff*")
519 (if async 'async 1) 549 (if async 'async 1)
520 files "diff" 550 invoke-cvs-diff-list "diff"
521 (and oldvers (concat "-r" oldvers)) 551 (and oldvers (concat "-r" oldvers))
522 (and newvers (concat "-r" newvers)) 552 (and newvers (concat "-r" newvers))
523 (vc-switches 'CVS 'diff)))) 553 (vc-switches 'CVS 'diff))))
524 (if async 1 status))) ; async diff, pessimistic assumption 554 (if async 1 status))) ; async diff, pessimistic assumption
555
525 556
526(defun vc-cvs-diff-tree (dir &optional rev1 rev2) 557(defun vc-cvs-diff-tree (dir &optional rev1 rev2)
527 "Diff all files at and below DIR." 558 "Diff all files at and below DIR."