aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-04-15 07:28:31 +0000
committerDan Nicolaescu2008-04-15 07:28:31 +0000
commite8847be332241d666f76c7af28d8e5137468dd67 (patch)
treece8396a87241f5130864b38e8d2e82a1c1bc377d
parent769303ae94f11a9cf91d74d0aac0eb75614f46ee (diff)
downloademacs-e8847be332241d666f76c7af28d8e5137468dd67.tar.gz
emacs-e8847be332241d666f76c7af28d8e5137468dd67.zip
(vc-status-fileinfo): Add new member directoryp.
(vc-default-status-printer): Print directories. (vc-status-update): Sort files before subdirectories.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/vc.el57
2 files changed, 39 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7370d00820d..79db7382056 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12008-04-15 Dan Nicolaescu <dann@ics.uci.edu> 12008-04-15 Dan Nicolaescu <dann@ics.uci.edu>
2 2
3 * vc.el (vc-status-fileinfo): Add new member directoryp.
4 (vc-default-status-printer): Print directories.
5 (vc-status-update): Sort files before subdirectories.
6
3 * vc-cvs.el (vc-cvs-after-dir-status, vc-cvs-dir-status): Add 7 * vc-cvs.el (vc-cvs-after-dir-status, vc-cvs-dir-status): Add
4 alternative implementation based on "cvs update". 8 alternative implementation based on "cvs update".
5 9
diff --git a/lisp/vc.el b/lisp/vc.el
index 42d7b0d9d7e..2626ad6f068 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -2714,7 +2714,9 @@ With prefix arg READ-SWITCHES, specify a value to override
2714 extra 2714 extra
2715 marked 2715 marked
2716 ;; To keep track of not updated files during a global refresh 2716 ;; To keep track of not updated files during a global refresh
2717 needs-update) 2717 needs-update
2718 ;; To distinguish files and directories.
2719 directoryp)
2718 2720
2719(defvar vc-status nil) 2721(defvar vc-status nil)
2720 2722
@@ -2738,24 +2740,26 @@ specific headers."
2738 2740
2739(defun vc-default-status-printer (backend fileentry) 2741(defun vc-default-status-printer (backend fileentry)
2740 "Pretty print FILEENTRY." 2742 "Pretty print FILEENTRY."
2741 ;; If you change the layout here, change vc-status-move-to-goal-column. 2743 (if (vc-status-fileinfo->directoryp fileentry)
2742 (let ((state (vc-status-fileinfo->state fileentry))) 2744 (insert " Directory: %s" (vc-status-fileinfo->name fileentry))
2743 (insert 2745 ;; If you change the layout here, change vc-status-move-to-goal-column.
2744 (propertize 2746 (let ((state (vc-status-fileinfo->state fileentry)))
2745 (format "%c" (if (vc-status-fileinfo->marked fileentry) ?* ? )) 2747 (insert
2746 'face 'font-lock-type-face) 2748 (propertize
2747 " " 2749 (format "%c" (if (vc-status-fileinfo->marked fileentry) ?* ? ))
2748 (propertize 2750 'face 'font-lock-type-face)
2749 (format "%-20s" state) 2751 " "
2750 'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face) 2752 (propertize
2751 ((memq state '(missing conflict)) 'font-lock-warning-face) 2753 (format "%-20s" state)
2752 (t 'font-lock-variable-name-face)) 2754 'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face)
2753 'mouse-face 'highlight) 2755 ((memq state '(missing conflict)) 'font-lock-warning-face)
2754 " " 2756 (t 'font-lock-variable-name-face))
2755 (propertize 2757 'mouse-face 'highlight)
2756 (format "%s" (vc-status-fileinfo->name fileentry)) 2758 " "
2757 'face 'font-lock-function-name-face 2759 (propertize
2758 'mouse-face 'highlight)))) 2760 (format "%s" (vc-status-fileinfo->name fileentry))
2761 'face 'font-lock-function-name-face
2762 'mouse-face 'highlight)))))
2759 2763
2760(defun vc-status-printer (fileentry) 2764(defun vc-status-printer (fileentry)
2761 (let ((backend (vc-responsible-backend default-directory))) 2765 (let ((backend (vc-responsible-backend default-directory)))
@@ -3019,9 +3023,18 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
3019 ;; Insert the entries sorted by name into the ewoc. 3023 ;; Insert the entries sorted by name into the ewoc.
3020 ;; We assume the ewoc is sorted too, which should be the 3024 ;; We assume the ewoc is sorted too, which should be the
3021 ;; case if we always add entries with vc-status-update. 3025 ;; case if we always add entries with vc-status-update.
3022 (setq entries (sort entries 3026 (setq entries
3023 (lambda (entry1 entry2) 3027 ;; Sort: first files and then subdirectories.
3024 (string-lessp (car entry1) (car entry2))))) 3028 ;; XXX: this is VERY inefficient, it computes the directory
3029 ;; names too many times
3030 (sort entries
3031 (lambda (entry1 entry2)
3032 (let ((dir1 (file-name-directory (expand-file-name (car entry1))))
3033 (dir2 (file-name-directory (expand-file-name (car entry2)))))
3034 (cond
3035 ((string< dir1 dir2) t)
3036 ((not (string= dir1 dir2)) nil)
3037 ((string< (car entry1) (car entry2))))))))
3025 (let ((entry (car entries)) 3038 (let ((entry (car entries))
3026 (node (ewoc-nth vc-status 0))) 3039 (node (ewoc-nth vc-status 0)))
3027 (while (and entry node) 3040 (while (and entry node)