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

mhenoch at common-lisp.net mhenoch at common-lisp.net
Wed Mar 5 09:20:38 UTC 2008


Author: mhenoch
Date: Wed Mar  5 04:20:37 2008
New Revision: 173

Modified:
   cl-darcs/trunk/cmdline.lisp
Log:
Use WITH-REPO for "record"


Modified: cl-darcs/trunk/cmdline.lisp
==============================================================================
--- cl-darcs/trunk/cmdline.lisp	(original)
+++ cl-darcs/trunk/cmdline.lisp	Wed Mar  5 04:20:37 2008
@@ -237,48 +237,48 @@
    :help "ask for extra dependencies"))
 
 (define-darcs-command record
-    (author all-patches patch-name ask-deps)
+    (author all-patches patch-name ask-deps repodir)
     (&rest files)
     "Save changes in the working copy to the repository as a patch."
-  (let* ((repo (find-repo))
-	 (author (or author
-		     ;; XXX: other ways to indicate author
-		     (progn
-		       (format *query-io* "~&Who is the author? ")
-		       (read-line *query-io*))))
-	 (patch-name (or patch-name
-			 (progn
-			   (format *query-io* "~&What is the patch name? ")
-			   (read-line *query-io*))))
-	 (files (mapcar
-		 (lambda (file)
-		   (setf file (enough-namestring file repo))
-		   (if (fad:directory-exists-p file)
-		       (sanitize-filename file :type :directory)
-		       (sanitize-filename file :type :file)))
-		 files)))
-    ;; XXX: long log
-
-    (let ((patches (diff-repo repo)))
-      (flet ((ask (patch)
-	       ;; If any files were specified, use only patches
-	       ;; touching those files/directories.
-	       (if (or (null files)
-		       (and (typep patch 'file-patch)
-			    (member (patch-filename patch) files :test #'equal))
-		       (and (typep patch 'directory-patch)
-			    (member (patch-directory patch) files :test #'equal)))
-		   ;; If all-patches was requested, record all patches
-		   ;; matching the file criterion.
-		   (or all-patches
+  (with-repo repodir
+    (let* ((author (or author
+		       ;; XXX: other ways to indicate author
 		       (progn
-			 (display-patch patch *query-io*)
-			 (y-or-n-p "Record patch ~A?" patch)))
-		   nil)))
-	(record-patches repo patch-name author :now nil
-			(select-patches patches #'ask))
-	(format t "~&Finished recording patch '~A'~%" patch-name)
-	0))))
+			 (format *query-io* "~&Who is the author? ")
+			 (read-line *query-io*))))
+	   (patch-name (or patch-name
+			   (progn
+			     (format *query-io* "~&What is the patch name? ")
+			     (read-line *query-io*))))
+	   (files (mapcar
+		   (lambda (file)
+		     (setf file (enough-namestring file repodir))
+		     (if (fad:directory-exists-p file)
+			 (sanitize-filename file :type :directory)
+			 (sanitize-filename file :type :file)))
+		   files)))
+      ;; XXX: long log
+
+      (let ((patches (diff-repo repodir)))
+	(flet ((ask (patch)
+		 ;; If any files were specified, use only patches
+		 ;; touching those files/directories.
+		 (if (or (null files)
+			 (and (typep patch 'file-patch)
+			      (member (patch-filename patch) files :test #'equal))
+			 (and (typep patch 'directory-patch)
+			      (member (patch-directory patch) files :test #'equal)))
+		     ;; If all-patches was requested, record all patches
+		     ;; matching the file criterion.
+		     (or all-patches
+			 (progn
+			   (display-patch patch *query-io*)
+			   (y-or-n-p "Record patch ~A?" patch)))
+		     nil)))
+	  (record-patches repodir patch-name author :now nil
+			  (select-patches patches #'ask))
+	  (format t "~&Finished recording patch '~A'~%" patch-name)
+	  0)))))
 
 (define-darcs-command pull
     (all-patches repodir)



More information about the Cl-darcs-cvs mailing list