diff options
| author | André Spiegel | 1998-05-02 16:41:44 +0000 |
|---|---|---|
| committer | André Spiegel | 1998-05-02 16:41:44 +0000 |
| commit | eaff65c86b39afd757637de3b610abc701e0bdd8 (patch) | |
| tree | 08574e22f2be9665b8de9177e36d0ca4961c3f7d | |
| parent | eccceb78ec5fcb417f6818dc5afa63f68235a439 (diff) | |
| download | emacs-eaff65c86b39afd757637de3b610abc701e0bdd8.tar.gz emacs-eaff65c86b39afd757637de3b610abc701e0bdd8.zip | |
(vc-parse-cvs-status): Optimized. Ignore "Locally Removed" files.
| -rw-r--r-- | lisp/vc-hooks.el | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index cfbb1111cba..a6b455f8eef 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | 5 | ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> |
| 6 | ;; Maintainer: Andre Spiegel <spiegel@inf.fu-berlin.de> | 6 | ;; Maintainer: Andre Spiegel <spiegel@inf.fu-berlin.de> |
| 7 | 7 | ||
| 8 | ;; $Id: vc-hooks.el,v 1.105 1998/04/05 18:44:35 spiegel Exp done $ | 8 | ;; $Id: vc-hooks.el,v 1.106 1998/04/20 02:00:00 done Exp spiegel $ |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -307,40 +307,41 @@ similarly for other version control systems." | |||
| 307 | (error "Couldn't find version control information"))) | 307 | (error "Couldn't find version control information"))) |
| 308 | exec-status)) | 308 | exec-status)) |
| 309 | 309 | ||
| 310 | (defun vc-parse-cvs-status (&optional file) | 310 | (defun vc-parse-cvs-status (&optional full) |
| 311 | ;; Parse output of "cvs status" command in the current buffer and | 311 | ;; Parse output of "cvs status" command in the current buffer and |
| 312 | ;; set file properties accordingly. If argument FILE is given, it | 312 | ;; set file properties accordingly. Unless FULL is t, parse only |
| 313 | ;; must be the name of the file to which the status output applies, | 313 | ;; essential information. |
| 314 | ;; otherwise FILE is derived from the status output itself. | 314 | (let (file status) |
| 315 | (or file | 315 | (goto-char (point-min)) |
| 316 | (progn (goto-char (point-min)) | 316 | (if (re-search-forward "^File: " nil t) |
| 317 | (re-search-forward "^File: \\([^ \t]+\\)" nil t) | 317 | (cond |
| 318 | (setq file (concat default-directory (match-string 1))))) | 318 | ((looking-at "no file") nil) |
| 319 | (vc-parse-buffer | 319 | ((re-search-forward "\\=\\([^ \t]+\\)" nil t) |
| 320 | ;; CVS 1.3 says "RCS Version:", other releases "RCS Revision:", | 320 | (setq file (concat default-directory (match-string 1))) |
| 321 | ;; and CVS 1.4a1 says "Repository revision:". | 321 | (vc-file-setprop file 'vc-backend 'CVS) |
| 322 | '(("\\(RCS Version\\|RCS Revision\\|Repository revision\\):[\t ]+\\([0-9.]+\\)" 2) | 322 | (if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t)) |
| 323 | ("^File: [^ \t]+[ \t]+Status: \\(.*\\)" 1)) | 323 | (setq status "Unknown") |
| 324 | file | 324 | (setq status (match-string 1))) |
| 325 | '(vc-latest-version vc-cvs-status)) | 325 | (if (and full |
| 326 | ;; Translate those status values that we understand into symbols. | 326 | (re-search-forward |
| 327 | ;; Any other value is converted to nil. | 327 | "\\(RCS Version\\|RCS Revision\\|Repository revision\\):[\t ]+\\([0-9.]+\\)" |
| 328 | (let ((status (vc-file-getprop file 'vc-cvs-status))) | 328 | nil t)) |
| 329 | (cond | 329 | (vc-file-setprop file 'vc-latest-version (match-string 2))) |
| 330 | ((string-match "Up-to-date" status) | 330 | (cond |
| 331 | (vc-file-setprop file 'vc-cvs-status 'up-to-date) | 331 | ((string-match "Up-to-date" status) |
| 332 | (vc-file-setprop file 'vc-checkout-time | 332 | (vc-file-setprop file 'vc-cvs-status 'up-to-date) |
| 333 | (nth 5 (file-attributes file)))) | 333 | (vc-file-setprop file 'vc-checkout-time |
| 334 | ((vc-file-setprop file 'vc-cvs-status | 334 | (nth 5 (file-attributes file)))) |
| 335 | (cond | 335 | ((vc-file-setprop file 'vc-cvs-status |
| 336 | ((string-match "Locally Modified" status) 'locally-modified) | 336 | (cond |
| 337 | ((string-match "Needs Merge" status) 'needs-merge) | 337 | ((string-match "Locally Modified" status) 'locally-modified) |
| 338 | ((string-match "Needs \\(Checkout\\|Patch\\)" status) | 338 | ((string-match "Needs Merge" status) 'needs-merge) |
| 339 | 'needs-checkout) | 339 | ((string-match "Needs \\(Checkout\\|Patch\\)" status) |
| 340 | ((string-match "Unresolved Conflict" status) 'unresolved-conflict) | 340 | 'needs-checkout) |
| 341 | ((string-match "Locally Added" status) 'locally-added) | 341 | ((string-match "Unresolved Conflict" status) 'unresolved-conflict) |
| 342 | ((string-match "New file!" status) 'locally-added) | 342 | ((string-match "Locally Added" status) 'locally-added) |
| 343 | (t 'unknown))))))) | 343 | ((string-match "New file!" status) 'locally-added) |
| 344 | (t 'unknown)))))))))) | ||
| 344 | 345 | ||
| 345 | (defun vc-fetch-master-properties (file) | 346 | (defun vc-fetch-master-properties (file) |
| 346 | ;; Fetch those properties of FILE that are stored in the master file. | 347 | ;; Fetch those properties of FILE that are stored in the master file. |
| @@ -405,7 +406,7 @@ similarly for other version control systems." | |||
| 405 | (let ((default-directory (file-name-directory file))) | 406 | (let ((default-directory (file-name-directory file))) |
| 406 | (vc-simple-command 0 "cvs" (file-name-nondirectory file) "status")) | 407 | (vc-simple-command 0 "cvs" (file-name-nondirectory file) "status")) |
| 407 | (set-buffer (get-buffer "*vc-info*")) | 408 | (set-buffer (get-buffer "*vc-info*")) |
| 408 | (vc-parse-cvs-status file)))) | 409 | (vc-parse-cvs-status t)))) |
| 409 | (if (get-buffer "*vc-info*") | 410 | (if (get-buffer "*vc-info*") |
| 410 | (kill-buffer (get-buffer "*vc-info*"))))) | 411 | (kill-buffer (get-buffer "*vc-info*"))))) |
| 411 | 412 | ||