all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu>
Subject: Re: Make CVS default revision controller
Date: 22 May 2003 09:53:12 -0400	[thread overview]
Message-ID: <5lhe7ndr5j.fsf@rum.cs.yale.edu> (raw)
In-Reply-To: se4r3ndx1h.fsf@crpppc215.epfl.ch

> 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'."

  reply	other threads:[~2003-05-22 13:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-20  8:35 Make CVS default revision controller marcuirl
2003-05-20  9:27 ` Stefan Monnier
2003-05-20 12:36   ` Niels Freimann
     [not found]   ` <mailman.6455.1053434411.21513.help-gnu-emacs@gnu.org>
2003-05-22  8:51     ` Kai Großjohann
2003-05-22 11:46       ` marcuirl
2003-05-22 13:53         ` Stefan Monnier [this message]
2003-05-22 15:24           ` Kai Großjohann
2003-05-22 14:29         ` Burton Samograd
2003-05-22 15:26           ` Kai Großjohann
2003-05-22 17:21             ` Edward O'Connor
2003-05-22 22:35             ` Benjamin Rutt
2003-05-23  6:11               ` Kai Großjohann
2003-05-22 14:58         ` Harald Maier
2003-05-22 15:22         ` Kai Großjohann
2003-05-23  8:26           ` marcuirl
2003-05-23 11:48             ` Benjamin Riefenstahl
2003-05-23 14:52             ` Stefan Monnier
2003-05-26  6:56               ` marcuirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5lhe7ndr5j.fsf@rum.cs.yale.edu \
    --to=monnier+gnu.emacs.help/news/@flint.cs.yale.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.