changeset 93461:3afeea9a48a3

* vc.el (vc-status-add-entry): Assume ENTRY is a list not a cons. (vc-status-mark-buffer-changed): Handle the extra field. * vc-bzr.el (vc-bzr-after-dir-status): * vc-cvs.el (vc-cvs-after-dir-status): * vc-hg.el (vc-hg-after-dir-status): * vc-svn.el (vc-svn-after-dir-status): Return a list not a cons.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 31 Mar 2008 15:36:56 +0000
parents 1f7e9d28dedf
children 263786b8fe73
files lisp/ChangeLog lisp/vc-bzr.el lisp/vc-cvs.el lisp/vc-hg.el lisp/vc-svn.el lisp/vc.el
diffstat 6 files changed, 38 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Mar 31 15:14:16 2008 +0000
+++ b/lisp/ChangeLog	Mon Mar 31 15:36:56 2008 +0000
@@ -1,3 +1,13 @@
+2008-03-31  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* vc.el (vc-status-add-entry): Assume ENTRY is a list not a cons.
+	(vc-status-mark-buffer-changed): Handle the extra field.
+
+	* vc-bzr.el (vc-bzr-after-dir-status):
+	* vc-cvs.el (vc-cvs-after-dir-status):
+	* vc-hg.el (vc-hg-after-dir-status):
+	* vc-svn.el (vc-svn-after-dir-status): Return a list not a cons.
+
 2008-03-31  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* doc-view.el: Compute displayed pages first (in PDF).
--- a/lisp/vc-bzr.el	Mon Mar 31 15:14:16 2008 +0000
+++ b/lisp/vc-bzr.el	Mon Mar 31 15:36:56 2008 +0000
@@ -675,7 +675,7 @@
 	      (buffer-substring-no-properties (+ (point) 4)
 					      (line-end-position)))
 	(setq translated (assoc status-str translation))
-	(push (cons file (cdr translated)) result)
+	(push (list file (cdr translated)) result)
 	(forward-line))
       (funcall update-function result status-buffer)))
 
--- a/lisp/vc-cvs.el	Mon Mar 31 15:14:16 2008 +0000
+++ b/lisp/vc-cvs.el	Mon Mar 31 15:36:56 2008 +0000
@@ -900,7 +900,7 @@
       (while (looking-at "? \\(.*\\)")
 	(setq file (file-relative-name 
 		    (expand-file-name (match-string 1) subdir)))
-	(push (cons file 'unregistered) result)
+	(push (list file 'unregistered) result)
 	(forward-line 1))
       ;; A file entry.
       (when (re-search-forward "^File: " nil t)
@@ -911,7 +911,7 @@
 	  (setq file (file-relative-name 
 		      (expand-file-name (match-string 1) subdir)))
 	  (if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t))
-	      (push (cons file 'unregistered) result)
+	      (push (list file 'unregistered) result)
 	    (setq status-str (match-string 1))
 	    (setq status
 		  (cond
@@ -924,7 +924,7 @@
 		   ((string-match "Locally Removed" status-str) 'removed)
 		   (t 'edited)))
 	    (unless (eq status 'up-to-date)
-	      (push (cons file status) result))))))
+	      (push (list file status) result))))))
       (goto-char (point-max))
       (widen))
       (funcall update-function result status-buffer)))
--- a/lisp/vc-hg.el	Mon Mar 31 15:14:16 2008 +0000
+++ b/lisp/vc-hg.el	Mon Mar 31 15:36:56 2008 +0000
@@ -496,7 +496,7 @@
 					      (line-end-position)))
 	(setq translated (assoc status-char translation))
 	(when (and translated (not (eq (cdr translated) 'up-to-date)))
-	  (push (cons file (cdr translated)) result))
+	  (push (list file (cdr translated)) result))
 	(forward-line))
       (funcall update-function result status-buffer)))
 
