changeset 94729:bf91c987049c

Remove VC-Dired and backend dir-state methods.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Wed, 07 May 2008 21:27:41 +0000
parents b4258832258e
children 3bbff46b7130
files lisp/ChangeLog lisp/vc-bzr.el lisp/vc-cvs.el lisp/vc-dispatcher.el lisp/vc-git.el lisp/vc-hg.el lisp/vc-hooks.el lisp/vc-mcvs.el lisp/vc-svn.el lisp/vc.el
diffstat 10 files changed, 22 insertions(+), 551 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/ChangeLog	Wed May 07 21:27:41 2008 +0000
@@ -1,3 +1,8 @@
+2008-05-07  Eric S. Raymond  <esr@snark.thyrsus.com>
+
+	* vc.el, vc-dispatcher.el: VC-Dired support removed.  The code
+	uses a ewoc-based implementation now.
+
 2008-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* tool-bar.el: Choose images dynamically.
--- a/lisp/vc-bzr.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc-bzr.el	Wed May 07 21:27:41 2008 +0000
@@ -564,90 +564,6 @@
      (apply #'call-process command nil (list (current-buffer) nil) nil args)
      (buffer-substring (point-min) (point-max)))))
 
-;; TODO: it would be nice to mark the conflicted files in  VC Dired,
-;; 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 and its subdirectories.
-Optional argument LOCALP is always ignored."
-  (let ((bzr-root-directory (vc-bzr-root dir))
-        (at-start t)
-        current-bzr-state current-vc-state)
-    ;; Check that DIR is a bzr repository.
-    (unless (file-name-absolute-p bzr-root-directory)
-      (error "Cannot find bzr repository for directory `%s'" dir))
-    ;; `bzr ls --versioned' lists all versioned files;
-    ;; assume they are up-to-date, unless we are given
-    ;; evidence of the contrary.
-    (setq at-start t)
-    (with-temp-buffer
-      (buffer-disable-undo)		;; Because these buffers can get huge
-      (vc-bzr-command "ls" t 0 nil "--versioned")
-      (goto-char (point-min))
-      (while (or at-start
-                 (eq 0 (forward-line)))
-        (setq at-start nil)
-        (let ((file (expand-file-name
-                     (buffer-substring-no-properties 
-                      (line-beginning-position) (line-end-position))
-                     bzr-root-directory)))
-          ;; files are up-to-date unless they appear in the `bzr
-          ;; status' output below
-          (vc-file-setprop file 'vc-state 'up-to-date)
-          ;; Anyway, we're looking at the output of `bzr ls
-          ;; --versioned', so we know these files are registered with
-          ;; Bzr.
-          (vc-file-setprop file 'vc-backend 'Bzr))))
-    ;; `bzr status' reports on added/modified/renamed and unknown/ignored files
-    (setq at-start t)
-    (with-temp-buffer 
-      (vc-bzr-command "status" t 0 nil)
-      (goto-char (point-min))
-      (while (or at-start
-                 (eq 0 (forward-line)))
-        (setq at-start nil)
-        (cond 
-         ((looking-at "^added") 
-          (setq current-vc-state 'added)
-          (setq current-bzr-state 'added))
-         ((looking-at "^kind changed") 
-          (setq current-vc-state 'edited)
-          (setq current-bzr-state 'kindchanged))
-         ((looking-at "^modified") 
-          (setq current-vc-state 'edited)
-          (setq current-bzr-state 'modified))
-         ((looking-at "^renamed") 
-          (setq current-vc-state 'edited)
-          (setq current-bzr-state 'renamed))
-         ((looking-at "^ignored")
-          (setq current-vc-state 'ignored)
-          (setq current-bzr-state 'not-versioned))
-         ((looking-at "^unknown")
-          (setq current-vc-state 'unregistered)
-          (setq current-bzr-state 'not-versioned))
-         ((looking-at "  ")
-          ;; file names are indented by two spaces
-          (when current-vc-state
-            (let ((file (expand-file-name
-                         (buffer-substring-no-properties
-                          (match-end 0) (line-end-position))
-                         bzr-root-directory)))
-              (vc-file-setprop file 'vc-state current-vc-state)
-              (vc-file-setprop file 'vc-bzr-state current-bzr-state)
-              (when (eq 'added current-bzr-state)
-                (vc-file-setprop file 'vc-working-revision "0"))))
-          (when (eq 'not-versioned current-bzr-state)
-            (let ((file (expand-file-name
-                         (buffer-substring-no-properties
-                          (match-end 0) (line-end-position))
-                         bzr-root-directory)))
-              (vc-file-setprop file 'vc-backend 'none)
-              (vc-file-setprop file 'vc-state nil))))
-         (t
-          ;; skip this part of `bzr status' output
-          (setq current-vc-state nil)
-          (setq current-bzr-state nil)))))))
-
 (defun vc-bzr-prettify-state-info (file)
   "Bzr-specific version of `vc-prettify-state-info'."
   (if (eq 'edited (vc-state file))
--- a/lisp/vc-cvs.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc-cvs.el	Wed May 07 21:27:41 2008 +0000
@@ -233,25 +233,6 @@
      ((string= (vc-working-revision file) "0") 'added)
      (t 'edited))))
 
-(defun vc-cvs-dir-state (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)
-	(vc-cvs-dir-state-heuristic dir)
-      (let ((default-directory dir))
-	;; Don't specify DIR in this command, the default-directory is
-	;; enough.  Otherwise it might fail with remote repositories.
-	(with-temp-buffer
-	  (buffer-disable-undo)		;; Because these buffers can get huge
-	  (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))
-	    (vc-cvs-parse-status)
-	    (goto-char (point-max))
-	    (widen)))))))
-
 (defun vc-cvs-working-revision (file)
   "CVS-specific version of `vc-working-revision'."
   ;; There is no need to consult RCS headers under CVS, because we
@@ -845,19 +826,6 @@
 	  ((string-match "File had conflicts " status)          'conflict)
 	  (t 'edited))))))))
 
-(defun vc-cvs-dir-state-heuristic (dir)
-  "Find the CVS state of all files in DIR, using only local information."
-  (with-temp-buffer
-    (vc-cvs-get-entries dir)
-    (goto-char (point-min))
-    (while (not (eobp))
-      ;; CVS-removed files are not taken under VC control.
-      (when (looking-at "/\\([^/]*\\)/[^/-]")
-	(let ((file (expand-file-name (match-string 1) dir)))
-	  (unless (vc-file-getprop file 'vc-state)
-	    (vc-cvs-parse-entry file t))))
-      (forward-line 1))))
-
 (defun vc-cvs-after-dir-status (update-function)
   ;; Heavily inspired by vc-cvs-parse-status. AKA a quick hack.
   ;; This needs a lot of testing.
--- a/lisp/vc-dispatcher.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc-dispatcher.el	Wed May 07 21:27:41 2008 +0000
@@ -137,9 +137,7 @@
 (provide 'vc-dispatcher)
 
 (eval-when-compile
-  (require 'cl)
-  (require 'dired)      ; for dired-map-over-marks macro
-  (require 'dired-aux))	; for dired-kill-{line,tree}
+  (require 'cl))
 
 ;; General customization
 
@@ -177,7 +175,7 @@
 
 ;; In a log entry buffer, this is a local variable
 ;; that points to the buffer for which it was made
-;; (either a file, or a VC dired buffer).
+;; (either a file, or a VC directory buffer).
 (defvar vc-parent-buffer nil)
 (put 'vc-parent-buffer 'permanent-local t)
 (defvar vc-parent-buffer-name nil)
@@ -534,8 +532,8 @@
 \(current one if no file).  AFTER-HOOK specifies the local value
 for `vc-log-after-operation-hook'."
   (let ((parent
-         (if (or (eq major-mode 'vc-dired-mode) (eq major-mode 'vc-dir-mode))
-             ;; If we are called from VC dired, the parent buffer is
+         (if (vc-dispatcher-browsing)
+             ;; If we are called from a directory browser, the parent buffer is
              ;; the current buffer.
              (current-buffer)
            (if (and files (equal (length files) 1))
@@ -570,9 +568,9 @@
   (unless nocomment
     (run-hooks 'vc-logentry-check-hook))
   ;; Sync parent buffer in case the user modified it while editing the comment.
-  ;; But not if it is a vc-dired buffer.
+  ;; But not if it is a vc-directory buffer.
   (with-current-buffer vc-parent-buffer
-    (or vc-dired-mode (eq major-mode 'vc-dir-mode) (vc-buffer-sync)))
+    (or (vc-dispatcher-browsing) (vc-buffer-sync)))
   (unless vc-log-operation
     (error "No log operation is pending"))
   ;; save the parameters held in buffer-local variables
@@ -605,221 +603,10 @@
       (mapc
        (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t))
        log-fileset))
-    (when vc-dired-mode
-      (dired-move-to-filename))
-    (when (eq major-mode 'vc-dir-mode)
+    (when (vc-dispatcher-browsing)
       (vc-dir-move-to-goal-column))
     (run-hooks after-hook 'vc-finish-logentry-hook)))
 
-;; VC-Dired mode
-;; FIXME: to be removed when vc-dir support is finished
-
-(defcustom vc-dired-listing-switches "-al"
-  "Switches passed to `ls' for vc-dired.  MUST contain the `l' option."
-  :type 'string
-  :group 'vc
-  :version "21.1")
-
-(defcustom vc-dired-recurse t
-  "If non-nil, show directory trees recursively in VC Dired."
-  :type 'boolean
-  :group 'vc
-  :version "20.3")
-
-(defcustom vc-dired-terse-display t
-  "If non-nil, show only locked or locally modified files in VC Dired."
-  :type 'boolean
-  :group 'vc
-  :version "20.3")
-
-(defvar vc-dired-mode nil)
-(defvar vc-dired-window-configuration)
-(defvar vc-dired-switches)
-(defvar vc-dired-terse-mode)
-
-(make-variable-buffer-local 'vc-dired-mode)
-
-(defvar vc-dired-mode-map
-  (let ((map (make-sparse-keymap))
-	(vmap (make-sparse-keymap)))
-    (define-key map "\C-xv" vmap)
-    (define-key map "v" vmap)
-    (set-keymap-parent vmap vc-prefix-map)
-    (define-key vmap "t" 'vc-dired-toggle-terse-mode)
-    map))
-
-(define-derived-mode vc-dired-mode dired-mode "Dired under VC"
-  "The major mode used in VC directory buffers.
-
-It works like Dired, but lists only files under version control, with
-the current VC state of each file being indicated in the place of the
-file's link count, owner, group and size.  Subdirectories are also
-listed, and you may insert them into the buffer as desired, like in
-Dired.
-
-All Dired commands operate normally, with the exception of `v', which
-is redefined as the version control prefix, so that you can type
-`vl', `v=' etc. to invoke `vc-print-log', `vc-diff', and the like on
-the file named in the current Dired buffer line.  `vv' invokes
-`vc-next-action' on this file, or on all files currently marked.
-There is a special command, `*l', to mark all files currently locked."
-  ;; define-derived-mode does it for us in Emacs-21, but not in Emacs-20.
-  ;; We do it here because dired might not be loaded yet
-  ;; when vc-dired-mode-map is initialized.
-  (set-keymap-parent vc-dired-mode-map dired-mode-map)
-  (add-hook 'dired-after-readin-hook 'vc-dired-hook nil t)
-  ;; The following is slightly modified from files.el,
-  ;; because file lines look a bit different in vc-dired-mode
-  ;; (the column before the date does not end in a digit).
-  ;; albinus: It should be done in the original declaration.  Problem
-  ;; is the optional empty state-info; otherwise ")" would be good
-  ;; enough as delimeter.
-  (set (make-local-variable 'directory-listing-before-filename-regexp)
-  (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
-         ;; In some locales, month abbreviations are as short as 2 letters,
-         ;; and they can be followed by ".".
-         (month (concat l l "+\\.?"))
-         (s " ")
-         (yyyy "[0-9][0-9][0-9][0-9]")
-         (dd "[ 0-3][0-9]")
-         (HH:MM "[ 0-2][0-9]:[0-5][0-9]")
-         (seconds "[0-6][0-9]\\([.,][0-9]+\\)?")
-         (zone "[-+][0-2][0-9][0-5][0-9]")
-         (iso-mm-dd "[01][0-9]-[0-3][0-9]")
-         (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?"))
-         (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time
-                      "\\|" yyyy "-" iso-mm-dd "\\)"))
-         (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)"
-                          s "+"
-                          "\\(" HH:MM "\\|" yyyy "\\)"))
-         (western-comma (concat month s "+" dd "," s "+" yyyy))
-         ;; Japanese MS-Windows ls-lisp has one-digit months, and
-         ;; omits the Kanji characters after month and day-of-month.
-         (mm "[ 0-1]?[0-9]")
-         (japanese
-          (concat mm l "?" s dd l "?" s "+"
-                  "\\(" HH:MM "\\|" yyyy l "?" "\\)")))
-    ;; the .* below ensures that we find the last match on a line
-    (concat ".*" s
-            "\\(" western "\\|" western-comma "\\|" japanese "\\|" iso "\\)"
-            s "+")))
-  (and (boundp 'vc-dired-switches)
-       vc-dired-switches
-       (set (make-local-variable 'dired-actual-switches)
-            vc-dired-switches))
-  (set (make-local-variable 'vc-dired-terse-mode) vc-dired-terse-display)
-  ;;(let ((backend-name (symbol-name (vc-responsible-backend
-  ;;			    default-directory))))
-  ;;  (setq mode-name (concat mode-name backend-name))
-  ;;  ;; Add menu after `vc-dired-mode-map' has `dired-mode-map' as the parent.
-  ;;  (let ((vc-dire-menu-map (copy-keymap vc-menu-map)))
-  ;;    (define-key-after (lookup-key vc-dired-mode-map [menu-bar]) [vc]
-  ;;	(cons backend-name vc-dire-menu-map) 'subdir)))
-  (setq vc-dired-mode t))
-
-(defun vc-dired-toggle-terse-mode ()
-  "Toggle terse display in VC Dired."
-  (interactive)
-  (if (not vc-dired-mode)
-      nil
-    (setq vc-dired-terse-mode (not vc-dired-terse-mode))
-    (if vc-dired-terse-mode
-        (vc-dired-hook)
-      (revert-buffer))))
-
-(defun vc-dired-mark-locked ()
-  "Mark all files currently locked."
-  (interactive)
-  (dired-mark-if (let ((f (dired-get-filename nil t)))
-		   (and f
-			(not (file-directory-p f))
-			(not (vc-up-to-date-p f))))
-		 "locked file"))
-
-(define-key vc-dired-mode-map "*l" 'vc-dired-mark-locked)
-
-(defun vc-dired-reformat-line (vc-info)
-  "Reformat a directory-listing line.
-Replace various columns with version control information, VC-INFO.
-This code, like dired, assumes UNIX -l format."
-  (beginning-of-line)
-  (when (re-search-forward
-         ;; Match link count, owner, group, size.  Group may be missing,
-         ;; and only the size is present in OS/2 -l format.
-         "^..[drwxlts-]+ \\( *[0-9]+\\( [^ ]+ +\\([^ ]+ +\\)?[0-9]+\\)?\\) "
-         (line-end-position) t)
-      (replace-match (substring (concat vc-info "          ") 0 10)
-                     t t nil 1)))
-
-(defun vc-dired-ignorable-p (filename)
-  "Should FILENAME be ignored in VC-Dired listings?"
-  (catch t
-    ;; Ignore anything that wouldn't be found by completion (.o, .la, etc.)
-    (dolist (ignorable completion-ignored-extensions)
-      (let ((ext (substring filename
-			      (- (length filename)
-				 (length ignorable)))))
-	(if (string= ignorable ext) (throw t t))))
-    ;; Ignore Makefiles derived from something else
-    (when (string= (file-name-nondirectory filename) "Makefile")
-      (let* ((dir (file-name-directory filename))
-	    (peers (directory-files (or dir default-directory))))
-	(if (or (member "Makefile.in" peers) (member "Makefile.am" peers))
-	   (throw t t))))
-    nil))
-
-(defun vc-dired-purge ()
-  "Remove empty subdirs."
-  (goto-char (point-min))
-  (while (dired-get-subdir)
-    (forward-line 2)
-    (if (dired-get-filename nil t)
-	(if (not (dired-next-subdir 1 t))
-	    (goto-char (point-max)))
-      (forward-line -2)
-      (if (not (string= (dired-current-directory) default-directory))
-	  (dired-do-kill-lines t "")
-	;; We cannot remove the top level directory.
-	;; Just make it look a little nicer.
-	(forward-line 1)
-	(or (eobp) (kill-line))
-	(if (not (dired-next-subdir 1 t))
-	    (goto-char (point-max))))))
-  (goto-char (point-min)))
-
-(defun vc-dired-buffers-for-dir (dir)
-  "Return a list of all vc-dired buffers that currently display DIR."
-  (let (result)
-    ;; Check whether dired is loaded.
-    (when (fboundp 'dired-buffers-for-dir)
-      (dolist (buffer (dired-buffers-for-dir dir))
-        (with-current-buffer buffer
-          (when vc-dired-mode
-	    (push buffer result)))))
-    (nreverse result)))
-
-;;;###autoload
-(defun vc-directory (dir read-switches)
-  "Create a buffer in VC Dired Mode for directory DIR.
-
-See Info node `VC Dired Mode'.
-
-With prefix arg READ-SWITCHES, specify a value to override
-`dired-listing-switches' when generating the listing."
-  (interactive "DDired under VC (directory): \nP")
-  (let ((vc-dired-switches (concat vc-dired-listing-switches
-                                   (if vc-dired-recurse "R" ""))))
-    (if read-switches
-        (setq vc-dired-switches
-              (read-string "Dired listing switches: "
-                           vc-dired-switches)))
-    (require 'dired)
-    (require 'dired-aux)
-    (switch-to-buffer
-     (dired-internal-noselect (expand-file-name (file-name-as-directory dir))
-                              vc-dired-switches
-                              'vc-dired-mode))))
-
 ;; The ewoc-based vc-directory implementation
 
 (defcustom vc-dir-mode-hook nil
@@ -1459,17 +1246,6 @@
 (defun vc-directory-resynch-file (&optional fname)
   "Update the entries for FILE in any directory buffers that list it."
   (let ((file (or fname (expand-file-name buffer-file-name))))
-    ;; The VC-Dired case
-    (let ((buffers (vc-dired-buffers-for-dir (file-name-directory file))))
-      (when buffers
-	(mapc (lambda (buffer)
-		(with-current-buffer buffer
-		  (when (dired-goto-file file)
-		    ;; bind vc-dired-terse-mode to nil so that
-		    ;; files won't vanish when they are checked in
-		    (let ((vc-dired-terse-mode nil))
-		      (dired-do-redisplay 1)))))
-	      buffers)))
     ;; The vc-dir case
     (let ((found-vc-dir-buf nil))
       (save-excursion
@@ -1550,7 +1326,7 @@
 
 (defun vc-dispatcher-browsing ()
   "Are we in a directory browser buffer?"
-  (or vc-dired-mode (eq major-mode 'vc-dir-mode)))
+  (eq major-mode 'vc-dir-mode))
 
 (defun vc-dispatcher-selection-set (eligible
 				   &optional 
@@ -1558,11 +1334,11 @@
 				   allow-ineligible
 				   include-files-not-directories)
   "Deduce a set of files to which to apply an operation. Return the fileset.
-If we're in VC-dired mode, the fileset is the list of marked files.
+If we're in a directory display, the fileset is the list of marked files.
 Otherwise, if we're looking at a buffer for which ELIGIBLE returns non-NIL,
 the fileset is a singleton containing this file.
 If neither of these things is true, but ALLOW-DIRECTORY-WILDCARD is on
-and we're in a dired buffer, select the current directory.
+and we're in a directory buffer, select the current directory.
 If none of these conditions is met, but ALLOW-INELIGIBLE is on and the
 visited file is not registered, return a singleton fileset containing it.
 If INCLUDE-FILES-NOT-DIRECTORIES then if directories are marked,
@@ -1571,12 +1347,6 @@
 Otherwise, throw an error."
   (let ((files
     (cond
-     ;; Browsing with dired
-     (vc-dired-mode
-      (let ((marked (dired-map-over-marks (dired-get-filename) nil)))
-	(if marked
-	    marked
-	  (error "No files have been selected."))))
      ;; Browsing with vc-dir
      ((eq major-mode 'vc-dir-mode)
       (or
@@ -1602,11 +1372,8 @@
      ;; making diffs, or possibly for destructive ones that have
      ;; confirmation prompts.
      ((and allow-directory-wildcard
-	   ;; I think this is a misfeature.  For now, I'll leave it in, but
-	   ;; I'll disable it anywhere else than in dired buffers.  --Stef
-	   (and (derived-mode-p 'dired-mode)
 		(equal buffer-file-name nil)
-		(equal list-buffers-directory default-directory)))
+		(equal list-buffers-directory default-directory))
       (progn
 	(message "All eligible files below %s selected."
 		 default-directory)
--- a/lisp/vc-git.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc-git.el	Wed May 07 21:27:41 2008 +0000
@@ -50,7 +50,6 @@
 ;; * registered (file)				   OK
 ;; * state (file)				   OK
 ;; - state-heuristic (file)			   NOT NEEDED
-;; - dir-state (dir)				   OK
 ;; * working-revision (file)			   OK
 ;; - latest-on-branch-p (file)			   NOT NEEDED
 ;; * checkout-model (files)			   OK
@@ -175,14 +174,6 @@
 	  (vc-file-setprop file 'vc-state state))
 	(setq start (point))))))
 
-(defun vc-git-dir-state (dir)
-  "Git-specific version of `dir-state'."
-  (vc-git--ls-files-state 'up-to-date "-c")
-  (vc-git--ls-files-state 'edited "-m")
-  (vc-git--ls-files-state 'removed "-d")
-  (vc-git--ls-files-state 'ignored "-o" "-i" "--exclude-standard")
-  (vc-git--ls-files-state nil "-o" "--exclude-standard"))
-
 (defun vc-git-working-revision (file)
   "Git-specific version of `vc-working-revision'."
   (let ((str (with-output-to-string
--- a/lisp/vc-hg.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc-hg.el	Wed May 07 21:27:41 2008 +0000
@@ -42,7 +42,6 @@
 ;; * registered (file)                         OK
 ;; * state (file)                              OK
 ;; - state-heuristic (file)                    ?? PROBABLY NOT NEEDED
-;; - dir-state (dir)                           OK
 ;; * working-revision (file)                   OK
 ;; - latest-on-branch-p (file)                 ??
 ;; * checkout-model (files)                    OK
@@ -179,54 +178,6 @@
 	     ((eq state ?C) 'up-to-date) ;; Older mercurials use this
 	     (t 'up-to-date)))))))
 
-(defun vc-hg-dir-state (dir)
-  (with-temp-buffer
-    (buffer-disable-undo)		;; Because these buffers can get huge
-    (vc-hg-command (current-buffer) nil dir "status" "-A")
-    (goto-char (point-min))
-    (let ((status-char nil)
-	  (file nil))
-      (while (not (eobp))
-	(setq status-char (char-after))
-	(setq file
-	      (expand-file-name
-	       (buffer-substring-no-properties (+ (point) 2)
-					       (line-end-position))))
-	(cond
-	 ;; State flag for a clean file is now C, might change to =.
-	 ;; The rest of the possible states in "hg status" output:
-	 ;; 	 ! = deleted, but still tracked
-	 ;; should not show up in VC directory buffers, so don't deal with them
-	 ;; here.
-
-	 ;; Mercurial up to 0.9.5 used C, = is used now.
- 	 ((or (eq status-char ?=) (eq status-char ?C))
-	  (vc-file-setprop file 'vc-backend 'Hg)
- 	  (vc-file-setprop file 'vc-state 'up-to-date))
-	 ((eq status-char ?A)
-	  (vc-file-setprop file 'vc-backend 'Hg)
-	  (vc-file-setprop file 'vc-working-revision "0")
-	  (vc-file-setprop file 'vc-state 'added))
-	 ((eq status-char ?R)
-	  (vc-file-setprop file 'vc-backend 'Hg)
-	  (vc-file-setprop file 'vc-state 'removed))
-	 ((eq status-char ?M)
-	  (vc-file-setprop file 'vc-backend 'Hg)
-	  (vc-file-setprop file 'vc-state 'edited))
-	 ((eq status-char ?I)
-	  (vc-file-setprop file 'vc-backend 'Hg)
-	  (vc-file-setprop file 'vc-state 'ignored))
-	 ((eq status-char ??)
-	  (vc-file-setprop file 'vc-backend 'none)
-	  (vc-file-setprop file 'vc-state 'unregistered))
-	 ((eq status-char ?!)
-	  (vc-file-setprop file 'vc-backend 'Hg)
-	  (vc-file-setprop file 'vc-state 'missing))
-	 (t	;; Presently C, might change to = in 0.9.6
-	  (vc-file-setprop file 'vc-backend 'Hg)
-	  (vc-file-setprop file 'vc-state 'up-to-date)))
-	(forward-line)))))
-
 (defun vc-hg-working-revision (file)
   "Hg-specific version of `vc-working-revision'."
   (let*
--- a/lisp/vc-hooks.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc-hooks.el	Wed May 07 21:27:41 2008 +0000
@@ -519,7 +519,7 @@
   'missing           The file is not present in the file system, but the VC
                      system still tracks it.
 
-  'ignored           The file showed up in a dir-state listing with a flag
+  'ignored           The file showed up in a dir-status listing with a flag
                      indicating the version-control system is ignoring it,
                      Note: This property is not set reliably (some VCSes
                      don't have useful directory-status commands) so assume
--- a/lisp/vc-mcvs.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc-mcvs.el	Wed May 07 21:27:41 2008 +0000
@@ -175,26 +175,6 @@
 
 (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 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)
-	(vc-mcvs-dir-state-heuristic dir)
-      (let ((default-directory dir))
-	;; Don't specify DIR in this command, the default-directory is
-	;; enough.  Otherwise it might fail with remote repositories.
-	(with-temp-buffer
-	  (buffer-disable-undo)		;; Because these buffers can get huge
-	  (setq default-directory (vc-mcvs-root dir))
-	  (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))
-	    (vc-cvs-parse-status)
-	    (goto-char (point-max))
-	    (widen)))))))
-
 (defun vc-mcvs-working-revision (file)
   (vc-cvs-working-revision
    (expand-file-name (vc-file-getprop file 'mcvs-inode)
--- a/lisp/vc-svn.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc-svn.el	Wed May 07 21:27:41 2008 +0000
@@ -146,17 +146,6 @@
   "SVN-specific state heuristic."
   (vc-svn-state file 'local))
 
-(defun vc-svn-dir-state (dir &optional localp)
-  "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
-    ;; enough.  Otherwise it might fail with remote repositories.
-    (with-temp-buffer
-      (buffer-disable-undo)		;; Because these buffers can get huge
-      (vc-svn-command t 0 nil "status" (if localp "-v" "-u"))
-      (vc-svn-parse-status))))
-
 (defun vc-svn-after-dir-status (callback)
   (let ((state-map '((?A . added)
                      (?C . conflict)
--- a/lisp/vc.el	Wed May 07 18:18:04 2008 +0000
+++ b/lisp/vc.el	Wed May 07 21:27:41 2008 +0000
@@ -138,7 +138,7 @@
 ;;   reliable state computation; it is usually called immediately after
 ;;   C-x v v.  If you want to use a faster heuristic when visiting a
 ;;   file, put that into `state-heuristic' below.  Note that under most
-;;   VCSes this won't be called at all, dir-state or dir-stus is used instead.
+;;   VCSes this won't be called at all, dir-status is used instead.
 ;;
 ;; - state-heuristic (file)
 ;;
@@ -147,17 +147,6 @@
 ;;   than the implementation of `state'.  For a list of possible values,
 ;;   see the doc string of `vc-state'.
 ;;
-;; - dir-state (dir)
-;;
-;;   If provided, this function is used to find the version control
-;;   state of as many files as possible in DIR, and all subdirectories
-;;   of DIR, in a fast way; it is used to avoid expensive indivitual
-;;   vc-state calls.  The function should not return anything, but
-;;   rather store the files' states into the corresponding properties.
-;;   Two properties are required: `vc-backend' and `vc-state'.  (Note:
-;;   in older versions this method was not required to recurse into
-;;   subdirectories.)
-;;
 ;; - dir-status (dir update-function)
 ;;
 ;;   Produce RESULT: a list of lists of the form (FILE VC-STATE EXTRA)
@@ -620,7 +609,7 @@
 ;;
 ;; - vc-diff, vc-annotate, etc. need to deal better with unregistered
 ;;   files. Now that unregistered and ignored files are shown in
-;;   vc-dired/vc-dir, it is possible that these commands are called
+;;   vc-dir, it is possible that these commands are called
 ;;   for unregistered/ignored files.
 ;;
 ;; - do not default to RCS anymore when the current directory is not
@@ -637,7 +626,7 @@
 ;;   are supposed to work with.
 ;;
 ;; - Another important thing: merge all the status-like backend operations.
-;;   We should remove dir-status, state, dir-state, and dir-status-files, and
+;;   We should remove dir-status, state, and dir-status-files, and
 ;;   replace them with just `status' which takes a fileset and a continuation
 ;;   (like dir-status) and returns a buffer in which the process(es) are run
 ;;   (or nil if it worked synchronously).  Hopefully we can define the old
@@ -658,8 +647,6 @@
 (require 'ewoc)
 
 (eval-when-compile
-  (require 'dired)
-  (require 'dired-aux)
   (require 'cl))
 
 (unless (assoc 'vc-parent-buffer minor-mode-alist)
@@ -1042,9 +1029,7 @@
 (defun vc-ensure-vc-buffer ()
   "Make sure that the current buffer visits a version-controlled file."
   (cond
-   (vc-dired-mode
-    (set-buffer (find-file-noselect (dired-get-filename))))
-   ((eq major-mode 'vc-dir-mode)
+   ((vc-dispatcher-browsing)
     (set-buffer (find-file-noselect (vc-dir-current-file))))
    (t
     (while (and vc-parent-buffer
@@ -1642,9 +1627,7 @@
 working revisions.  With a prefix argument HISTORIC, it reads two revision
 designators specifying which revisions to compare.
 
-If no current fileset is available (that is, we are not in
-VC-Dired mode and the visited file of the current buffer is not
-under version control) and we're in a Dired buffer, use
+If no current fileset is available and we're in a directory buffer, use
 the current directory.
 The optional argument NOT-URGENT non-nil means it is ok to say no to
 saving the buffer."
@@ -1823,85 +1806,6 @@
 ;;;###autoload
 (defalias 'vc-resolve-conflicts 'smerge-ediff)
 
-;; VC Dired hook 
-;; FIXME: Remove Dired support when vc-dir is ready.
-
-(defun vc-dired-hook ()
-  "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... ")
-  ;; 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)
-	(buffer-undo-list t))
-    (goto-char (point-min))
-    (while (not (eobp))
-      (cond
-       ;; subdir header line
-       ((dired-get-subdir)
-        (forward-line 1)
-        ;; erase (but don't remove) the "total" line
-	(delete-region (point) (line-end-position))
-	(beginning-of-line)
-	(forward-line 1))
-       ;; file line
-       ((setq filename (dired-get-filename nil t))
-        (cond
-         ;; subdir
-         ((file-directory-p filename)
-          (cond
-           ((member (file-name-nondirectory filename)
-                    vc-directory-exclusion-list)
-            (let ((pos (point)))
-              (dired-kill-tree filename)
-              (goto-char pos)
-              (dired-kill-line)))
-           (vc-dired-terse-mode
-            ;; Don't show directories in terse mode.  Don't use
-            ;; dired-kill-line to remove it, because in recursive listings,
-            ;; that would remove the directory contents as well.
-            (delete-region (line-beginning-position)
-                           (progn (forward-line 1) (point))))
-           ((string-match "\\`\\.\\.?\\'" (file-name-nondirectory filename))
-            (dired-kill-line))
-           (t
-            (vc-dired-reformat-line nil)
-            (forward-line 1))))
-	 ;; Try to head off calling the expensive state query -
-	 ;; ignore object files, TeX intermediate files, and so forth.
-	 ((vc-dired-ignorable-p filename)
-	  (dired-kill-line))
-         ;; Ordinary file -- call the (possibly expensive) state query
-	 ;;
-	 ;; First case: unregistered or unknown. (Unknown shouldn't happen here)
-	 ((member (vc-state filename) '(nil unregistered))
-	  (if vc-dired-terse-mode
-	      (dired-kill-line)
-	    (vc-dired-reformat-line "?")
-	    (forward-line 1)))
-	 ;; Either we're in non-terse mode or it's out of date
-	 ((not (and vc-dired-terse-mode (vc-up-to-date-p filename)))
-	  (vc-dired-reformat-line (vc-call prettify-state-info filename))
-	  (forward-line 1))
-	 ;; Remaining cases are under version control but uninteresting
-	 (t
-	  (dired-kill-line))))
-       ;; any other line
-       (t (forward-line 1))))
-    (vc-dired-purge))
-  (message "Getting version information... done")
-  (save-restriction
-    (widen)
-    (cond ((eq (count-lines (point-min) (point-max)) 1)
-           (goto-char (point-min))
-           (message "No changes pending under %s" default-directory)))))
-
 ;; VC status implementation
 
 (defun vc-default-status-extra-headers (backend dir)