/[emacs]/emacs/lisp/vc-hooks.el
ViewVC logotype

Diff of /emacs/lisp/vc-hooks.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.139.2.7 by miles, Tue Apr 27 14:10:58 2004 UTC revision 1.139.2.8 by miles, Thu Sep 16 00:14:58 2004 UTC
# Line 1  Line 1 
1  ;;; vc-hooks.el --- resident support for version-control  ;;; vc-hooks.el --- resident support for version-control
2    
3  ;; Copyright (C) 1992,93,94,95,96,98,99,2000,03,2004  ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003, 2004
4  ;;           Free Software Foundation, Inc.  ;;           Free Software Foundation, Inc.
5    
6  ;; Author:     FSF (see vc.el for full credits)  ;; Author:     FSF (see vc.el for full credits)
# Line 52  BACKEND, use `vc-handled-backends'.") Line 52  BACKEND, use `vc-handled-backends'.")
52  (defvar vc-header-alist ())  (defvar vc-header-alist ())
53  (make-obsolete-variable 'vc-header-alist 'vc-BACKEND-header)  (make-obsolete-variable 'vc-header-alist 'vc-BACKEND-header)
54    
55    (defvar vc-ignore-dir-regexp "\\`\\([\\/][\\/]\\|/net/\\|/afs/\\)\\'"
56     "Regexp matching directory names that are not under VC's control.
57    The default regexp prevents fruitless and time-consuming attempts
58    to determine the VC status in directories in which filenames are
59    interpreted as hostnames.")
60    
61  (defcustom vc-handled-backends '(RCS CVS SVN SCCS Arch MCVS)  (defcustom vc-handled-backends '(RCS CVS SVN SCCS Arch MCVS)
62    ;; Arch and MCVS come last because they are per-tree rather than per-dir.    ;; Arch and MCVS come last because they are per-tree rather than per-dir.
63    "*List of version control backends for which VC will be used.    "*List of version control backends for which VC will be used.
# Line 298  non-nil if FILE exists and its contents Line 304  non-nil if FILE exists and its contents
304      (set-buffer-modified-p nil)      (set-buffer-modified-p nil)
305      t))      t))
306    
307    (defun vc-find-root (file witness)
308      "Find the root of a checked out project.
309    The function walks up the directory tree from FILE looking for WITNESS.
310    If WITNESS if not found, return nil, otherwise return the root."
311      (let ((root nil))
312        (while (not (or root
313                       (equal file (setq file (file-name-directory file)))
314                       (null file)
315                       (string-match vc-ignore-dir-regexp file)))
316          (if (file-exists-p (expand-file-name witness file))
317             (setq root file)
318           (setq file (directory-file-name file))))
319        root))
320    
321  ;; Access functions to file properties  ;; Access functions to file properties
322  ;; (Properties should be _set_ using vc-file-setprop, but  ;; (Properties should be _set_ using vc-file-setprop, but
323  ;; _retrieved_ only through these functions, which decide  ;; _retrieved_ only through these functions, which decide
# Line 315  on the result of a previous call, use `v Line 335  on the result of a previous call, use `v
335  file was previously registered under a certain backend, then that  file was previously registered under a certain backend, then that
336  backend is tried first."  backend is tried first."
337    (let (handler)    (let (handler)
338      (if (boundp 'file-name-handler-alist)      (cond
339          (setq handler (find-file-name-handler file 'vc-registered)))       ((string-match vc-ignore-dir-regexp (file-name-directory file)) nil)
340      (if handler       ((and (boundp 'file-name-handler-alist)
341          ;; handler should set vc-backend and return t if registered            (setq handler (find-file-name-handler file 'vc-registered)))
342          (funcall handler 'vc-registered file)        ;; handler should set vc-backend and return t if registered
343          (funcall handler 'vc-registered file))
344         (t
345        ;; There is no file name handler.        ;; There is no file name handler.
346        ;; Try vc-BACKEND-registered for each handled BACKEND.        ;; Try vc-BACKEND-registered for each handled BACKEND.
347        (catch 'found        (catch 'found
# Line 334  backend is tried first." Line 356  backend is tried first."
356               (cons backend vc-handled-backends))))               (cons backend vc-handled-backends))))
357          ;; File is not registered.          ;; File is not registered.
358          (vc-file-setprop file 'vc-backend 'none)          (vc-file-setprop file 'vc-backend 'none)
359          nil))))          nil)))))
360    
361  (defun vc-backend (file)  (defun vc-backend (file)
362    "Return the version control type of FILE, nil if it is not registered."    "Return the version control type of FILE, nil if it is not registered."
# Line 869  Used in `find-file-not-found-functions'. Line 891  Used in `find-file-not-found-functions'.
891    
892  (provide 'vc-hooks)  (provide 'vc-hooks)
893    
894  ;;; arch-tag: 2e5a6fa7-1d30-48e2-8bd0-e3d335f04f32  ;; arch-tag: 2e5a6fa7-1d30-48e2-8bd0-e3d335f04f32
895  ;;; vc-hooks.el ends here  ;;; vc-hooks.el ends here

Legend:
Removed from v.1.139.2.7  
changed lines
  Added in v.1.139.2.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26