From cdce374aed500a9b86f96af71d72a618d9639054 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 26 Dec 2007 23:24:08 +0000 Subject: [PATCH] *** empty log message *** --- lisp/ChangeLog | 9 +++++++++ lisp/vc-bzr.el | 4 ++-- lisp/vc-cvs.el | 4 ++-- lisp/vc-mcvs.el | 4 ++-- lisp/vc-svn.el | 6 +----- lisp/vc.el | 26 ++++++++++++++------------ 6 files changed, 30 insertions(+), 23 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ba59b6db9ca..e9d99a404f2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,15 @@ 2007-12-26 Eric S. Raymond * log-view.el: Add Subversion and Mercurial log format samples. + * vc-bzr.el, vc-cvs.el, vc.el, vc-mcvs.el, vc-svn.el: Significantly + speed up (vc-dired-hook) by arranging for it to call the backend + dir-state hook (if it exists) exactly *once*, rather than once per + each subdirectory (with dired-state-info calls on all toplevel files + slowing it down even further). For this to work, backend dir-state + methods have to recurse to subdirectories. Most of them already + did anyway; a few needed *non*-recursion switches removed. This + change mostly removed code that was perversely bad and should have + been shot through the head years ago. 2007-12-26 Andreas Schwab diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index 801e1942cb6..5e9bace920f 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el @@ -485,7 +485,7 @@ stream. Standard error output is discarded." ;; and implement a command to run ediff and `bzr resolve' once the ;; changes have been merged. (defun vc-bzr-dir-state (dir &optional localp) - "Find the VC state of all files in DIR. + "Find the VC state of all files in DIR and its subdirectories. Optional argument LOCALP is always ignored." (let ((bzr-root-directory (vc-bzr-root dir)) (at-start t) @@ -498,7 +498,7 @@ Optional argument LOCALP is always ignored." ;; evidence of the contrary. (setq at-start t) (with-temp-buffer - (vc-bzr-command "ls" t 0 nil "--versioned" "--non-recursive") + (vc-bzr-command "ls" t 0 nil "--versioned") (goto-char (point-min)) (while (or at-start (eq 0 (forward-line))) diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 6d57a329b0c..5ffaf8ffa77 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el @@ -212,7 +212,7 @@ See also variable `vc-cvs-sticky-date-format-string'." 'edited))) (defun vc-cvs-dir-state (dir) - "Find the CVS state of all files in DIR." + "Find the CVS state of all files in DIR and subdirectories." ;; if DIR is not under CVS control, don't do anything. (when (file-readable-p (expand-file-name "CVS/Entries" dir)) (if (vc-stay-local-p dir) @@ -221,7 +221,7 @@ See also variable `vc-cvs-sticky-date-format-string'." ;; Don't specify DIR in this command, the default-directory is ;; enough. Otherwise it might fail with remote repositories. (with-temp-buffer - (vc-cvs-command t 0 nil "status" "-l") + (vc-cvs-command t 0 nil "status") (goto-char (point-min)) (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) (narrow-to-region (match-beginning 0) (match-end 0)) diff --git a/lisp/vc-mcvs.el b/lisp/vc-mcvs.el index c3b68f8aeaf..70d502c7670 100644 --- a/lisp/vc-mcvs.el +++ b/lisp/vc-mcvs.el @@ -178,7 +178,7 @@ This is only meaningful if you don't use the implicit checkout model (defalias 'vc-mcvs-state-heuristic 'vc-cvs-state-heuristic) (defun vc-mcvs-dir-state (dir) - "Find the Meta-CVS state of all files in DIR." + "Find the Meta-CVS state of all files in DIR and subdirectories." ;; if DIR is not under Meta-CVS control, don't do anything. (when (file-readable-p (expand-file-name "MCVS/CVS/Entries" dir)) (if (vc-stay-local-p dir) @@ -188,7 +188,7 @@ This is only meaningful if you don't use the implicit checkout model ;; enough. Otherwise it might fail with remote repositories. (with-temp-buffer (setq default-directory (vc-mcvs-root dir)) - (vc-mcvs-command t 0 nil "status" "-l") + (vc-mcvs-command t 0 nil "status") (goto-char (point-min)) (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) (narrow-to-region (match-beginning 0) (match-end 0)) diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index b83f8e0580f..2b46d2b9fec 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el @@ -27,10 +27,6 @@ ;; Sync'd with Subversion's vc-svn.el as of revision 5801. but this version ;; has been extensively modified since to handle filesets. -;;; Bugs: - -;; - VC-dired is (really) slow. - ;;; Code: (eval-when-compile @@ -151,7 +147,7 @@ If you want to force an empty list of arguments, use t." (vc-svn-state file 'local)) (defun vc-svn-dir-state (dir &optional localp) - "Find the SVN state of all files in DIR." + "Find the SVN state of all files in DIR and its subdirectories." (setq localp (or localp (vc-stay-local-p dir))) (let ((default-directory dir)) ;; Don't specify DIR in this command, the default-directory is diff --git a/lisp/vc.el b/lisp/vc.el index 7d843b934c5..d8c99b25108 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -160,9 +160,11 @@ ;; - dir-state (dir) ;; ;; If provided, this function is used to find the version control state -;; of all files in DIR in a fast way. The function should not return -;; anything, but rather store the files' states into the corresponding -;; `vc-state' properties. +;; of all files in DIR, and all subdirecties of DIR, in a fast way. +;; The function should not return anything, but rather store the files' +;; states into the corresponding `vc-state' properties. (Note: in +;; older versions this method was not required to recurse into +;; subdirectories.) ;; ;; * working-revision (file) ;; @@ -2311,19 +2313,19 @@ This code, like dired, assumes UNIX -l format." "Reformat the listing according to version control. Called by dired after any portion of a vc-dired buffer has been read in." (message "Getting version information... ") - (let (subdir filename (inhibit-read-only t)) + ;; if the backend supports it, get the state + ;; of all files in this directory at once + (let ((backend (vc-responsible-backend default-directory))) + ;; check `backend' can really handle `default-directory'. + (if (and (vc-call-backend backend 'responsible-p default-directory) + (vc-find-backend-function backend 'dir-state)) + (vc-call-backend backend 'dir-state default-directory))) + (let (filename (inhibit-read-only t)) (goto-char (point-min)) (while (not (eobp)) (cond ;; subdir header line - ((setq subdir (dired-get-subdir)) - ;; if the backend supports it, get the state - ;; of all files in this directory at once - (let ((backend (vc-responsible-backend subdir))) - ;; check `backend' can really handle `subdir'. - (if (and (vc-call-backend backend 'responsible-p subdir) - (vc-find-backend-function backend 'dir-state)) - (vc-call-backend backend 'dir-state subdir))) + ((dired-get-subdir) (forward-line 1) ;; erase (but don't remove) the "total" line (delete-region (point) (line-end-position)) -- 2.39.2