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

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

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

revision 1.1 by monnier, Sun Apr 20 00:02:37 2003 UTC revision 1.2 by monnier, Tue Apr 22 19:03:18 2003 UTC
# Line 45  Line 45 
45    
46  ;;; Bugs:  ;;; Bugs:
47    
 ;; - Both the diff and log output contain Meta-CVS inode names so that  
 ;;   several operations in those buffers don't work as advertised.  
48  ;; - VC-dired doesn't work.  ;; - VC-dired doesn't work.
49    
50  ;;; Code:  ;;; Code:
# Line 135  of a repository; then VC only stays loca Line 133  of a repository; then VC only stays loca
133    
134  (defun vc-mcvs-root (file)  (defun vc-mcvs-root (file)
135    "Return the root directory of a Meta-CVS project, if any."    "Return the root directory of a Meta-CVS project, if any."
136    (let ((root nil))    (or (vc-file-getprop file 'mcvs-root)
137      (while (not (or root (equal file (setq file (file-name-directory file)))))        (vc-file-setprop
138        (if (file-directory-p (expand-file-name "MCVS/CVS" file))         file 'mcvs-root
139            (setq root file)         (let ((root nil))
140          (setq file (directory-file-name file))))           (while (not (or root
141      root))                           (equal file (setq file (file-name-directory file)))))
142               (if (file-directory-p (expand-file-name "MCVS/CVS" file))
143                   (setq root file)
144                 (setq file (directory-file-name file))))
145             root))))
146    
147  (defun vc-mcvs-read (file)  (defun vc-mcvs-read (file)
148    (with-temp-buffer    (with-temp-buffer
# Line 158  of a repository; then VC only stays loca Line 160  of a repository; then VC only stays loca
160    (let (root inode cvsfile)    (let (root inode cvsfile)
161      (when (and (setq root (vc-mcvs-root file))      (when (and (setq root (vc-mcvs-root file))
162                 (setq inode (vc-mcvs-map-file                 (setq inode (vc-mcvs-map-file
163                              root (substring file (length root)))))                              root (file-relative-name file root))))
164        (vc-file-setprop file 'mcvs-inode inode)        (vc-file-setprop file 'mcvs-inode inode)
       (vc-file-setprop file 'mcvs-root root)  
165        ;; Avoid calling `mcvs diff' in vc-workfile-unchanged-p.        ;; Avoid calling `mcvs diff' in vc-workfile-unchanged-p.
166        (vc-file-setprop file 'vc-checkout-time        (vc-file-setprop file 'vc-checkout-time
167                         (if (vc-cvs-registered                         (if (vc-cvs-registered
# Line 243  the Meta-CVS command (in that order)." Line 244  the Meta-CVS command (in that order)."
244      ;; belly-up.      ;; belly-up.
245      (unless (file-writable-p map-file)      (unless (file-writable-p map-file)
246        (vc-checkout map-file t))        (vc-checkout map-file t))
247      (unless (file-writable-p types-file)      (unless (or (file-writable-p types-file) (not (file-exists-p types-file)))
248        (vc-checkout types-file t))        (vc-checkout types-file t))
249      ;; Make sure the `mcvs add' will not fire up the CVSEDITOR      ;; Make sure the `mcvs add' will not fire up the CVSEDITOR
250      ;; to add a rule for the given file's extension.      ;; to add a rule for the given file's extension.
# Line 255  the Meta-CVS command (in that order)." Line 256  the Meta-CVS command (in that order)."
256          (push (list ext (make-symbol (upcase (concat ":" type)))) types)          (push (list ext (make-symbol (upcase (concat ":" type)))) types)
257          (setq types (sort types (lambda (x y) (string< (car x) (car y)))))          (setq types (sort types (lambda (x y) (string< (car x) (car y)))))
258          (with-current-buffer (find-file-noselect types-file)          (with-current-buffer (find-file-noselect types-file)
           (if buffer-read-only (vc-checkout buffer-file-name t))  
259            (erase-buffer)            (erase-buffer)
260            (pp types (current-buffer))            (pp types (current-buffer))
261            (save-buffer)            (save-buffer)
# Line 277  the Meta-CVS command (in that order)." Line 277  the Meta-CVS command (in that order)."
277        ;; I'm not sure exactly why, but if we don't setup the inode and root        ;; I'm not sure exactly why, but if we don't setup the inode and root
278        ;; prop of the file, things break later on in vc-mode-line that        ;; prop of the file, things break later on in vc-mode-line that
279        ;; ends up calling vc-mcvs-workfile-version.        ;; ends up calling vc-mcvs-workfile-version.
       (vc-mcvs-registered file)  
280        ;; We also need to set vc-checkout-time so that vc-workfile-unchanged-p        ;; We also need to set vc-checkout-time so that vc-workfile-unchanged-p
281        ;; doesn't try to call `mcvs diff' on the file.        ;; doesn't try to call `mcvs diff' on the file.
282        (vc-file-setprop file 'vc-checkout-time 0))))        (vc-mcvs-registered file))))
283    
284  (defalias 'vc-mcvs-responsible-p 'vc-mcvs-root  (defalias 'vc-mcvs-responsible-p 'vc-mcvs-root
285    "Return non-nil if CVS thinks it is responsible for FILE.")    "Return non-nil if CVS thinks it is responsible for FILE.")
# Line 591  If UPDATE is non-nil, then update (resyn Line 590  If UPDATE is non-nil, then update (resyn
590    "A wrapper around `vc-do-command' for use in vc-mcvs.el.    "A wrapper around `vc-do-command' for use in vc-mcvs.el.
591  The difference to vc-do-command is that this function always invokes `mcvs',  The difference to vc-do-command is that this function always invokes `mcvs',
592  and that it passes `vc-mcvs-global-switches' to it before FLAGS."  and that it passes `vc-mcvs-global-switches' to it before FLAGS."
593    (apply 'vc-do-command buffer okstatus "mcvs" file    (let ((args (append '("--error-continue")
594           (append '("--error-continue")                        (if (stringp vc-mcvs-global-switches)
595                   (if (stringp vc-mcvs-global-switches)                            (cons vc-mcvs-global-switches flags)
596                       (cons vc-mcvs-global-switches flags)                          (append vc-mcvs-global-switches
597                     (append vc-mcvs-global-switches                                  flags)))))
598                             flags)))))      (if (member (car flags) '("diff" "log"))
599            ;; We need to filter the output.
600            (vc-do-command buffer okstatus "sh" nil "-c"
601                           (concat "mcvs "
602                                   (mapconcat
603                                    'shell-quote-argument
604                                    (append (remq nil args)
605                                            (if file (list (file-relative-name file))))
606                                    " ")
607                                   " | mcvs filt"))
608          (apply 'vc-do-command buffer okstatus "mcvs" file args))))
609    
610  (defun vc-mcvs-stay-local-p (file) (vc-mcvs-cvs stay-local-p file))  (defun vc-mcvs-stay-local-p (file) (vc-mcvs-cvs stay-local-p file))
611    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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