[Cl-darcs-cvs] r15 - cl-darcs/trunk

mhenoch at common-lisp.net mhenoch at common-lisp.net
Sat Jun 24 19:26:26 UTC 2006


Author: mhenoch
Date: Sat Jun 24 15:26:19 2006
New Revision: 15

Modified:
   cl-darcs/trunk/prefs.lisp
Log:
Add add-to-preflist and set-default-repo.


Modified: cl-darcs/trunk/prefs.lisp
==============================================================================
--- cl-darcs/trunk/prefs.lisp	(original)
+++ cl-darcs/trunk/prefs.lisp	Sat Jun 24 15:26:19 2006
@@ -67,7 +67,18 @@
 		       :if-exists :supersede
 		       :if-does-not-exist :create)
     (dolist (pref preflist)
-      (format out "~A~%" pref))))
+      (write-line pref out))))
+
+(defun add-to-preflist (upath filename pref)
+  "Add PREF to preferences in FILENAME in repo UPATH.
+Do nothing if it's already there."
+  (let ((prefs (get-preflist upath filename)))
+    (unless (member pref prefs :test #'string=)
+      (with-open-file (out (upath-subdir upath '("_darcs" "prefs") filename)
+			   :direction :output
+			   :if-exists :append
+			   :if-does-not-exist :create)
+	(write-line pref out)))))
 
 (defun write-default-prefs (repopath)
   (default-boring repopath)
@@ -105,3 +116,7 @@
 		   "tiff" "pnm" "pbm" "pgm" "ppm" "bmp" "mng" 
 		   "tar" "bz2" "z" "zip" "jar" "so" "a" 
 		   "tgz" "mpg" "mpeg" "iso" "exe" "doc")))))
+
+(defun set-default-repo (repopath repostring)
+  (set-preflist repopath "defaultrepo" (list repostring))
+  (add-to-preflist repopath "repos" repostring))



More information about the Cl-darcs-cvs mailing list