diff options
| author | Dan Nicolaescu | 2008-03-21 06:02:51 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2008-03-21 06:02:51 +0000 |
| commit | 21f3a27763e8a2838ebf2ddcf3d08a618a1aa1b0 (patch) | |
| tree | 2080633d9fb35c5826ba83c900ada1e4e55e9ddc | |
| parent | 6a3f9bb72de2ea13801701c98fe27fbf41d6a4f4 (diff) | |
| download | emacs-21f3a27763e8a2838ebf2ddcf3d08a618a1aa1b0.tar.gz emacs-21f3a27763e8a2838ebf2ddcf3d08a618a1aa1b0.zip | |
(vc-status-mark-buffer-changed): Better deal with files in
the 'added state.
(vc-status-remove-up-to-date): New function.
(vc-status-mode-map, vc-status-menu-map): Bind it.
(vc-status-printer): Use a different face up-to-date files.
(vc-resynch-buffer): Update the vc-status buffer if it exists.
(Todo): Remove solved entries.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/vc.el | 84 |
2 files changed, 50 insertions, 42 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1bc7531e84d..8d5d71575b0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | 2008-03-21 Dan Nicolaescu <dann@ics.uci.edu> | 1 | 2008-03-21 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 2 | ||
| 3 | * vc.el (vc-status-mark-buffer-changed): Better deal with files in | ||
| 4 | the 'added state. | ||
| 5 | (vc-status-remove-up-to-date): New function. | ||
| 6 | (vc-status-mode-map, vc-status-menu-map): Bind it. | ||
| 7 | (vc-status-printer): Use a different face up-to-date files. | ||
| 8 | (vc-resynch-buffer): Update the vc-status buffer if it exists. | ||
| 9 | (Todo): Remove solved entries. | ||
| 10 | |||
| 3 | * vc-hg.el (vc-hg-state): | 11 | * vc-hg.el (vc-hg-state): |
| 4 | * vc-git.el (vc-git-state): | 12 | * vc-git.el (vc-git-state): |
| 5 | * vc-cvs.el (vc-cvs-parse-status): | 13 | * vc-cvs.el (vc-cvs-parse-status): |
diff --git a/lisp/vc.el b/lisp/vc.el index 412e7b85fce..be7516e6237 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -553,8 +553,6 @@ | |||
| 553 | 553 | ||
| 554 | ;;; Todo: | 554 | ;;; Todo: |
| 555 | 555 | ||
| 556 | ;; - vc-state needs a new state for `added'. | ||
| 557 | ;; | ||
| 558 | ;; - vc-update/vc-merge should deal with VC systems that don't | 556 | ;; - vc-update/vc-merge should deal with VC systems that don't |
| 559 | ;; update/merge on a file basis, but on a whole repository basis. | 557 | ;; update/merge on a file basis, but on a whole repository basis. |
| 560 | ;; | 558 | ;; |
| @@ -592,12 +590,6 @@ | |||
| 592 | ;; them, or remove them from the VCS. C-x v v might also need | 590 | ;; them, or remove them from the VCS. C-x v v might also need |
| 593 | ;; adjustments. | 591 | ;; adjustments. |
| 594 | ;; | 592 | ;; |
| 595 | ;; - when changing a file whose directory is shown in the vc-status | ||
| 596 | ;; buffer, it should be added there as "modified". (PCL-CVS does this). | ||
| 597 | ;; | ||
| 598 | ;; - Update the vc-status buffers after vc operations, implement the | ||
| 599 | ;; equivalent of vc-dired-resynch-file. | ||
| 600 | ;; | ||
| 601 | ;; - vc-status needs a toolbar. | 593 | ;; - vc-status needs a toolbar. |
| 602 | ;; | 594 | ;; |
| 603 | ;; - vc-status: refresh should not completely wipe out the current | 595 | ;; - vc-status: refresh should not completely wipe out the current |
| @@ -1791,10 +1783,15 @@ rather than user editing!" | |||
| 1791 | (if (string= buffer-file-name file) | 1783 | (if (string= buffer-file-name file) |
| 1792 | (vc-resynch-window file keep noquery) | 1784 | (vc-resynch-window file keep noquery) |
| 1793 | (let ((buffer (get-file-buffer file))) | 1785 | (let ((buffer (get-file-buffer file))) |
| 1794 | (if buffer | 1786 | (when buffer |
| 1795 | (with-current-buffer buffer | 1787 | (with-current-buffer buffer |
| 1796 | (vc-resynch-window file keep noquery))))) | 1788 | (vc-resynch-window file keep noquery))))) |
| 1797 | (vc-dired-resynch-file file)) | 1789 | (vc-dired-resynch-file file) |
| 1790 | (when (memq 'vc-status-mark-buffer-changed after-save-hook) | ||
| 1791 | (let ((buffer (get-file-buffer file))) | ||
| 1792 | (with-current-buffer buffer | ||
| 1793 | (when buffer (vc-status-mark-buffer-changed)))))) | ||
| 1794 | |||
| 1798 | 1795 | ||
| 1799 | (defun vc-start-entry (files rev comment initial-contents msg action &optional after-hook) | 1796 | (defun vc-start-entry (files rev comment initial-contents msg action &optional after-hook) |
| 1800 | "Accept a comment for an operation on FILES revision REV. | 1797 | "Accept a comment for an operation on FILES revision REV. |
| @@ -2665,20 +2662,23 @@ With prefix arg READ-SWITCHES, specify a value to override | |||
| 2665 | (defun vc-status-printer (fileentry) | 2662 | (defun vc-status-printer (fileentry) |
| 2666 | "Pretty print FILEENTRY." | 2663 | "Pretty print FILEENTRY." |
| 2667 | ;; If you change the layout here, change vc-status-move-to-goal-column. | 2664 | ;; If you change the layout here, change vc-status-move-to-goal-column. |
| 2668 | (insert | 2665 | (let ((state (vc-status-fileinfo->state fileentry))) |
| 2669 | (propertize | 2666 | (insert |
| 2670 | (format "%c" (if (vc-status-fileinfo->marked fileentry) ?* ? )) | 2667 | (propertize |
| 2671 | 'face 'font-lock-type-face) | 2668 | (format "%c" (if (vc-status-fileinfo->marked fileentry) ?* ? )) |
| 2672 | " " | 2669 | 'face 'font-lock-type-face) |
| 2673 | (propertize | 2670 | " " |
| 2674 | (format "%-20s" (vc-status-fileinfo->state fileentry)) | 2671 | (propertize |
| 2675 | 'face 'font-lock-variable-name-face | 2672 | (format "%-20s" state) |
| 2676 | 'mouse-face 'highlight) | 2673 | 'face (if (eq state 'up-to-date) |
| 2677 | " " | 2674 | 'font-lock-builtin-face |
| 2678 | (propertize | 2675 | 'font-lock-variable-name-face) |
| 2679 | (format "%s" (vc-status-fileinfo->name fileentry)) | 2676 | 'mouse-face 'highlight) |
| 2680 | 'face 'font-lock-function-name-face | 2677 | " " |
| 2681 | 'mouse-face 'highlight))) | 2678 | (propertize |
| 2679 | (format "%s" (vc-status-fileinfo->name fileentry)) | ||
| 2680 | 'face 'font-lock-function-name-face | ||
| 2681 | 'mouse-face 'highlight)))) | ||
| 2682 | 2682 | ||
| 2683 | (defun vc-status-move-to-goal-column () | 2683 | (defun vc-status-move-to-goal-column () |
| 2684 | (beginning-of-line) | 2684 | (beginning-of-line) |
| @@ -2702,7 +2702,9 @@ With prefix arg READ-SWITCHES, specify a value to override | |||
| 2702 | (define-key map [refresh] | 2702 | (define-key map [refresh] |
| 2703 | '(menu-item "Refresh" vc-status-refresh | 2703 | '(menu-item "Refresh" vc-status-refresh |
| 2704 | :help "Refresh the contents of the VC status buffer")) | 2704 | :help "Refresh the contents of the VC status buffer")) |
| 2705 | 2705 | (define-key map [remup] | |
| 2706 | '(menu-item "Remove up-to-date" vc-status-remove-up-to-date | ||
| 2707 | :help "Remove up-to-date items from display")) | ||
| 2706 | ;; VC commands. | 2708 | ;; VC commands. |
| 2707 | (define-key map [separator-vc-commands] '("--")) | 2709 | (define-key map [separator-vc-commands] '("--")) |
| 2708 | (define-key map [annotate] | 2710 | (define-key map [annotate] |
| @@ -2786,6 +2788,7 @@ With prefix arg READ-SWITCHES, specify a value to override | |||
| 2786 | ;; The remainder. | 2788 | ;; The remainder. |
| 2787 | (define-key map "f" 'vc-status-find-file) | 2789 | (define-key map "f" 'vc-status-find-file) |
| 2788 | (define-key map "o" 'vc-status-find-file-other-window) | 2790 | (define-key map "o" 'vc-status-find-file-other-window) |
| 2791 | (define-key map "x" 'vc-status-remove-up-to-date) | ||
| 2789 | (define-key map "q" 'bury-buffer) | 2792 | (define-key map "q" 'bury-buffer) |
| 2790 | (define-key map "g" 'vc-status-refresh) | 2793 | (define-key map "g" 'vc-status-refresh) |
| 2791 | (define-key map "\C-c\C-c" 'vc-status-kill-dir-status-process) | 2794 | (define-key map "\C-c\C-c" 'vc-status-kill-dir-status-process) |
| @@ -3118,9 +3121,16 @@ that share the same state." | |||
| 3118 | vc-status | 3121 | vc-status |
| 3119 | (lambda (crt) (vc-status-fileinfo->marked crt))))) | 3122 | (lambda (crt) (vc-status-fileinfo->marked crt))))) |
| 3120 | 3123 | ||
| 3124 | (defun vc-status-remove-up-to-date () | ||
| 3125 | "Remove up-to-date items from display." | ||
| 3126 | (interactive) | ||
| 3127 | (ewoc-filter | ||
| 3128 | vc-status | ||
| 3129 | (lambda (crt) (not (eq (vc-status-fileinfo->state crt) 'up-to-date))))) | ||
| 3130 | |||
| 3121 | (defun vc-status-mark-buffer-changed () | 3131 | (defun vc-status-mark-buffer-changed () |
| 3122 | (let* ((file (expand-file-name buffer-file-name)) | 3132 | (let* ((file (expand-file-name buffer-file-name)) |
| 3123 | (version (and (vc-backend file) (vc-working-revision file))) | 3133 | (state (and (vc-backend file) (vc-state file))) |
| 3124 | (found-vc-status-buf nil)) | 3134 | (found-vc-status-buf nil)) |
| 3125 | (save-excursion | 3135 | (save-excursion |
| 3126 | (dolist (status-buf (buffer-list)) | 3136 | (dolist (status-buf (buffer-list)) |
| @@ -3128,21 +3138,11 @@ that share the same state." | |||
| 3128 | ;; look for a vc-status buffer that might show this file. | 3138 | ;; look for a vc-status buffer that might show this file. |
| 3129 | (when (eq major-mode 'vc-status-mode) | 3139 | (when (eq major-mode 'vc-status-mode) |
| 3130 | (setq found-vc-status-buf t) | 3140 | (setq found-vc-status-buf t) |
| 3131 | (let ((def-dir (expand-file-name default-directory))) | 3141 | (let ((ddir (expand-file-name default-directory))) |
| 3132 | ;; This test is cvs-string-prefix-p | 3142 | ;; This test is cvs-string-prefix-p |
| 3133 | (when (eq t (compare-strings file nil (length def-dir) def-dir nil nil)) | 3143 | (when (eq t (compare-strings file nil (length ddir) ddir nil nil)) |
| 3134 | (let* ((file-short | 3144 | (let* ((file-short (substring file (length ddir))) |
| 3135 | (substring file (length def-dir))) | 3145 | (entry (cons file-short (if state state 'unregistered)))) |
| 3136 | (entry | ||
| 3137 | (cons | ||
| 3138 | file-short | ||
| 3139 | (if version | ||
| 3140 | ;; This it not the correct test to check if | ||
| 3141 | ;; the files is "added" for all backends. | ||
| 3142 | ;; It does not work for git for example. | ||
| 3143 | ;; vc-state needs a new state: `added'. | ||
| 3144 | (if (string= "0" version) 'added 'modified) | ||
| 3145 | 'unregistered)))) | ||
| 3146 | (vc-status-add-entry entry status-buf)))))) | 3146 | (vc-status-add-entry entry status-buf)))))) |
| 3147 | ;; We didn't find any vc-status buffers, remove the hook, it is | 3147 | ;; We didn't find any vc-status buffers, remove the hook, it is |
| 3148 | ;; not needed. | 3148 | ;; not needed. |