From 1b3f2d4ec6844540ccc6fc51b9e9568036e57236 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Mon, 31 Mar 2008 15:36:56 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 10 ++++++++++ lisp/vc-bzr.el | 2 +- lisp/vc-cvs.el | 6 +++--- lisp/vc-hg.el | 2 +- lisp/vc-svn.el | 2 +- lisp/vc.el | 40 ++++++++++++++++++++++------------------ 6 files changed, 38 insertions(+), 24 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ead7ac18d2..11848ffc6c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2008-03-31 Dan Nicolaescu + + * 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 * doc-view.el: Compute displayed pages first (in PDF). diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index a875210d18..7425b58bfc 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el @@ -675,7 +675,7 @@ Optional argument LOCALP is always ignored." (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))) diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 0d76eb3902..d17240e146 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el @@ -900,7 +900,7 @@ state." (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 @@ state." (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 @@ state." ((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))) diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el index b3f95471fc..8be1be82ee 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el @@ -496,7 +496,7 @@ REV is the revision to check out into WORKFILE." (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))) diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index 5e65d342f3..e36a16d775 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el @@ -174,7 +174,7 @@ If you want to force an empty list of arguments, use 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))))) + (setq result (cons (list filename state) result))))) (funcall callback result buffer))) (defun vc-svn-dir-status (dir callback buffer) diff --git a/lisp/vc.el b/lisp/vc.el index 05293a8cd9..3c3b51f3fa 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -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 @@ With prefix arg READ-SWITCHES, specify a value to override ;; 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 @@ With prefix arg READ-SWITCHES, specify a value to override ;; 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 @@ With prefix arg READ-SWITCHES, specify a value to override (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 @@ that share the same state." (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 @@ that share the same state." ;; 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. -- 2.20.1