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

mhenoch at common-lisp.net mhenoch at common-lisp.net
Thu Sep 6 06:07:15 UTC 2007


Author: mhenoch
Date: Thu Sep  6 02:07:13 2007
New Revision: 145

Modified:
   cl-darcs/trunk/repo.lisp
Log:
Check if PREPARE-NEW-REPO is run in a repository


Modified: cl-darcs/trunk/repo.lisp
==============================================================================
--- cl-darcs/trunk/repo.lisp	(original)
+++ cl-darcs/trunk/repo.lisp	Thu Sep  6 02:07:13 2007
@@ -20,12 +20,17 @@
   "Create directories for starting a repo at OUTNAME."
   (unless (fad:directory-exists-p outname)
     (error "Directory ~A does not exist." outname))
-  (make-dir (merge-pathnames (make-pathname :directory (list :relative "_darcs"))
-			     outname))
-  (dolist (dir '("patches" "checkpoints" "prefs" "inventories"))
-    (make-dir (merge-pathnames
-	       (make-pathname :directory (list :relative "_darcs" dir))
-	       outname)))
+  (let ((darcs-dir (merge-pathnames
+		    (make-pathname :directory (list :relative "_darcs"))
+		    outname)))
+    (when (fad:directory-exists-p darcs-dir)
+      ;; This error message should match the one in darcs/tests/init.pl
+      (error "Do not run this command in a repository."))
+    (make-dir darcs-dir)
+    (dolist (dir '("patches" "checkpoints" "prefs" "inventories"))
+      (make-dir (merge-pathnames
+		 (make-pathname :directory (list :relative dir))
+		 darcs-dir))))
   (write-default-prefs outname))
 
 ;; {lazily,}read_repo in DarcsRepo.lhs



More information about the Cl-darcs-cvs mailing list