[Cl-darcs-cvs] r24 - cl-darcs/trunk
Author: mhenoch Date: Wed Jul 12 10:42:38 2006 New Revision: 24 Modified: cl-darcs/trunk/repo.lisp Log: Add get-common-and-uncommon Modified: cl-darcs/trunk/repo.lisp ============================================================================== --- cl-darcs/trunk/repo.lisp (original) +++ cl-darcs/trunk/repo.lisp Wed Jul 12 10:42:38 2006 @@ -132,3 +132,17 @@ (write-byte 10 f) (print-patchinfos (car patchinfo-list))))))))) +(defun get-common-and-uncommon (ours theirs) + "Given patchsets OURS and THEIRS, find common and uncommon patches. +OURS and THEIRS are lists of lists of patchinfos, as returned by +`read-repo-patch-list'. Three values are returned: a list of +patchinfos that appear in both sets, a list of patchinfos that +appear only in OURS, and a list of patchinfos that appear only in +THEIRS." + ;; Of course, there are possible optimizations here, in particular + ;; regarding tags, but this will do for now. + (let ((ours-list (apply #'append (reverse ours))) + (theirs-list (apply #'append (reverse theirs)))) + (values (union ours-list theirs-list :test #'equalp) + (set-difference ours-list theirs-list :test #'equalp) + (set-difference theirs-list ours-list :test #'equalp))))
participants (1)
-
mhenoch@common-lisp.net