From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.help Subject: Re: Make CVS default revision controller Date: 22 May 2003 09:53:12 -0400 Organization: Yale University Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <5lhe7ndr5j.fsf@rum.cs.yale.edu> References: <5l7k8mnf2o.fsf@rum.cs.yale.edu> <84he7nuzww.fsf@lucy.is.informatik.uni-duisburg.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053612459 31720 80.91.224.249 (22 May 2003 14:07:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 22 May 2003 14:07:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Thu May 22 16:07:34 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19IqjF-0008Ek-00 for ; Thu, 22 May 2003 16:07:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Iqhn-0006I8-R3 for gnu-help-gnu-emacs@m.gmane.org; Thu, 22 May 2003 10:06:03 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!canoe.uoregon.edu!news.wss.yale.edu!rum.cs.yale.edu!rum.cs.yale.edu Original-Newsgroups: gnu.emacs.help Original-Lines: 75 Original-NNTP-Posting-Host: rum.cs.yale.edu Original-X-Trace: news.wss.yale.edu 1053611595 29096 128.36.229.169 (22 May 2003 13:53:15 GMT) Original-X-Complaints-To: news@news.wss.yale.edu Original-NNTP-Posting-Date: Thu, 22 May 2003 13:53:15 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-Original-NNTP-Posting-Host: rum.cs.yale.edu X-Original-Trace: 22 May 2003 09:53:12 -0400, rum.cs.yale.edu Original-Xref: shelby.stanford.edu gnu.emacs.help:113531 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:10027 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10027 > 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'."