diff options
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc-bzr.el | 84 | ||||
| -rw-r--r-- | lisp/vc-cvs.el | 32 | ||||
| -rw-r--r-- | lisp/vc-dispatcher.el | 255 | ||||
| -rw-r--r-- | lisp/vc-git.el | 9 | ||||
| -rw-r--r-- | lisp/vc-hg.el | 49 | ||||
| -rw-r--r-- | lisp/vc-hooks.el | 2 | ||||
| -rw-r--r-- | lisp/vc-mcvs.el | 20 | ||||
| -rw-r--r-- | lisp/vc-svn.el | 11 | ||||
| -rw-r--r-- | lisp/vc.el | 106 |
10 files changed, 22 insertions, 551 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e88850fdea7..437c4c2af3f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-05-07 Eric S. Raymond <esr@snark.thyrsus.com> | ||
| 2 | |||
| 3 | * vc.el, vc-dispatcher.el: VC-Dired support removed. The code | ||
| 4 | uses a ewoc-based implementation now. | ||
| 5 | |||
| 1 | 2008-05-07 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2008-05-07 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * tool-bar.el: Choose images dynamically. | 8 | * tool-bar.el: Choose images dynamically. |
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index 92e19df9245..e721cff2884 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el | |||
| @@ -564,90 +564,6 @@ stream. Standard error output is discarded." | |||
| 564 | (apply #'call-process command nil (list (current-buffer) nil) nil args) | 564 | (apply #'call-process command nil (list (current-buffer) nil) nil args) |
| 565 | (buffer-substring (point-min) (point-max))))) | 565 | (buffer-substring (point-min) (point-max))))) |
| 566 | 566 | ||
| 567 | ;; TODO: it would be nice to mark the conflicted files in VC Dired, | ||
| 568 | ;; and implement a command to run ediff and `bzr resolve' once the | ||
| 569 | ;; changes have been merged. | ||
| 570 | (defun vc-bzr-dir-state (dir &optional localp) | ||
| 571 | "Find the VC state of all files in DIR and its subdirectories. | ||
| 572 | Optional argument LOCALP is always ignored." | ||
| 573 | (let ((bzr-root-directory (vc-bzr-root dir)) | ||
| 574 | (at-start t) | ||
| 575 | current-bzr-state current-vc-state) | ||
| 576 | ;; Check that DIR is a bzr repository. | ||
| 577 | (unless (file-name-absolute-p bzr-root-directory) | ||
| 578 | (error "Cannot find bzr repository for directory `%s'" dir)) | ||
| 579 | ;; `bzr ls --versioned' lists all versioned files; | ||
| 580 | ;; assume they are up-to-date, unless we are given | ||
| 581 | ;; evidence of the contrary. | ||
| 582 | (setq at-start t) | ||
| 583 | (with-temp-buffer | ||
| 584 | (buffer-disable-undo) ;; Because these buffers can get huge | ||
| 585 | (vc-bzr-command "ls" t 0 nil "--versioned") | ||
| 586 | (goto-char (point-min)) | ||
| 587 | (while (or at-start | ||
| 588 | (eq 0 (forward-line))) | ||
| 589 | (setq at-start nil) | ||
| 590 | (let ((file (expand-file-name | ||
| 591 | (buffer-substring-no-properties | ||
| 592 | (line-beginning-position) (line-end-position)) | ||
| 593 | bzr-root-directory))) | ||
| 594 | ;; files are up-to-date unless they appear in the `bzr | ||
| 595 | ;; status' output below | ||
| 596 | (vc-file-setprop file 'vc-state 'up-to-date) | ||
| 597 | ;; Anyway, we're looking at the output of `bzr ls | ||
| 598 | ;; --versioned', so we know these files are registered with | ||
| 599 | ;; Bzr. | ||
| 600 | (vc-file-setprop file 'vc-backend 'Bzr)))) | ||
| 601 | ;; `bzr status' reports on added/modified/renamed and unknown/ignored files | ||
| 602 | (setq at-start t) | ||
| 603 | (with-temp-buffer | ||
| 604 | (vc-bzr-command "status" t 0 nil) | ||
| 605 | (goto-char (point-min)) | ||
| 606 | (while (or at-start | ||
| 607 | (eq 0 (forward-line))) | ||
| 608 | (setq at-start nil) | ||
| 609 | (cond | ||
| 610 | ((looking-at "^added") | ||
| 611 | (setq current-vc-state 'added) | ||
| 612 | (setq current-bzr-state 'added)) | ||
| 613 | ((looking-at "^kind changed") | ||
| 614 | (setq current-vc-state 'edited) | ||
| 615 | (setq current-bzr-state 'kindchanged)) | ||
| 616 | ((looking-at "^modified") | ||
| 617 | (setq current-vc-state 'edited) | ||
| 618 | (setq current-bzr-state 'modified)) | ||
| 619 | ((looking-at "^renamed") | ||
| 620 | (setq current-vc-state 'edited) | ||
| 621 | (setq current-bzr-state 'renamed)) | ||
| 622 | ((looking-at "^ignored") | ||
| 623 | (setq current-vc-state 'ignored) | ||
| 624 | (setq current-bzr-state 'not-versioned)) | ||
| 625 | ((looking-at "^unknown") | ||
| 626 | (setq current-vc-state 'unregistered) | ||
| 627 | (setq current-bzr-state 'not-versioned)) | ||
| 628 | ((looking-at " ") | ||
| 629 | ;; file names are indented by two spaces | ||
| 630 | (when current-vc-state | ||
| 631 | (let ((file (expand-file-name | ||
| 632 | (buffer-substring-no-properties | ||
| 633 | (match-end 0) (line-end-position)) | ||
| 634 | bzr-root-directory))) | ||
| 635 | (vc-file-setprop file 'vc-state current-vc-state) | ||
| 636 | (vc-file-setprop file 'vc-bzr-state current-bzr-state) | ||
| 637 | (when (eq 'added current-bzr-state) | ||
| 638 | (vc-file-setprop file 'vc-working-revision "0")))) | ||
| 639 | (when (eq 'not-versioned current-bzr-state) | ||
| 640 | (let ((file (expand-file-name | ||
| 641 | (buffer-substring-no-properties | ||
| 642 | (match-end 0) (line-end-position)) | ||
| 643 | bzr-root-directory))) | ||
| 644 | (vc-file-setprop file 'vc-backend 'none) | ||
| 645 | (vc-file-setprop file 'vc-state nil)))) | ||
| 646 | (t | ||
| 647 | ;; skip this part of `bzr status' output | ||
| 648 | (setq current-vc-state nil) | ||
| 649 | (setq current-bzr-state nil))))))) | ||
| 650 | |||
| 651 | (defun vc-bzr-prettify-state-info (file) | 567 | (defun vc-bzr-prettify-state-info (file) |
| 652 | "Bzr-specific version of `vc-prettify-state-info'." | 568 | "Bzr-specific version of `vc-prettify-state-info'." |
| 653 | (if (eq 'edited (vc-state file)) | 569 | (if (eq 'edited (vc-state file)) |
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 407ca039d79..f8cf5804eb4 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el | |||
| @@ -233,25 +233,6 @@ See also variable `vc-cvs-sticky-date-format-string'." | |||
| 233 | ((string= (vc-working-revision file) "0") 'added) | 233 | ((string= (vc-working-revision file) "0") 'added) |
| 234 | (t 'edited)))) | 234 | (t 'edited)))) |
| 235 | 235 | ||
| 236 | (defun vc-cvs-dir-state (dir) | ||
| 237 | "Find the CVS state of all files in DIR and subdirectories." | ||
| 238 | ;; if DIR is not under CVS control, don't do anything. | ||
| 239 | (when (file-readable-p (expand-file-name "CVS/Entries" dir)) | ||
| 240 | (if (vc-stay-local-p dir) | ||
| 241 | (vc-cvs-dir-state-heuristic dir) | ||
| 242 | (let ((default-directory dir)) | ||
| 243 | ;; Don't specify DIR in this command, the default-directory is | ||
| 244 | ;; enough. Otherwise it might fail with remote repositories. | ||
| 245 | (with-temp-buffer | ||
| 246 | (buffer-disable-undo) ;; Because these buffers can get huge | ||
| 247 | (vc-cvs-command t 0 nil "status") | ||
| 248 | (goto-char (point-min)) | ||
| 249 | (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) | ||
| 250 | (narrow-to-region (match-beginning 0) (match-end 0)) | ||
| 251 | (vc-cvs-parse-status) | ||
| 252 | (goto-char (point-max)) | ||
| 253 | (widen))))))) | ||
| 254 | |||
| 255 | (defun vc-cvs-working-revision (file) | 236 | (defun vc-cvs-working-revision (file) |
| 256 | "CVS-specific version of `vc-working-revision'." | 237 | "CVS-specific version of `vc-working-revision'." |
| 257 | ;; There is no need to consult RCS headers under CVS, because we | 238 | ;; There is no need to consult RCS headers under CVS, because we |
| @@ -845,19 +826,6 @@ state." | |||
| 845 | ((string-match "File had conflicts " status) 'conflict) | 826 | ((string-match "File had conflicts " status) 'conflict) |
| 846 | (t 'edited)))))))) | 827 | (t 'edited)))))))) |
| 847 | 828 | ||
| 848 | (defun vc-cvs-dir-state-heuristic (dir) | ||
| 849 | "Find the CVS state of all files in DIR, using only local information." | ||
| 850 | (with-temp-buffer | ||
| 851 | (vc-cvs-get-entries dir) | ||
| 852 | (goto-char (point-min)) | ||
| 853 | (while (not (eobp)) | ||
| 854 | ;; CVS-removed files are not taken under VC control. | ||
| 855 | (when (looking-at "/\\([^/]*\\)/[^/-]") | ||
| 856 | (let ((file (expand-file-name (match-string 1) dir))) | ||
| 857 | (unless (vc-file-getprop file 'vc-state) | ||
| 858 | (vc-cvs-parse-entry file t)))) | ||
| 859 | (forward-line 1)))) | ||
| 860 | |||
| 861 | (defun vc-cvs-after-dir-status (update-function) | 829 | (defun vc-cvs-after-dir-status (update-function) |
| 862 | ;; Heavily inspired by vc-cvs-parse-status. AKA a quick hack. | 830 | ;; Heavily inspired by vc-cvs-parse-status. AKA a quick hack. |
| 863 | ;; This needs a lot of testing. | 831 | ;; This needs a lot of testing. |
diff --git a/lisp/vc-dispatcher.el b/lisp/vc-dispatcher.el index dc29fda7271..c590f409950 100644 --- a/lisp/vc-dispatcher.el +++ b/lisp/vc-dispatcher.el | |||
| @@ -137,9 +137,7 @@ | |||
| 137 | (provide 'vc-dispatcher) | 137 | (provide 'vc-dispatcher) |
| 138 | 138 | ||
| 139 | (eval-when-compile | 139 | (eval-when-compile |
| 140 | (require 'cl) | 140 | (require 'cl)) |
| 141 | (require 'dired) ; for dired-map-over-marks macro | ||
| 142 | (require 'dired-aux)) ; for dired-kill-{line,tree} | ||
| 143 | 141 | ||
| 144 | ;; General customization | 142 | ;; General customization |
| 145 | 143 | ||
| @@ -177,7 +175,7 @@ preserve the setting." | |||
| 177 | 175 | ||
| 178 | ;; In a log entry buffer, this is a local variable | 176 | ;; In a log entry buffer, this is a local variable |
| 179 | ;; that points to the buffer for which it was made | 177 | ;; that points to the buffer for which it was made |
| 180 | ;; (either a file, or a VC dired buffer). | 178 | ;; (either a file, or a VC directory buffer). |
| 181 | (defvar vc-parent-buffer nil) | 179 | (defvar vc-parent-buffer nil) |
| 182 | (put 'vc-parent-buffer 'permanent-local t) | 180 | (put 'vc-parent-buffer 'permanent-local t) |
| 183 | (defvar vc-parent-buffer-name nil) | 181 | (defvar vc-parent-buffer-name nil) |
| @@ -534,8 +532,8 @@ empty comment. Remember the file's buffer in `vc-parent-buffer' | |||
| 534 | \(current one if no file). AFTER-HOOK specifies the local value | 532 | \(current one if no file). AFTER-HOOK specifies the local value |
| 535 | for `vc-log-after-operation-hook'." | 533 | for `vc-log-after-operation-hook'." |
| 536 | (let ((parent | 534 | (let ((parent |
| 537 | (if (or (eq major-mode 'vc-dired-mode) (eq major-mode 'vc-dir-mode)) | 535 | (if (vc-dispatcher-browsing) |
| 538 | ;; If we are called from VC dired, the parent buffer is | 536 | ;; If we are called from a directory browser, the parent buffer is |
| 539 | ;; the current buffer. | 537 | ;; the current buffer. |
| 540 | (current-buffer) | 538 | (current-buffer) |
| 541 | (if (and files (equal (length files) 1)) | 539 | (if (and files (equal (length files) 1)) |
| @@ -570,9 +568,9 @@ the buffer contents as a comment." | |||
| 570 | (unless nocomment | 568 | (unless nocomment |
| 571 | (run-hooks 'vc-logentry-check-hook)) | 569 | (run-hooks 'vc-logentry-check-hook)) |
| 572 | ;; Sync parent buffer in case the user modified it while editing the comment. | 570 | ;; Sync parent buffer in case the user modified it while editing the comment. |
| 573 | ;; But not if it is a vc-dired buffer. | 571 | ;; But not if it is a vc-directory buffer. |
| 574 | (with-current-buffer vc-parent-buffer | 572 | (with-current-buffer vc-parent-buffer |
| 575 | (or vc-dired-mode (eq major-mode 'vc-dir-mode) (vc-buffer-sync))) | 573 | (or (vc-dispatcher-browsing) (vc-buffer-sync))) |
| 576 | (unless vc-log-operation | 574 | (unless vc-log-operation |
| 577 | (error "No log operation is pending")) | 575 | (error "No log operation is pending")) |
| 578 | ;; save the parameters held in buffer-local variables | 576 | ;; save the parameters held in buffer-local variables |
| @@ -605,221 +603,10 @@ the buffer contents as a comment." | |||
| 605 | (mapc | 603 | (mapc |
| 606 | (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t)) | 604 | (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t)) |
| 607 | log-fileset)) | 605 | log-fileset)) |
| 608 | (when vc-dired-mode | 606 | (when (vc-dispatcher-browsing) |
| 609 | (dired-move-to-filename)) | ||
| 610 | (when (eq major-mode 'vc-dir-mode) | ||
| 611 | (vc-dir-move-to-goal-column)) | 607 | (vc-dir-move-to-goal-column)) |
| 612 | (run-hooks after-hook 'vc-finish-logentry-hook))) | 608 | (run-hooks after-hook 'vc-finish-logentry-hook))) |
| 613 | 609 | ||
| 614 | ;; VC-Dired mode | ||
| 615 | ;; FIXME: to be removed when vc-dir support is finished | ||
| 616 | |||
| 617 | (defcustom vc-dired-listing-switches "-al" | ||
| 618 | "Switches passed to `ls' for vc-dired. MUST contain the `l' option." | ||
| 619 | :type 'string | ||
| 620 | :group 'vc | ||
| 621 | :version "21.1") | ||
| 622 | |||
| 623 | (defcustom vc-dired-recurse t | ||
| 624 | "If non-nil, show directory trees recursively in VC Dired." | ||
| 625 | :type 'boolean | ||
| 626 | :group 'vc | ||
| 627 | :version "20.3") | ||
| 628 | |||
| 629 | (defcustom vc-dired-terse-display t | ||
| 630 | "If non-nil, show only locked or locally modified files in VC Dired." | ||
| 631 | :type 'boolean | ||
| 632 | :group 'vc | ||
| 633 | :version "20.3") | ||
| 634 | |||
| 635 | (defvar vc-dired-mode nil) | ||
| 636 | (defvar vc-dired-window-configuration) | ||
| 637 | (defvar vc-dired-switches) | ||
| 638 | (defvar vc-dired-terse-mode) | ||
| 639 | |||
| 640 | (make-variable-buffer-local 'vc-dired-mode) | ||
| 641 | |||
| 642 | (defvar vc-dired-mode-map | ||
| 643 | (let ((map (make-sparse-keymap)) | ||
| 644 | (vmap (make-sparse-keymap))) | ||
| 645 | (define-key map "\C-xv" vmap) | ||
| 646 | (define-key map "v" vmap) | ||
| 647 | (set-keymap-parent vmap vc-prefix-map) | ||
| 648 | (define-key vmap "t" 'vc-dired-toggle-terse-mode) | ||
| 649 | map)) | ||
| 650 | |||
| 651 | (define-derived-mode vc-dired-mode dired-mode "Dired under VC" | ||
| 652 | "The major mode used in VC directory buffers. | ||
| 653 | |||
| 654 | It works like Dired, but lists only files under version control, with | ||
| 655 | the current VC state of each file being indicated in the place of the | ||
| 656 | file's link count, owner, group and size. Subdirectories are also | ||
| 657 | listed, and you may insert them into the buffer as desired, like in | ||
| 658 | Dired. | ||
| 659 | |||
| 660 | All Dired commands operate normally, with the exception of `v', which | ||
| 661 | is redefined as the version control prefix, so that you can type | ||
| 662 | `vl', `v=' etc. to invoke `vc-print-log', `vc-diff', and the like on | ||
| 663 | the file named in the current Dired buffer line. `vv' invokes | ||
| 664 | `vc-next-action' on this file, or on all files currently marked. | ||
| 665 | There is a special command, `*l', to mark all files currently locked." | ||
| 666 | ;; define-derived-mode does it for us in Emacs-21, but not in Emacs-20. | ||
| 667 | ;; We do it here because dired might not be loaded yet | ||
| 668 | ;; when vc-dired-mode-map is initialized. | ||
| 669 | (set-keymap-parent vc-dired-mode-map dired-mode-map) | ||
| 670 | (add-hook 'dired-after-readin-hook 'vc-dired-hook nil t) | ||
| 671 | ;; The following is slightly modified from files.el, | ||
| 672 | ;; because file lines look a bit different in vc-dired-mode | ||
| 673 | ;; (the column before the date does not end in a digit). | ||
| 674 | ;; albinus: It should be done in the original declaration. Problem | ||
| 675 | ;; is the optional empty state-info; otherwise ")" would be good | ||
| 676 | ;; enough as delimeter. | ||
| 677 | (set (make-local-variable 'directory-listing-before-filename-regexp) | ||
| 678 | (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)") | ||
| 679 | ;; In some locales, month abbreviations are as short as 2 letters, | ||
| 680 | ;; and they can be followed by ".". | ||
| 681 | (month (concat l l "+\\.?")) | ||
| 682 | (s " ") | ||
| 683 | (yyyy "[0-9][0-9][0-9][0-9]") | ||
| 684 | (dd "[ 0-3][0-9]") | ||
| 685 | (HH:MM "[ 0-2][0-9]:[0-5][0-9]") | ||
| 686 | (seconds "[0-6][0-9]\\([.,][0-9]+\\)?") | ||
| 687 | (zone "[-+][0-2][0-9][0-5][0-9]") | ||
| 688 | (iso-mm-dd "[01][0-9]-[0-3][0-9]") | ||
| 689 | (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?")) | ||
| 690 | (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time | ||
| 691 | "\\|" yyyy "-" iso-mm-dd "\\)")) | ||
| 692 | (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)" | ||
| 693 | s "+" | ||
| 694 | "\\(" HH:MM "\\|" yyyy "\\)")) | ||
| 695 | (western-comma (concat month s "+" dd "," s "+" yyyy)) | ||
| 696 | ;; Japanese MS-Windows ls-lisp has one-digit months, and | ||
| 697 | ;; omits the Kanji characters after month and day-of-month. | ||
| 698 | (mm "[ 0-1]?[0-9]") | ||
| 699 | (japanese | ||
| 700 | (concat mm l "?" s dd l "?" s "+" | ||
| 701 | "\\(" HH:MM "\\|" yyyy l "?" "\\)"))) | ||
| 702 | ;; the .* below ensures that we find the last match on a line | ||
| 703 | (concat ".*" s | ||
| 704 | "\\(" western "\\|" western-comma "\\|" japanese "\\|" iso "\\)" | ||
| 705 | s "+"))) | ||
| 706 | (and (boundp 'vc-dired-switches) | ||
| 707 | vc-dired-switches | ||
| 708 | (set (make-local-variable 'dired-actual-switches) | ||
| 709 | vc-dired-switches)) | ||
| 710 | (set (make-local-variable 'vc-dired-terse-mode) vc-dired-terse-display) | ||
| 711 | ;;(let ((backend-name (symbol-name (vc-responsible-backend | ||
| 712 | ;; default-directory)))) | ||
| 713 | ;; (setq mode-name (concat mode-name backend-name)) | ||
| 714 | ;; ;; Add menu after `vc-dired-mode-map' has `dired-mode-map' as the parent. | ||
| 715 | ;; (let ((vc-dire-menu-map (copy-keymap vc-menu-map))) | ||
| 716 | ;; (define-key-after (lookup-key vc-dired-mode-map [menu-bar]) [vc] | ||
| 717 | ;; (cons backend-name vc-dire-menu-map) 'subdir))) | ||
| 718 | (setq vc-dired-mode t)) | ||
| 719 | |||
| 720 | (defun vc-dired-toggle-terse-mode () | ||
| 721 | "Toggle terse display in VC Dired." | ||
| 722 | (interactive) | ||
| 723 | (if (not vc-dired-mode) | ||
| 724 | nil | ||
| 725 | (setq vc-dired-terse-mode (not vc-dired-terse-mode)) | ||
| 726 | (if vc-dired-terse-mode | ||
| 727 | (vc-dired-hook) | ||
| 728 | (revert-buffer)))) | ||
| 729 | |||
| 730 | (defun vc-dired-mark-locked () | ||
| 731 | "Mark all files currently locked." | ||
| 732 | (interactive) | ||
| 733 | (dired-mark-if (let ((f (dired-get-filename nil t))) | ||
| 734 | (and f | ||
| 735 | (not (file-directory-p f)) | ||
| 736 | (not (vc-up-to-date-p f)))) | ||
| 737 | "locked file")) | ||
| 738 | |||
| 739 | (define-key vc-dired-mode-map "*l" 'vc-dired-mark-locked) | ||
| 740 | |||
| 741 | (defun vc-dired-reformat-line (vc-info) | ||
| 742 | "Reformat a directory-listing line. | ||
| 743 | Replace various columns with version control information, VC-INFO. | ||
| 744 | This code, like dired, assumes UNIX -l format." | ||
| 745 | (beginning-of-line) | ||
| 746 | (when (re-search-forward | ||
| 747 | ;; Match link count, owner, group, size. Group may be missing, | ||
| 748 | ;; and only the size is present in OS/2 -l format. | ||
| 749 | "^..[drwxlts-]+ \\( *[0-9]+\\( [^ ]+ +\\([^ ]+ +\\)?[0-9]+\\)?\\) " | ||
| 750 | (line-end-position) t) | ||
| 751 | (replace-match (substring (concat vc-info " ") 0 10) | ||
| 752 | t t nil 1))) | ||
| 753 | |||
| 754 | (defun vc-dired-ignorable-p (filename) | ||
| 755 | "Should FILENAME be ignored in VC-Dired listings?" | ||
| 756 | (catch t | ||
| 757 | ;; Ignore anything that wouldn't be found by completion (.o, .la, etc.) | ||
| 758 | (dolist (ignorable completion-ignored-extensions) | ||
| 759 | (let ((ext (substring filename | ||
| 760 | (- (length filename) | ||
| 761 | (length ignorable))))) | ||
| 762 | (if (string= ignorable ext) (throw t t)))) | ||
| 763 | ;; Ignore Makefiles derived from something else | ||
| 764 | (when (string= (file-name-nondirectory filename) "Makefile") | ||
| 765 | (let* ((dir (file-name-directory filename)) | ||
| 766 | (peers (directory-files (or dir default-directory)))) | ||
| 767 | (if (or (member "Makefile.in" peers) (member "Makefile.am" peers)) | ||
| 768 | (throw t t)))) | ||
| 769 | nil)) | ||
| 770 | |||
| 771 | (defun vc-dired-purge () | ||
| 772 | "Remove empty subdirs." | ||
| 773 | (goto-char (point-min)) | ||
| 774 | (while (dired-get-subdir) | ||
| 775 | (forward-line 2) | ||
| 776 | (if (dired-get-filename nil t) | ||
| 777 | (if (not (dired-next-subdir 1 t)) | ||
| 778 | (goto-char (point-max))) | ||
| 779 | (forward-line -2) | ||
| 780 | (if (not (string= (dired-current-directory) default-directory)) | ||
| 781 | (dired-do-kill-lines t "") | ||
| 782 | ;; We cannot remove the top level directory. | ||
| 783 | ;; Just make it look a little nicer. | ||
| 784 | (forward-line 1) | ||
| 785 | (or (eobp) (kill-line)) | ||
| 786 | (if (not (dired-next-subdir 1 t)) | ||
| 787 | (goto-char (point-max)))))) | ||
| 788 | (goto-char (point-min))) | ||
| 789 | |||
| 790 | (defun vc-dired-buffers-for-dir (dir) | ||
| 791 | "Return a list of all vc-dired buffers that currently display DIR." | ||
| 792 | (let (result) | ||
| 793 | ;; Check whether dired is loaded. | ||
| 794 | (when (fboundp 'dired-buffers-for-dir) | ||
| 795 | (dolist (buffer (dired-buffers-for-dir dir)) | ||
| 796 | (with-current-buffer buffer | ||
| 797 | (when vc-dired-mode | ||
| 798 | (push buffer result))))) | ||
| 799 | (nreverse result))) | ||
| 800 | |||
| 801 | ;;;###autoload | ||
| 802 | (defun vc-directory (dir read-switches) | ||
| 803 | "Create a buffer in VC Dired Mode for directory DIR. | ||
| 804 | |||
| 805 | See Info node `VC Dired Mode'. | ||
| 806 | |||
| 807 | With prefix arg READ-SWITCHES, specify a value to override | ||
| 808 | `dired-listing-switches' when generating the listing." | ||
| 809 | (interactive "DDired under VC (directory): \nP") | ||
| 810 | (let ((vc-dired-switches (concat vc-dired-listing-switches | ||
| 811 | (if vc-dired-recurse "R" "")))) | ||
| 812 | (if read-switches | ||
| 813 | (setq vc-dired-switches | ||
| 814 | (read-string "Dired listing switches: " | ||
| 815 | vc-dired-switches))) | ||
| 816 | (require 'dired) | ||
| 817 | (require 'dired-aux) | ||
| 818 | (switch-to-buffer | ||
| 819 | (dired-internal-noselect (expand-file-name (file-name-as-directory dir)) | ||
| 820 | vc-dired-switches | ||
| 821 | 'vc-dired-mode)))) | ||
| 822 | |||
| 823 | ;; The ewoc-based vc-directory implementation | 610 | ;; The ewoc-based vc-directory implementation |
| 824 | 611 | ||
| 825 | (defcustom vc-dir-mode-hook nil | 612 | (defcustom vc-dir-mode-hook nil |
| @@ -1459,17 +1246,6 @@ that share the same state." | |||
| 1459 | (defun vc-directory-resynch-file (&optional fname) | 1246 | (defun vc-directory-resynch-file (&optional fname) |
| 1460 | "Update the entries for FILE in any directory buffers that list it." | 1247 | "Update the entries for FILE in any directory buffers that list it." |
| 1461 | (let ((file (or fname (expand-file-name buffer-file-name)))) | 1248 | (let ((file (or fname (expand-file-name buffer-file-name)))) |
| 1462 | ;; The VC-Dired case | ||
| 1463 | (let ((buffers (vc-dired-buffers-for-dir (file-name-directory file)))) | ||
| 1464 | (when buffers | ||
| 1465 | (mapc (lambda (buffer) | ||
| 1466 | (with-current-buffer buffer | ||
| 1467 | (when (dired-goto-file file) | ||
| 1468 | ;; bind vc-dired-terse-mode to nil so that | ||
| 1469 | ;; files won't vanish when they are checked in | ||
| 1470 | (let ((vc-dired-terse-mode nil)) | ||
| 1471 | (dired-do-redisplay 1))))) | ||
| 1472 | buffers))) | ||
| 1473 | ;; The vc-dir case | 1249 | ;; The vc-dir case |
| 1474 | (let ((found-vc-dir-buf nil)) | 1250 | (let ((found-vc-dir-buf nil)) |
| 1475 | (save-excursion | 1251 | (save-excursion |
| @@ -1550,7 +1326,7 @@ NOT-URGENT means it is ok to continue if the user says not to save." | |||
| 1550 | 1326 | ||
| 1551 | (defun vc-dispatcher-browsing () | 1327 | (defun vc-dispatcher-browsing () |
| 1552 | "Are we in a directory browser buffer?" | 1328 | "Are we in a directory browser buffer?" |
| 1553 | (or vc-dired-mode (eq major-mode 'vc-dir-mode))) | 1329 | (eq major-mode 'vc-dir-mode)) |
| 1554 | 1330 | ||
| 1555 | (defun vc-dispatcher-selection-set (eligible | 1331 | (defun vc-dispatcher-selection-set (eligible |
| 1556 | &optional | 1332 | &optional |
| @@ -1558,11 +1334,11 @@ NOT-URGENT means it is ok to continue if the user says not to save." | |||
| 1558 | allow-ineligible | 1334 | allow-ineligible |
| 1559 | include-files-not-directories) | 1335 | include-files-not-directories) |
| 1560 | "Deduce a set of files to which to apply an operation. Return the fileset. | 1336 | "Deduce a set of files to which to apply an operation. Return the fileset. |
| 1561 | If we're in VC-dired mode, the fileset is the list of marked files. | 1337 | If we're in a directory display, the fileset is the list of marked files. |
| 1562 | Otherwise, if we're looking at a buffer for which ELIGIBLE returns non-NIL, | 1338 | Otherwise, if we're looking at a buffer for which ELIGIBLE returns non-NIL, |
| 1563 | the fileset is a singleton containing this file. | 1339 | the fileset is a singleton containing this file. |
| 1564 | If neither of these things is true, but ALLOW-DIRECTORY-WILDCARD is on | 1340 | If neither of these things is true, but ALLOW-DIRECTORY-WILDCARD is on |
| 1565 | and we're in a dired buffer, select the current directory. | 1341 | and we're in a directory buffer, select the current directory. |
| 1566 | If none of these conditions is met, but ALLOW-INELIGIBLE is on and the | 1342 | If none of these conditions is met, but ALLOW-INELIGIBLE is on and the |
| 1567 | visited file is not registered, return a singleton fileset containing it. | 1343 | visited file is not registered, return a singleton fileset containing it. |
| 1568 | If INCLUDE-FILES-NOT-DIRECTORIES then if directories are marked, | 1344 | If INCLUDE-FILES-NOT-DIRECTORIES then if directories are marked, |
| @@ -1571,12 +1347,6 @@ the directories themselves. | |||
| 1571 | Otherwise, throw an error." | 1347 | Otherwise, throw an error." |
| 1572 | (let ((files | 1348 | (let ((files |
| 1573 | (cond | 1349 | (cond |
| 1574 | ;; Browsing with dired | ||
| 1575 | (vc-dired-mode | ||
| 1576 | (let ((marked (dired-map-over-marks (dired-get-filename) nil))) | ||
| 1577 | (if marked | ||
| 1578 | marked | ||
| 1579 | (error "No files have been selected.")))) | ||
| 1580 | ;; Browsing with vc-dir | 1350 | ;; Browsing with vc-dir |
| 1581 | ((eq major-mode 'vc-dir-mode) | 1351 | ((eq major-mode 'vc-dir-mode) |
| 1582 | (or | 1352 | (or |
| @@ -1602,11 +1372,8 @@ Otherwise, throw an error." | |||
| 1602 | ;; making diffs, or possibly for destructive ones that have | 1372 | ;; making diffs, or possibly for destructive ones that have |
| 1603 | ;; confirmation prompts. | 1373 | ;; confirmation prompts. |
| 1604 | ((and allow-directory-wildcard | 1374 | ((and allow-directory-wildcard |
| 1605 | ;; I think this is a misfeature. For now, I'll leave it in, but | ||
| 1606 | ;; I'll disable it anywhere else than in dired buffers. --Stef | ||
| 1607 | (and (derived-mode-p 'dired-mode) | ||
| 1608 | (equal buffer-file-name nil) | 1375 | (equal buffer-file-name nil) |
| 1609 | (equal list-buffers-directory default-directory))) | 1376 | (equal list-buffers-directory default-directory)) |
| 1610 | (progn | 1377 | (progn |
| 1611 | (message "All eligible files below %s selected." | 1378 | (message "All eligible files below %s selected." |
| 1612 | default-directory) | 1379 | default-directory) |
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 2da2c7e6937..27b35c4240b 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el | |||
| @@ -50,7 +50,6 @@ | |||
| 50 | ;; * registered (file) OK | 50 | ;; * registered (file) OK |
| 51 | ;; * state (file) OK | 51 | ;; * state (file) OK |
| 52 | ;; - state-heuristic (file) NOT NEEDED | 52 | ;; - state-heuristic (file) NOT NEEDED |
| 53 | ;; - dir-state (dir) OK | ||
| 54 | ;; * working-revision (file) OK | 53 | ;; * working-revision (file) OK |
| 55 | ;; - latest-on-branch-p (file) NOT NEEDED | 54 | ;; - latest-on-branch-p (file) NOT NEEDED |
| 56 | ;; * checkout-model (files) OK | 55 | ;; * checkout-model (files) OK |
| @@ -175,14 +174,6 @@ | |||
| 175 | (vc-file-setprop file 'vc-state state)) | 174 | (vc-file-setprop file 'vc-state state)) |
| 176 | (setq start (point)))))) | 175 | (setq start (point)))))) |
| 177 | 176 | ||
| 178 | (defun vc-git-dir-state (dir) | ||
| 179 | "Git-specific version of `dir-state'." | ||
| 180 | (vc-git--ls-files-state 'up-to-date "-c") | ||
| 181 | (vc-git--ls-files-state 'edited "-m") | ||
| 182 | (vc-git--ls-files-state 'removed "-d") | ||
| 183 | (vc-git--ls-files-state 'ignored "-o" "-i" "--exclude-standard") | ||
| 184 | (vc-git--ls-files-state nil "-o" "--exclude-standard")) | ||
| 185 | |||
| 186 | (defun vc-git-working-revision (file) | 177 | (defun vc-git-working-revision (file) |
| 187 | "Git-specific version of `vc-working-revision'." | 178 | "Git-specific version of `vc-working-revision'." |
| 188 | (let ((str (with-output-to-string | 179 | (let ((str (with-output-to-string |
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el index b814e7a8ae2..a66a9942b27 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el | |||
| @@ -42,7 +42,6 @@ | |||
| 42 | ;; * registered (file) OK | 42 | ;; * registered (file) OK |
| 43 | ;; * state (file) OK | 43 | ;; * state (file) OK |
| 44 | ;; - state-heuristic (file) ?? PROBABLY NOT NEEDED | 44 | ;; - state-heuristic (file) ?? PROBABLY NOT NEEDED |
| 45 | ;; - dir-state (dir) OK | ||
| 46 | ;; * working-revision (file) OK | 45 | ;; * working-revision (file) OK |
| 47 | ;; - latest-on-branch-p (file) ?? | 46 | ;; - latest-on-branch-p (file) ?? |
| 48 | ;; * checkout-model (files) OK | 47 | ;; * checkout-model (files) OK |
| @@ -179,54 +178,6 @@ | |||
| 179 | ((eq state ?C) 'up-to-date) ;; Older mercurials use this | 178 | ((eq state ?C) 'up-to-date) ;; Older mercurials use this |
| 180 | (t 'up-to-date))))))) | 179 | (t 'up-to-date))))))) |
| 181 | 180 | ||
| 182 | (defun vc-hg-dir-state (dir) | ||
| 183 | (with-temp-buffer | ||
| 184 | (buffer-disable-undo) ;; Because these buffers can get huge | ||
| 185 | (vc-hg-command (current-buffer) nil dir "status" "-A") | ||
| 186 | (goto-char (point-min)) | ||
| 187 | (let ((status-char nil) | ||
| 188 | (file nil)) | ||
| 189 | (while (not (eobp)) | ||
| 190 | (setq status-char (char-after)) | ||
| 191 | (setq file | ||
| 192 | (expand-file-name | ||
| 193 | (buffer-substring-no-properties (+ (point) 2) | ||
| 194 | (line-end-position)))) | ||
| 195 | (cond | ||
| 196 | ;; State flag for a clean file is now C, might change to =. | ||
| 197 | ;; The rest of the possible states in "hg status" output: | ||
| 198 | ;; ! = deleted, but still tracked | ||
| 199 | ;; should not show up in VC directory buffers, so don't deal with them | ||
| 200 | ;; here. | ||
| 201 | |||
| 202 | ;; Mercurial up to 0.9.5 used C, = is used now. | ||
| 203 | ((or (eq status-char ?=) (eq status-char ?C)) | ||
| 204 | (vc-file-setprop file 'vc-backend 'Hg) | ||
| 205 | (vc-file-setprop file 'vc-state 'up-to-date)) | ||
| 206 | ((eq status-char ?A) | ||
| 207 | (vc-file-setprop file 'vc-backend 'Hg) | ||
| 208 | (vc-file-setprop file 'vc-working-revision "0") | ||
| 209 | (vc-file-setprop file 'vc-state 'added)) | ||
| 210 | ((eq status-char ?R) | ||
| 211 | (vc-file-setprop file 'vc-backend 'Hg) | ||
| 212 | (vc-file-setprop file 'vc-state 'removed)) | ||
| 213 | ((eq status-char ?M) | ||
| 214 | (vc-file-setprop file 'vc-backend 'Hg) | ||
| 215 | (vc-file-setprop file 'vc-state 'edited)) | ||
| 216 | ((eq status-char ?I) | ||
| 217 | (vc-file-setprop file 'vc-backend 'Hg) | ||
| 218 | (vc-file-setprop file 'vc-state 'ignored)) | ||
| 219 | ((eq status-char ??) | ||
| 220 | (vc-file-setprop file 'vc-backend 'none) | ||
| 221 | (vc-file-setprop file 'vc-state 'unregistered)) | ||
| 222 | ((eq status-char ?!) | ||
| 223 | (vc-file-setprop file 'vc-backend 'Hg) | ||
| 224 | (vc-file-setprop file 'vc-state 'missing)) | ||
| 225 | (t ;; Presently C, might change to = in 0.9.6 | ||
| 226 | (vc-file-setprop file 'vc-backend 'Hg) | ||
| 227 | (vc-file-setprop file 'vc-state 'up-to-date))) | ||
| 228 | (forward-line))))) | ||
| 229 | |||
| 230 | (defun vc-hg-working-revision (file) | 181 | (defun vc-hg-working-revision (file) |
| 231 | "Hg-specific version of `vc-working-revision'." | 182 | "Hg-specific version of `vc-working-revision'." |
| 232 | (let* | 183 | (let* |
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index 22873993da9..1e2101e1361 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -519,7 +519,7 @@ For registered files, the value returned is one of: | |||
| 519 | 'missing The file is not present in the file system, but the VC | 519 | 'missing The file is not present in the file system, but the VC |
| 520 | system still tracks it. | 520 | system still tracks it. |
| 521 | 521 | ||
| 522 | 'ignored The file showed up in a dir-state listing with a flag | 522 | 'ignored The file showed up in a dir-status listing with a flag |
| 523 | indicating the version-control system is ignoring it, | 523 | indicating the version-control system is ignoring it, |
| 524 | Note: This property is not set reliably (some VCSes | 524 | Note: This property is not set reliably (some VCSes |
| 525 | don't have useful directory-status commands) so assume | 525 | don't have useful directory-status commands) so assume |
diff --git a/lisp/vc-mcvs.el b/lisp/vc-mcvs.el index ec40c9ca2a1..2a8ea2cfb85 100644 --- a/lisp/vc-mcvs.el +++ b/lisp/vc-mcvs.el | |||
| @@ -175,26 +175,6 @@ This is only meaningful if you don't use the implicit checkout model | |||
| 175 | 175 | ||
| 176 | (defalias 'vc-mcvs-state-heuristic 'vc-cvs-state-heuristic) | 176 | (defalias 'vc-mcvs-state-heuristic 'vc-cvs-state-heuristic) |
| 177 | 177 | ||
| 178 | (defun vc-mcvs-dir-state (dir) | ||
| 179 | "Find the Meta-CVS state of all files in DIR and subdirectories." | ||
| 180 | ;; if DIR is not under Meta-CVS control, don't do anything. | ||
| 181 | (when (file-readable-p (expand-file-name "MCVS/CVS/Entries" dir)) | ||
| 182 | (if (vc-stay-local-p dir) | ||
| 183 | (vc-mcvs-dir-state-heuristic dir) | ||
| 184 | (let ((default-directory dir)) | ||
| 185 | ;; Don't specify DIR in this command, the default-directory is | ||
| 186 | ;; enough. Otherwise it might fail with remote repositories. | ||
| 187 | (with-temp-buffer | ||
| 188 | (buffer-disable-undo) ;; Because these buffers can get huge | ||
| 189 | (setq default-directory (vc-mcvs-root dir)) | ||
| 190 | (vc-mcvs-command t 0 nil "status") | ||
| 191 | (goto-char (point-min)) | ||
| 192 | (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) | ||
| 193 | (narrow-to-region (match-beginning 0) (match-end 0)) | ||
| 194 | (vc-cvs-parse-status) | ||
| 195 | (goto-char (point-max)) | ||
| 196 | (widen))))))) | ||
| 197 | |||
| 198 | (defun vc-mcvs-working-revision (file) | 178 | (defun vc-mcvs-working-revision (file) |
| 199 | (vc-cvs-working-revision | 179 | (vc-cvs-working-revision |
| 200 | (expand-file-name (vc-file-getprop file 'mcvs-inode) | 180 | (expand-file-name (vc-file-getprop file 'mcvs-inode) |
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index 92696ee1b4e..b08f050fd55 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el | |||
| @@ -146,17 +146,6 @@ If you want to force an empty list of arguments, use t." | |||
| 146 | "SVN-specific state heuristic." | 146 | "SVN-specific state heuristic." |
| 147 | (vc-svn-state file 'local)) | 147 | (vc-svn-state file 'local)) |
| 148 | 148 | ||
| 149 | (defun vc-svn-dir-state (dir &optional localp) | ||
| 150 | "Find the SVN state of all files in DIR and its subdirectories." | ||
| 151 | (setq localp (or localp (vc-stay-local-p dir))) | ||
| 152 | (let ((default-directory dir)) | ||
| 153 | ;; Don't specify DIR in this command, the default-directory is | ||
| 154 | ;; enough. Otherwise it might fail with remote repositories. | ||
| 155 | (with-temp-buffer | ||
| 156 | (buffer-disable-undo) ;; Because these buffers can get huge | ||
| 157 | (vc-svn-command t 0 nil "status" (if localp "-v" "-u")) | ||
| 158 | (vc-svn-parse-status)))) | ||
| 159 | |||
| 160 | (defun vc-svn-after-dir-status (callback) | 149 | (defun vc-svn-after-dir-status (callback) |
| 161 | (let ((state-map '((?A . added) | 150 | (let ((state-map '((?A . added) |
| 162 | (?C . conflict) | 151 | (?C . conflict) |
diff --git a/lisp/vc.el b/lisp/vc.el index 8d7d6104121..259def06765 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -138,7 +138,7 @@ | |||
| 138 | ;; reliable state computation; it is usually called immediately after | 138 | ;; reliable state computation; it is usually called immediately after |
| 139 | ;; C-x v v. If you want to use a faster heuristic when visiting a | 139 | ;; C-x v v. If you want to use a faster heuristic when visiting a |
| 140 | ;; file, put that into `state-heuristic' below. Note that under most | 140 | ;; file, put that into `state-heuristic' below. Note that under most |
| 141 | ;; VCSes this won't be called at all, dir-state or dir-stus is used instead. | 141 | ;; VCSes this won't be called at all, dir-status is used instead. |
| 142 | ;; | 142 | ;; |
| 143 | ;; - state-heuristic (file) | 143 | ;; - state-heuristic (file) |
| 144 | ;; | 144 | ;; |
| @@ -147,17 +147,6 @@ | |||
| 147 | ;; than the implementation of `state'. For a list of possible values, | 147 | ;; than the implementation of `state'. For a list of possible values, |
| 148 | ;; see the doc string of `vc-state'. | 148 | ;; see the doc string of `vc-state'. |
| 149 | ;; | 149 | ;; |
| 150 | ;; - dir-state (dir) | ||
| 151 | ;; | ||
| 152 | ;; If provided, this function is used to find the version control | ||
| 153 | ;; state of as many files as possible in DIR, and all subdirectories | ||
| 154 | ;; of DIR, in a fast way; it is used to avoid expensive indivitual | ||
| 155 | ;; vc-state calls. The function should not return anything, but | ||
| 156 | ;; rather store the files' states into the corresponding properties. | ||
| 157 | ;; Two properties are required: `vc-backend' and `vc-state'. (Note: | ||
| 158 | ;; in older versions this method was not required to recurse into | ||
| 159 | ;; subdirectories.) | ||
| 160 | ;; | ||
| 161 | ;; - dir-status (dir update-function) | 150 | ;; - dir-status (dir update-function) |
| 162 | ;; | 151 | ;; |
| 163 | ;; Produce RESULT: a list of lists of the form (FILE VC-STATE EXTRA) | 152 | ;; Produce RESULT: a list of lists of the form (FILE VC-STATE EXTRA) |
| @@ -620,7 +609,7 @@ | |||
| 620 | ;; | 609 | ;; |
| 621 | ;; - vc-diff, vc-annotate, etc. need to deal better with unregistered | 610 | ;; - vc-diff, vc-annotate, etc. need to deal better with unregistered |
| 622 | ;; files. Now that unregistered and ignored files are shown in | 611 | ;; files. Now that unregistered and ignored files are shown in |
| 623 | ;; vc-dired/vc-dir, it is possible that these commands are called | 612 | ;; vc-dir, it is possible that these commands are called |
| 624 | ;; for unregistered/ignored files. | 613 | ;; for unregistered/ignored files. |
| 625 | ;; | 614 | ;; |
| 626 | ;; - do not default to RCS anymore when the current directory is not | 615 | ;; - do not default to RCS anymore when the current directory is not |
| @@ -637,7 +626,7 @@ | |||
| 637 | ;; are supposed to work with. | 626 | ;; are supposed to work with. |
| 638 | ;; | 627 | ;; |
| 639 | ;; - Another important thing: merge all the status-like backend operations. | 628 | ;; - Another important thing: merge all the status-like backend operations. |
| 640 | ;; We should remove dir-status, state, dir-state, and dir-status-files, and | 629 | ;; We should remove dir-status, state, and dir-status-files, and |
| 641 | ;; replace them with just `status' which takes a fileset and a continuation | 630 | ;; replace them with just `status' which takes a fileset and a continuation |
| 642 | ;; (like dir-status) and returns a buffer in which the process(es) are run | 631 | ;; (like dir-status) and returns a buffer in which the process(es) are run |
| 643 | ;; (or nil if it worked synchronously). Hopefully we can define the old | 632 | ;; (or nil if it worked synchronously). Hopefully we can define the old |
| @@ -658,8 +647,6 @@ | |||
| 658 | (require 'ewoc) | 647 | (require 'ewoc) |
| 659 | 648 | ||
| 660 | (eval-when-compile | 649 | (eval-when-compile |
| 661 | (require 'dired) | ||
| 662 | (require 'dired-aux) | ||
| 663 | (require 'cl)) | 650 | (require 'cl)) |
| 664 | 651 | ||
| 665 | (unless (assoc 'vc-parent-buffer minor-mode-alist) | 652 | (unless (assoc 'vc-parent-buffer minor-mode-alist) |
| @@ -1042,9 +1029,7 @@ Return (BACKEND . FILESET)." | |||
| 1042 | (defun vc-ensure-vc-buffer () | 1029 | (defun vc-ensure-vc-buffer () |
| 1043 | "Make sure that the current buffer visits a version-controlled file." | 1030 | "Make sure that the current buffer visits a version-controlled file." |
| 1044 | (cond | 1031 | (cond |
| 1045 | (vc-dired-mode | 1032 | ((vc-dispatcher-browsing) |
| 1046 | (set-buffer (find-file-noselect (dired-get-filename)))) | ||
| 1047 | ((eq major-mode 'vc-dir-mode) | ||
| 1048 | (set-buffer (find-file-noselect (vc-dir-current-file)))) | 1033 | (set-buffer (find-file-noselect (vc-dir-current-file)))) |
| 1049 | (t | 1034 | (t |
| 1050 | (while (and vc-parent-buffer | 1035 | (while (and vc-parent-buffer |
| @@ -1642,9 +1627,7 @@ Normally this compares the currently selected fileset with their | |||
| 1642 | working revisions. With a prefix argument HISTORIC, it reads two revision | 1627 | working revisions. With a prefix argument HISTORIC, it reads two revision |
| 1643 | designators specifying which revisions to compare. | 1628 | designators specifying which revisions to compare. |
| 1644 | 1629 | ||
| 1645 | If no current fileset is available (that is, we are not in | 1630 | If no current fileset is available and we're in a directory buffer, use |
| 1646 | VC-Dired mode and the visited file of the current buffer is not | ||
| 1647 | under version control) and we're in a Dired buffer, use | ||
| 1648 | the current directory. | 1631 | the current directory. |
| 1649 | The optional argument NOT-URGENT non-nil means it is ok to say no to | 1632 | The optional argument NOT-URGENT non-nil means it is ok to say no to |
| 1650 | saving the buffer." | 1633 | saving the buffer." |
| @@ -1823,85 +1806,6 @@ See Info node `Merging'." | |||
| 1823 | ;;;###autoload | 1806 | ;;;###autoload |
| 1824 | (defalias 'vc-resolve-conflicts 'smerge-ediff) | 1807 | (defalias 'vc-resolve-conflicts 'smerge-ediff) |
| 1825 | 1808 | ||
| 1826 | ;; VC Dired hook | ||
| 1827 | ;; FIXME: Remove Dired support when vc-dir is ready. | ||
| 1828 | |||
| 1829 | (defun vc-dired-hook () | ||
| 1830 | "Reformat the listing according to version control. | ||
| 1831 | Called by dired after any portion of a vc-dired buffer has been read in." | ||
| 1832 | (message "Getting version information... ") | ||
| 1833 | ;; if the backend supports it, get the state | ||
| 1834 | ;; of all files in this directory at once | ||
| 1835 | (let ((backend (vc-responsible-backend default-directory))) | ||
| 1836 | ;; check `backend' can really handle `default-directory'. | ||
| 1837 | (if (and (vc-call-backend backend 'responsible-p default-directory) | ||
| 1838 | (vc-find-backend-function backend 'dir-state)) | ||
| 1839 | (vc-call-backend backend 'dir-state default-directory))) | ||
| 1840 | (let (filename | ||
| 1841 | (inhibit-read-only t) | ||
| 1842 | (buffer-undo-list t)) | ||
| 1843 | (goto-char (point-min)) | ||
| 1844 | (while (not (eobp)) | ||
| 1845 | (cond | ||
| 1846 | ;; subdir header line | ||
| 1847 | ((dired-get-subdir) | ||
| 1848 | (forward-line 1) | ||
| 1849 | ;; erase (but don't remove) the "total" line | ||
| 1850 | (delete-region (point) (line-end-position)) | ||
| 1851 | (beginning-of-line) | ||
| 1852 | (forward-line 1)) | ||
| 1853 | ;; file line | ||
| 1854 | ((setq filename (dired-get-filename nil t)) | ||
| 1855 | (cond | ||
| 1856 | ;; subdir | ||
| 1857 | ((file-directory-p filename) | ||
| 1858 | (cond | ||
| 1859 | ((member (file-name-nondirectory filename) | ||
| 1860 | vc-directory-exclusion-list) | ||
| 1861 | (let ((pos (point))) | ||
| 1862 | (dired-kill-tree filename) | ||
| 1863 | (goto-char pos) | ||
| 1864 | (dired-kill-line))) | ||
| 1865 | (vc-dired-terse-mode | ||
| 1866 | ;; Don't show directories in terse mode. Don't use | ||
| 1867 | ;; dired-kill-line to remove it, because in recursive listings, | ||
| 1868 | ;; that would remove the directory contents as well. | ||
| 1869 | (delete-region (line-beginning-position) | ||
| 1870 | (progn (forward-line 1) (point)))) | ||
| 1871 | ((string-match "\\`\\.\\.?\\'" (file-name-nondirectory filename)) | ||
| 1872 | (dired-kill-line)) | ||
| 1873 | (t | ||
| 1874 | (vc-dired-reformat-line nil) | ||
| 1875 | (forward-line 1)))) | ||
| 1876 | ;; Try to head off calling the expensive state query - | ||
| 1877 | ;; ignore object files, TeX intermediate files, and so forth. | ||
| 1878 | ((vc-dired-ignorable-p filename) | ||
| 1879 | (dired-kill-line)) | ||
| 1880 | ;; Ordinary file -- call the (possibly expensive) state query | ||
| 1881 | ;; | ||
| 1882 | ;; First case: unregistered or unknown. (Unknown shouldn't happen here) | ||
| 1883 | ((member (vc-state filename) '(nil unregistered)) | ||
| 1884 | (if vc-dired-terse-mode | ||
| 1885 | (dired-kill-line) | ||
| 1886 | (vc-dired-reformat-line "?") | ||
| 1887 | (forward-line 1))) | ||
| 1888 | ;; Either we're in non-terse mode or it's out of date | ||
| 1889 | ((not (and vc-dired-terse-mode (vc-up-to-date-p filename))) | ||
| 1890 | (vc-dired-reformat-line (vc-call prettify-state-info filename)) | ||
| 1891 | (forward-line 1)) | ||
| 1892 | ;; Remaining cases are under version control but uninteresting | ||
| 1893 | (t | ||
| 1894 | (dired-kill-line)))) | ||
| 1895 | ;; any other line | ||
| 1896 | (t (forward-line 1)))) | ||
| 1897 | (vc-dired-purge)) | ||
| 1898 | (message "Getting version information... done") | ||
| 1899 | (save-restriction | ||
| 1900 | (widen) | ||
| 1901 | (cond ((eq (count-lines (point-min) (point-max)) 1) | ||
| 1902 | (goto-char (point-min)) | ||
| 1903 | (message "No changes pending under %s" default-directory))))) | ||
| 1904 | |||
| 1905 | ;; VC status implementation | 1809 | ;; VC status implementation |
| 1906 | 1810 | ||
| 1907 | (defun vc-default-status-extra-headers (backend dir) | 1811 | (defun vc-default-status-extra-headers (backend dir) |