--- a/lisp/vc-svn.el	Mon Mar 31 15:14:16 2008 +0000
+++ b/lisp/vc-svn.el	Mon Mar 31 15:36:56 2008 +0000
@@ -174,7 +174,7 @@
       (let ((state (cdr (assq (aref (match-string 1) 0) state-map)))
            (filename (match-string 2)))
        (when state
-         (setq result (cons (cons filename state) result)))))
+         (setq result (cons (list filename state) result)))))
     (funcall callback result buffer)))
 
 (defun vc-svn-dir-status (dir callback buffer)
--- a/lisp/vc.el	Mon Mar 31 15:14:16 2008 +0000
+++ b/lisp/vc.el	Mon Mar 31 15:36:56 2008 +0000
@@ -169,12 +169,14 @@
 ;;
 ;; - dir-status (dir update-function status-buffer)
 ;;
-;;   Produce RESULT: a list of conses of the form (file . vc-state)
-;;   for the files in DIR.  If a command needs to be run to compute
-;;   this list, it should be run asynchronously using (current-buffer)
-;;   as the buffer for the command.  When RESULT is computed, it should
-;;   be passed back by doing: (funcall UPDATE-FUNCTION RESULT STATUS-BUFFER)
-;;   This function is used by `vc-status', a replacement for `vc-dired'.
+;;   Produce RESULT: a list of lists of the form (FILE VC-STATE EXTRA)
+;;   for the files in DIR.
+;;   EXTRA can be used for backend specific information about FILE.
+;;   If a command needs to be run to compute this list, it should be
+;;   run asynchronously using (current-buffer) as the buffer for the
+;;   command.  When RESULT is computed, it should be passed back by
+;;   doing: (funcall UPDATE-FUNCTION RESULT STATUS-BUFFER) This
+;;   function is used by `vc-status', a replacement for `vc-dired'.
 ;;   vc-status is still under development, and is NOT feature
 ;;   complete.  As such, the requirements for this function might
 ;;   change.  This is a replacement for `dir-state'.
@@ -2941,11 +2943,10 @@
       ;; Insert the entries we got into the ewoc.
       (dolist (entry entries)
 	(let* ((file (car entry))
-	       (entrycdr (cdr entry))
-	       (state (if (listp entrycdr) (nth 1 entry)))
-	       (extra (if (listp entrycdr) (nth 2 entry))))
-	(ewoc-enter-last vc-status
-			 (vc-status-create-fileinfo file state extra))))
+	       (state (nth 1 entry))
+	       (extra (nth 2 entry)))
+	  (ewoc-enter-last vc-status
+			   (vc-status-create-fileinfo file state extra))))
       ;; If we had marked items before the refresh, try mark them here.
       ;; XXX: there should be a better way to do this...
       (when vc-status-crt-marked
@@ -2964,7 +2965,7 @@
   ;; This will be used to automatically add files with the "modified"
   ;; state when saving them.
 
-  ;; ENTRY is (FILENAME . STATE)
+  ;; ENTRY has the form (FILENAME STATE EXTRA)
   (with-current-buffer buffer
     (let ((crt (ewoc-nth vc-status 0))
 	  (fname (car entry)))
@@ -2976,14 +2977,13 @@
       (if crt
 	  (progn
 	    ;; Found the file, just update the status.
-	    (setf (vc-status-fileinfo->state (ewoc-data crt)) (cdr entry))
+	    (setf (vc-status-fileinfo->state (ewoc-data crt)) (nth 1 entry))
+	    (setf (vc-status-fileinfo->extra (ewoc-data crt)) (nth 2 entry))
 	    (ewoc-invalidate vc-status crt))
 	;; Could not find the file, insert a new entry.
 	(ewoc-enter-last
-	 ;; XXX: `vc-status-fileinfo->extra' is not set here.
-	 ;; It might need to be.
-	 vc-status 
-	 (vc-status-create-fileinfo (car entry) (cdr entry) nil))))))
+	 vc-status
+	 (vc-status-create-fileinfo fname (nth 1 entry) (nth 2 entry)))))))
 
 (defun vc-status-refresh ()
   "Refresh the contents of the VC status buffer.
@@ -3210,6 +3210,9 @@
 (defun vc-status-mark-buffer-changed (&optional fname)
   (let* ((file (or fname (expand-file-name buffer-file-name)))
 	 (state (and (vc-backend file) (vc-state file)))
+	 ;; XXX: EXTRA is not set here.
+	 ;; It might need to be.
+	 (extra nil)
 	 (found-vc-status-buf nil))
     (save-excursion
       (dolist (status-buf (buffer-list))
@@ -3221,7 +3224,8 @@
 	    ;; This test is cvs-string-prefix-p
 	    (when (eq t (compare-strings file nil (length ddir) ddir nil nil))
 	      (let* ((file-short (substring file (length ddir)))
-		     (entry (cons file-short (if state state 'unregistered))))
+		     (entry
+		      (list file-short (if state state 'unregistered) extra)))
 		(vc-status-add-entry entry status-buf))))))
       ;; We didn't find any vc-status buffers, remove the hook, it is
       ;; not needed.