From: enami@sys.ptg.sony.co.jp To: Richard Stallman Cc: enami@sys.ptg.sony.co.jp Subject: Re: vc-directory fails if there is sub directory. In-Reply-To: Your message of Tue, 20 Jun 1995 09:06:12 -0400. <199506201306.JAA10343@mole.gnu.ai.mit.edu> Date: Wed, 21 Jun 1995 10:12:18 +0900 > I do not understand the problem at all. I do not use CVS > and I know nothing about it. > > All I know is that someone else sent me a fix similar to part of yours > and I installed it. Then, that fix didn't fix my problem. Please make me to explain the bug again, because 19.28.96 still doesn't fix it. May be the fix you installed is this one, isn't it? * vc-hooks.el (vc-find-cvs-master): Exit gracefully when not finding CVS/Repository. This is a change to check the existense of the file CVS/Repository itself in each working direcotry. In the CVS, the contents of the file CVS/Repository is the path name of directory where the source for this working directory exists. My problem is that if that directory doesn't exists, Emacs signals an error, wrong-type-argument: strinp, nil. This situation occurs, for example, if whole working direcotry is copyed to some another machine. So it is better to check the existense of that directory. Here is minimum change to do it. To check the existense of repository, read CVS/Repository first. Check if the repository directory exists. When exists, read CVS/Entries and set file property and return master file information. enami. Wed Jun 21 10:03:41 1995 enami tsugutomo * vc-hooks.el (vc-find-cvs-master): Check the existense of repository directory. *** vc-hooks.el 1995/06/21 00:43:24 1.1 --- vc-hooks.el 1995/06/21 01:03:37 1.2 *************** *** 653,692 **** (if (and (file-directory-p (concat dirname "CVS/")) (file-readable-p (concat dirname "CVS/Entries")) (file-readable-p (concat dirname "CVS/Repository"))) ! (let ((bufs nil) (fold case-fold-search)) (unwind-protect (save-excursion ! (setq bufs (list ! (find-file-noselect (concat dirname "CVS/Entries")))) (set-buffer (car bufs)) ! (goto-char (point-min)) ! ;; make sure the file name is searched ! ;; case-sensitively ! (setq case-fold-search nil) ! (cond ! ((re-search-forward ! (concat "^/" (regexp-quote basename) "/\\([^/]*\\)/") ! nil t) ! (setq case-fold-search fold) ;; restore the old value ! ;; We found it. Store away version number, now ! ;; that we are anyhow so close to finding it. ! (vc-file-setprop (concat dirname basename) ! 'vc-workfile-version ! (buffer-substring (match-beginning 1) ! (match-end 1))) ! (setq bufs (cons (find-file-noselect ! (concat dirname "CVS/Repository")) ! bufs)) ! (set-buffer (car bufs)) ! (let ((master ! (concat (file-name-as-directory ! (buffer-substring (point-min) ! (1- (point-max)))) ! basename ! ",v"))) ! (throw 'found (cons master 'CVS)))) ! (t (setq case-fold-search fold) ;; restore the old value ! nil))) (mapcar (function kill-buffer) bufs))))) (defun vc-buffer-backend () --- 653,695 ---- (if (and (file-directory-p (concat dirname "CVS/")) (file-readable-p (concat dirname "CVS/Entries")) (file-readable-p (concat dirname "CVS/Repository"))) ! (let ((bufs nil) (fold case-fold-search) (repository nil)) (unwind-protect (save-excursion ! (setq bufs (cons (find-file-noselect ! (concat dirname "CVS/Repository")) ! bufs)) (set-buffer (car bufs)) ! ;; path name of repository of this working directory. ! (setq repository (buffer-substring (point-min) ! (1- (point-max)))) ! (if (file-exists-p repository) ! (progn ! (setq bufs (list ! (find-file-noselect (concat dirname "CVS/Entries")))) ! (set-buffer (car bufs)) ! (goto-char (point-min)) ! ;; make sure the file name is searched ! ;; case-sensitively ! (setq case-fold-search nil) ! (cond ! ((re-search-forward ! (concat "^/" (regexp-quote basename) "/\\([^/]*\\)/") ! nil t) ! (setq case-fold-search fold) ;; restore the old value ! ;; We found it. Store away version number, now ! ;; that we are anyhow so close to finding it. ! (vc-file-setprop (concat dirname basename) ! 'vc-workfile-version ! (buffer-substring (match-beginning 1) ! (match-end 1))) ! (let ((master ! (concat (file-name-as-directory repository) ! basename ! ",v"))) ! (throw 'found (cons master 'CVS)))) ! (t (setq case-fold-search fold) ;; restore the old value ! nil))))) (mapcar (function kill-buffer) bufs))))) (defun vc-buffer-backend ()