
Author: mhenoch Date: Tue Jan 8 13:04:02 2008 New Revision: 150 Modified: cl-darcs/trunk/diff.lisp Log: Signal an error when adding a file or directory that already exists Modified: cl-darcs/trunk/diff.lisp ============================================================================== --- cl-darcs/trunk/diff.lisp (original) +++ cl-darcs/trunk/diff.lisp Tue Jan 8 13:04:02 2008 @@ -1,4 +1,4 @@ -;;; Copyright (C) 2006, 2007 Magnus Henoch +;;; Copyright (C) 2006, 2007, 2008 Magnus Henoch ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -157,7 +157,10 @@ (typecase p (add-file-patch (let ((pathname-string (pathname-to-string (patch-filename p))) + (old-file (merge-pathnames (patch-filename p) pristine)) (new-file (merge-pathnames (patch-filename p) repo))) + (when (fad:file-exists-p old-file) + (error "Pending add of file ~A, but it already exists in the repository." pathname-string)) (setf patches (nconc patches (list* p @@ -165,6 +168,10 @@ (diff-binary-file nil new-file :filename pathname-string) (diff-file nil new-file :filename pathname-string))))))) (add-dir-patch + (let ((pathname-string (pathname-to-string (patch-directory p))) + (old-dir (merge-pathnames (patch-directory p) pristine))) + (when (fad:directory-exists-p old-dir) + (error "Pending add of directory ~A, but it already exists in the repository." pathname-string))) (setf patches (nconc patches (list p)))) (t (push p pruned-pending))))