[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rcs tools

So I've added some functionality to the RCS Hemlock tools.  Specifically:

If you do something like:

	(dolist (subdir (directory (truename "/afs/cs/project/clisp/src/")
				   :check-for-subdirs nil))
	  (let ((name (namestring subdir)))
	    (when (eq (mach:unix-file-kind name t) :directory)
	      (add-definition-dir-translation (concatenate 'string name "/")

in your hemlock init file, then when you edit a definition, it will look
for the file in "lisp:" instead of "/afs/cs/project/clisp/src/<whatever>/".
Just like you would expect from the old definition dir translation stuff.

But if you also:

	(setf *translate-file-names-before-locking* t)

Then any time you go to lock a file, it will use the dir translation stuff
to find out where to put the editable working copy.  In other words, it
will automatically copy the file into your play area, so you don't have to
keep the entire tree around.

Also, there is a new hemlock variable, "RCS Keep Around After Unlocking"
that controls whether or not it deletes the working file after you check it
in.  So if you are using the above mechanism to make copies when you want
to edit the file, this will enable you to automatically nuke the copy when
you are done.

In order to set this variable automatically, I have something like:

	(defconstant my-work-area

	(defun my-read-file-hook (buffer existsp)
	  (declare (ignore existsp))
	  (let ((pathname (buffer-pathname buffer)))
	    (when pathname
	      (let ((directory (probe-file (directory-namestring pathname))))
		(if (null directory)
		    (message "No directory?")
		    (let ((dir-namestring (namestring directory)))
		      (when (string= dir-namestring my-work-area
				     :end1 (length my-work-area))
			(defhvar "RCS Keep Around After Unlocking"
	"If non-NIL (the default) keep the working file around after
	 unlocking it.  When NIL, the working file and buffer are deleted."
			  :value nil
			  :buffer buffer)
			(message "Won't keep if unlocked."))))))))

	(add-hook read-file-hook 'my-read-file-hook)

In other words, if the checked out file is in my play area, then don't keep
it, because I know that my play area just shadows the regular source tree.

Note: in order to get this to work, I changed some of the system sources.
So it won't work until I get a new core built.  Nothing will break if you
add it to your init files now, but it won't work quite as advertised.