diff options
| author | André Spiegel | 1997-07-18 16:06:22 +0000 |
|---|---|---|
| committer | André Spiegel | 1997-07-18 16:06:22 +0000 |
| commit | 702220f3d8aaad081030fe0a337a5698f4190dc5 (patch) | |
| tree | 40488d96ab261c86154e31a63f27c0451dedd8a0 | |
| parent | 155b48df5e05f38f6d1e8183c1ba326f463e8b9d (diff) | |
| download | emacs-702220f3d8aaad081030fe0a337a5698f4190dc5.tar.gz emacs-702220f3d8aaad081030fe0a337a5698f4190dc5.zip | |
(vc-find-cvs-master): Corrected parsing of CVS/Entries, according to CVS docs.
(vc-toggle-read-only): Also work in vc-dired buffers.
| -rw-r--r-- | lisp/vc-hooks.el | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index 0b5cba99422..0cdfb82be7c 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -772,23 +772,37 @@ For CVS, the full name of CVS/Entries is returned." | |||
| 772 | (if (and vc-handle-cvs | 772 | (if (and vc-handle-cvs |
| 773 | (file-directory-p (concat dirname "CVS/")) | 773 | (file-directory-p (concat dirname "CVS/")) |
| 774 | (file-readable-p (concat dirname "CVS/Entries"))) | 774 | (file-readable-p (concat dirname "CVS/Entries"))) |
| 775 | (let (buffer time (fold case-fold-search) | 775 | (let ((file (concat dirname basename)) |
| 776 | (file (concat dirname basename))) | 776 | ;; make sure that the file name is searched |
| 777 | ;; case-sensitively | ||
| 778 | (case-fold-search nil) | ||
| 779 | buffer) | ||
| 777 | (unwind-protect | 780 | (unwind-protect |
| 778 | (save-excursion | 781 | (save-excursion |
| 779 | (setq buffer (set-buffer (get-buffer-create "*vc-info*"))) | 782 | (setq buffer (set-buffer (get-buffer-create "*vc-info*"))) |
| 780 | (vc-insert-file (concat dirname "CVS/Entries")) | 783 | (vc-insert-file (concat dirname "CVS/Entries")) |
| 781 | (goto-char (point-min)) | 784 | (goto-char (point-min)) |
| 782 | ;; make sure the file name is searched | ||
| 783 | ;; case-sensitively | ||
| 784 | (setq case-fold-search nil) | ||
| 785 | (cond | 785 | (cond |
| 786 | ;; entry for a "locally added" file (not yet committed) | ||
| 787 | ((re-search-forward | ||
| 788 | (concat "^/" (regexp-quote basename) "/0/") nil t) | ||
| 789 | (vc-file-setprop file 'vc-checkout-time 0) | ||
| 790 | (vc-file-setprop file 'vc-workfile-version "0") | ||
| 791 | (throw 'found (cons (concat dirname "CVS/Entries") 'CVS))) | ||
| 786 | ;; normal entry | 792 | ;; normal entry |
| 787 | ((re-search-forward | 793 | ((re-search-forward |
| 788 | (concat "^/" (regexp-quote basename) | 794 | (concat "^/" (regexp-quote basename) |
| 789 | "/\\([^/]*\\)/\\([^/+]*\\+\\)?[^ /]* \\([A-Z][a-z][a-z]\\) *\\([0-9]*\\) \\([0-9]*\\):\\([0-9]*\\):\\([0-9]*\\) \\([0-9]*\\)") | 795 | ;; revision |
| 796 | "/\\([^/]*\\)" | ||
| 797 | ;; timestamp | ||
| 798 | "/[A-Z][a-z][a-z]" ;; week day (irrelevant) | ||
| 799 | " \\([A-Z][a-z][a-z]\\)" ;; month name | ||
| 800 | " *\\([0-9]*\\)" ;; day of month | ||
| 801 | " \\([0-9]*\\):\\([0-9]*\\):\\([0-9]*\\)" ;; hms | ||
| 802 | " \\([0-9]*\\)" ;; year | ||
| 803 | ;; optional conflict field | ||
| 804 | "\\(+[^/]*\\)?/") | ||
| 790 | nil t) | 805 | nil t) |
| 791 | (setq case-fold-search fold) ;; restore the old value | ||
| 792 | ;; We found it. Store away version number now that we | 806 | ;; We found it. Store away version number now that we |
| 793 | ;; are anyhow so close to finding it. | 807 | ;; are anyhow so close to finding it. |
| 794 | (vc-file-setprop file | 808 | (vc-file-setprop file |
| @@ -797,38 +811,38 @@ For CVS, the full name of CVS/Entries is returned." | |||
| 797 | ;; If the file hasn't been modified since checkout, | 811 | ;; If the file hasn't been modified since checkout, |
| 798 | ;; store the checkout-time. | 812 | ;; store the checkout-time. |
| 799 | (let ((mtime (nth 5 (file-attributes file))) | 813 | (let ((mtime (nth 5 (file-attributes file))) |
| 800 | (second (string-to-number (match-string 7))) | 814 | (second (string-to-number (match-string 6))) |
| 801 | (minute (string-to-number (match-string 6))) | 815 | (minute (string-to-number (match-string 5))) |
| 802 | (hour (string-to-number (match-string 5))) | 816 | (hour (string-to-number (match-string 4))) |
| 803 | (day (string-to-number (match-string 4))) | 817 | (day (string-to-number (match-string 3))) |
| 804 | (year (string-to-number (match-string 8)))) | 818 | (year (string-to-number (match-string 7)))) |
| 805 | (if (equal mtime | 819 | (if (equal mtime |
| 806 | (encode-time | 820 | (encode-time |
| 807 | second minute hour day | 821 | second minute hour day |
| 808 | (/ (string-match | 822 | (/ (string-match |
| 809 | (match-string 3) | 823 | (match-string 2) |
| 810 | "xxxJanFebMarAprMayJunJulAugSepOctNovDec") | 824 | "xxxJanFebMarAprMayJunJulAugSepOctNovDec") |
| 811 | 3) | 825 | 3) |
| 812 | year 0)) | 826 | year 0)) |
| 813 | (vc-file-setprop file 'vc-checkout-time mtime) | 827 | (vc-file-setprop file 'vc-checkout-time mtime) |
| 814 | (vc-file-setprop file 'vc-checkout-time 0))) | 828 | (vc-file-setprop file 'vc-checkout-time 0))) |
| 815 | (throw 'found (cons (concat dirname "CVS/Entries") 'CVS))) | 829 | (throw 'found (cons (concat dirname "CVS/Entries") 'CVS))) |
| 816 | ;; entry for a "locally added" file (not yet committed) | 830 | ;; entry with arbitrary text as timestamp |
| 831 | ;; (this means we should consider it modified) | ||
| 817 | ((re-search-forward | 832 | ((re-search-forward |
| 818 | (concat "^/" (regexp-quote basename) "/0/Initial ") nil t) | 833 | (concat "^/" (regexp-quote basename) |
| 819 | (setq case-fold-search fold) ;; restore the old value | 834 | ;; revision |
| 820 | (vc-file-setprop file 'vc-checkout-time 0) | 835 | "/\\([^/]*\\)" |
| 821 | (vc-file-setprop file 'vc-workfile-version "0") | 836 | ;; timestamp (arbitrary text) |
| 822 | (throw 'found (cons (concat dirname "CVS/Entries") 'CVS))) | 837 | "/[^/]*" |
| 823 | ((re-search-forward | 838 | ;; optional conflict field |
| 824 | (concat "^/" (regexp-quote basename) | 839 | "\\(+[^/]*\\)?/") |
| 825 | "/\\([^/]*\\)/Initial") nil t) | 840 | nil t) |
| 826 | (setq case-fold-search fold) ;; restore the old value | 841 | ;; We found it. Store away version number now that we |
| 827 | (vc-file-setprop file 'vc-workfile-version "0") | 842 | ;; are anyhow so close to finding it. |
| 828 | (vc-file-setprop file 'vc-checkout-time 0) | 843 | (vc-file-setprop file 'vc-workfile-version (match-string 1)) |
| 829 | (throw 'found (cons (concat dirname "CVS/Entries") 'CVS))) | 844 | (vc-file-setprop file 'vc-checkout-time 0)) |
| 830 | (t (setq case-fold-search fold) ;; restore the old value | 845 | (t nil))) |
| 831 | nil))) | ||
| 832 | (kill-buffer buffer))))) | 846 | (kill-buffer buffer))))) |
| 833 | 847 | ||
| 834 | (defun vc-buffer-backend () | 848 | (defun vc-buffer-backend () |
| @@ -843,7 +857,9 @@ If the buffer is visiting a file registered with version control, | |||
| 843 | then check the file in or out. Otherwise, just change the read-only flag | 857 | then check the file in or out. Otherwise, just change the read-only flag |
| 844 | of the buffer. With prefix argument, ask for version number." | 858 | of the buffer. With prefix argument, ask for version number." |
| 845 | (interactive "P") | 859 | (interactive "P") |
| 846 | (if (vc-backend (buffer-file-name)) | 860 | (if (or (and (boundp 'vc-dired-mode) vc-dired-mode) |
| 861 | ;; use boundp because vc.el might not be loaded | ||
| 862 | (vc-backend (buffer-file-name))) | ||
| 847 | (vc-next-action verbose) | 863 | (vc-next-action verbose) |
| 848 | (toggle-read-only))) | 864 | (toggle-read-only))) |
| 849 | (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) | 865 | (define-key global-map "\C-x\C-q" 'vc-toggle-read-only) |