[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make CVS default revision controller
From: |
Stefan Monnier |
Subject: |
Re: Make CVS default revision controller |
Date: |
22 May 2003 09:53:12 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
> All I want is to put .emacs, .gnus etc under CVS now that I am more
> confident using it. And do this without importing the entire ${HOME}
> directory structure. A work around I have thought is to ln -s these files
> to others in a config/ But that will not fix the problem when in
> another directory I want to CVS just one file in that directory?
Just tell us what commands would do what you want Emacs to do.
Emacs is not magical.
I.e. the difficulty is not just with Emacs but with CVS (it would be the
same with Subversion, arch, or pretty much any version control system other
than RCS and SCCS ;-).
One thing you could do is the following:
> mkdir $CVSROOT/home
> cd
> cvs -d $CVSROOT checkout -d temphome home
> mv temphome/CVS .
> rmdir temphome
[ Beware, tho: CVS does not like it when $CVSROOT and a workarea overlap,
so make sure that $CVSROOT is not somewhere under your home dir ].
so that your home directory is now "a CVS workarea for the `home' module".
Emacs will now do what you want under ~/ but it still won't do what you
want in subdirectories. We could probably hack vc-cvs.el to consider
that a subdirectory of a CVS-managed directory is also managed by CVS
and have vc-cvs.el transparently `cvs add' the parent subdir(s) before
adding the file.
The patch below (guaranteed 100% untested) might do that (you'll also need
to change vc-handled-backends to put CVS before RCS so as to indicate your
preferences).
Stefan
PS: The patch was made against the Emacs-CVS version of vc-cvs.el.
--- vc-cvs.el.~1.60.~ Fri May 9 10:32:01 2003
+++ vc-cvs.el Thu May 22 09:48:40 2003
@@ -286,6 +286,10 @@
`vc-register-switches' and `vc-cvs-register-switches' are passed to
the CVS command (in that order)."
+ (if (and (not (vc-cvs-responsible-p file))
+ (vc-cvs-could-register file))
+ ;; Register the directory if needed.
+ (vc-cvs-register (directory-file-name (file-name-directory file))))
(apply 'vc-cvs-command nil 0 file
"add"
(and comment (string-match "[^\t\n ]" comment)
@@ -299,9 +303,18 @@
file
(file-name-directory file)))))
-(defalias 'vc-cvs-could-register 'vc-cvs-responsible-p
+(defun vc-cvs-could-register (file)
"Return non-nil if FILE could be registered in CVS.
-This is only possible if CVS is responsible for FILE's directory.")
+This is only possible if CVS is managing FILE's directory or one of
+its parents."
+ (let ((dir file))
+ (while (and (stringp dir)
+ (not (equal dir (setq dir (file-name-directory dir))))
+ dir)
+ (setq dir (if (file-directory-p
+ (expand-file-name "CVS/Entries" dir))
+ t (directory-file-name dir))))
+ (eq dir t)))
(defun vc-cvs-checkin (file rev comment)
"CVS-specific version of `vc-backend-checkin'."
- Make CVS default revision controller, marcuirl, 2003/05/20
- Re: Make CVS default revision controller, Stefan Monnier, 2003/05/20
- Re: Make CVS default revision controller, Niels Freimann, 2003/05/20
- Message not available
- Re: Make CVS default revision controller, Burton Samograd, 2003/05/22
- Re: Make CVS default revision controller, Kai Großjohann, 2003/05/22
- Re: Make CVS default revision controller, Edward O'Connor, 2003/05/22
- Re: Make CVS default revision controller, Benjamin Rutt, 2003/05/22
- Re: Make CVS default revision controller, Kai Großjohann, 2003/05/23
- Re: Make CVS default revision controller, Harald Maier, 2003/05/22
- Re: Make CVS default revision controller, Kai Großjohann, 2003/05/22
- Re: Make CVS default revision controller, marcuirl, 2003/05/23
- Re: Make CVS default revision controller, Benjamin Riefenstahl, 2003/05/23