changeset 87853:cec6a1fe32a4

* vc-svn.el (vc-svn-after-dir-status): New function. (vc-svn-dir-status): Run svn asynchronously.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sat, 19 Jan 2008 16:32:23 +0000
parents cebb39d21e41
children 00321492f35d
files lisp/ChangeLog lisp/vc-svn.el
diffstat 2 files changed, 33 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Jan 19 16:29:08 2008 +0000
+++ b/lisp/ChangeLog	Sat Jan 19 16:32:23 2008 +0000
@@ -1,3 +1,8 @@
+2008-01-19  Tom Tromey  <tromey@redhat.com>
+
+        * vc-svn.el (vc-svn-after-dir-status): New function.
+        (vc-svn-dir-status): Run svn asynchronously.
+
 2008-01-19  Martin Rudalics  <rudalics@gmx.at>
 
 	* progmodes/hideif.el (hide-ifdef-shadow): New option.
--- a/lisp/vc-svn.el	Sat Jan 19 16:29:08 2008 +0000
+++ b/lisp/vc-svn.el	Sat Jan 19 16:32:23 2008 +0000
@@ -158,28 +158,34 @@
       (vc-svn-command t 0 nil "status" (if localp "-v" "-u"))
       (vc-svn-parse-status))))
 
-(defun vc-svn-dir-status (dir)
-  "Return a list of conses (FILE . STATE) for DIR."
-  (with-temp-buffer
-    (let ((default-directory (file-name-as-directory dir))
-	  (state-map '((?A . added)
-		       (?C . edited)
-		       (?D . removed)
-		       (?I . ignored)
-		       (?M . edited)
-		       (?R . removed)
-		       (?? . unregistered)
-		       ;; This is what vc-svn-parse-status does.
-		       (?~ . edited)))
-	  result)
-      (vc-svn-command t 0 nil "status")
-      (goto-char (point-min))
-      (while (re-search-forward "^\\(.\\)..... \\(.*\\)$" nil t)
-	(let ((state (cdr (assq (aref (match-string 1) 0) state-map)))
-	      (filename (match-string 2)))
-	  (when state
-	    (setq result (cons (cons filename state) result)))))
-      result)))
+(defun vc-svn-after-dir-status (callback buffer)
+  (let ((state-map '((?A . added)
+                    (?C . edited)
+                    (?D . removed)
+                    (?I . ignored)
+                    (?M . edited)
+                    (?R . removed)
+                    (?? . unregistered)
+                    ;; This is what vc-svn-parse-status does.
+                    (?~ . edited)))
+       result)
+    (goto-char (point-min))
+    (while (re-search-forward "^\\(.\\)..... \\(.*\\)$" nil t)
+      (let ((state (cdr (assq (aref (match-string 1) 0) state-map)))
+           (filename (match-string 2)))
+       (when state
+         (setq result (cons (cons filename state) result)))))
+    (funcall callback result buffer)))
+
+(defun vc-svn-dir-status (dir callback buffer)
+  "Run 'svn status' for DIR and update BUFFER via CALLBACK.
+CALLBACK is called as (CALLBACK RESULT BUFFER), where
+RESULT is a list of conses (FILE . STATE) for directory DIR."
+  (with-current-buffer (get-buffer-create
+                       (generate-new-buffer-name " *vc svn status*"))
+    (vc-svn-command (current-buffer) 'async nil "status")
+    (vc-exec-after
+     `(vc-svn-after-dir-status (quote ,callback) ,buffer))))
 
 (defun vc-svn-working-revision (file)
   "SVN-specific version of `vc-working-revision'."