comparison lisp/vc-cvs.el @ 49822:02529e3b1f2c

(vc-cvs-dir-state): Protect against DIR not being under CVS control.
author André Spiegel <spiegel@gnu.org>
date Mon, 17 Feb 2003 08:11:13 +0000
parents 322a31d667aa
children 17ff9d10125f
comparison
equal deleted inserted replaced
49821:ae038951ece0 49822:02529e3b1f2c
3 ;; Copyright (C) 1995,98,99,2000,2001,2002 Free Software Foundation, Inc. 3 ;; Copyright (C) 1995,98,99,2000,2001,2002 Free Software Foundation, Inc.
4 4
5 ;; Author: FSF (see vc.el for full credits) 5 ;; Author: FSF (see vc.el for full credits)
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
7 7
8 ;; $Id: vc-cvs.el,v 1.49 2002/10/17 15:43:48 lektu Exp $ 8 ;; $Id: vc-cvs.el,v 1.50 2002/12/26 14:05:48 spiegel Exp $
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by 13 ;; it under the terms of the GNU General Public License as published by
205 'up-to-date 205 'up-to-date
206 'edited))) 206 'edited)))
207 207
208 (defun vc-cvs-dir-state (dir) 208 (defun vc-cvs-dir-state (dir)
209 "Find the CVS state of all files in DIR." 209 "Find the CVS state of all files in DIR."
210 (if (vc-cvs-stay-local-p dir) 210 ;; if DIR is not under CVS control, don't do anything
211 (vc-cvs-dir-state-heuristic dir) 211 (if (file-readable-p (expand-file-name "CVS/Entries" dir))
212 (let ((default-directory dir)) 212 (if (vc-cvs-stay-local-p dir)
213 ;; Don't specify DIR in this command, the default-directory is 213 (vc-cvs-dir-state-heuristic dir)
214 ;; enough. Otherwise it might fail with remote repositories. 214 (let ((default-directory dir))
215 (with-temp-buffer 215 ;; Don't specify DIR in this command, the default-directory is
216 (vc-cvs-command t 0 nil "status" "-l") 216 ;; enough. Otherwise it might fail with remote repositories.
217 (goto-char (point-min)) 217 (with-temp-buffer
218 (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) 218 (vc-do-command t 0 "cvs" nil "status" "-l")
219 (narrow-to-region (match-beginning 0) (match-end 0)) 219 (goto-char (point-min))
220 (vc-cvs-parse-status) 220 (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t)
221 (goto-char (point-max)) 221 (narrow-to-region (match-beginning 0) (match-end 0))
222 (widen)))))) 222 (vc-cvs-parse-status)
223 (goto-char (point-max))
224 (widen)))))))
223 225
224 (defun vc-cvs-workfile-version (file) 226 (defun vc-cvs-workfile-version (file)
225 "CVS-specific version of `vc-workfile-version'." 227 "CVS-specific version of `vc-workfile-version'."
226 ;; There is no need to consult RCS headers under CVS, because we 228 ;; There is no need to consult RCS headers under CVS, because we
227 ;; get the workfile version for free when we recognize that a file 229 ;; get the workfile version for free when we recognize that a file