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

mhenoch at common-lisp.net mhenoch at common-lisp.net
Sat Jul 8 14:03:30 UTC 2006


Author: mhenoch
Date: Sat Jul  8 10:03:30 2006
New Revision: 17

Modified:
   cl-darcs/trunk/unwind.lisp
Log:
In put-before, handle case of empty patch list correctly.


Modified: cl-darcs/trunk/unwind.lisp
==============================================================================
--- cl-darcs/trunk/unwind.lisp	(original)
+++ cl-darcs/trunk/unwind.lisp	Sat Jul  8 10:03:30 2006
@@ -73,11 +73,12 @@
 and commuted through PATCHES, to finally give a list of patches
 whose context consists of P1.  If any commutation fails, this
 operation fails as well."
-  (destructuring-bind (&optional p2-c p1-c) (commute (invert-patch p1) (car patches))
-    (and p2-c p1-c
-	 (commute p1 p2-c)
-	 (let ((rest (put-before p1-c (cdr patches))))
-	   (and rest (cons p2-c rest))))))
+  (when patches
+    (destructuring-bind (&optional p2-c p1-c) (commute (invert-patch p1) (car patches))
+      (and p2-c p1-c
+	   (commute p1 p2-c)
+	   (let ((rest (put-before p1-c (cdr patches))))
+	     (and rest (cons p2-c rest)))))))
 
 (defun all-head-permutations (ps)
   "Return all possible permutations of PS.



More information about the Cl-darcs-cvs mailing list