diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index c43b37627fb..fbfbfa52228 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -239,7 +239,14 @@ This function differs from `vc-do-command' in that it invokes `vc-src-program'." (defun vc-src-register (files &optional _comment) "Register FILES under src. COMMENT is ignored." - (vc-src-command nil files "add")) + (let* ((dirs (seq-filter #'file-directory-p files)) + (files (seq-remove #'file-directory-p files))) + ;; SRC doesn't track directories (because RCS doesn't), but we do + ;; need to create the '.src' subdirectory if it doesn't exist. + (dolist (dir dirs) + (make-directory (expand-file-name ".src" dir) t)) + (and files + (vc-src-command nil files "add")))) (defun vc-src-responsible-p (file) "Return the directory if SRC thinks it would be responsible for FILE." @@ -329,7 +336,10 @@ If LIMIT is non-nil, show no more than this many entries." (defun vc-src-rename-file (old new) "Rename file from OLD to NEW using `src mv'." - (vc-src-command nil 0 new "mv" old)) + (if (file-directory-p old) + ;; SRC doesn't track directories. + (rename-file old new) + (vc-do-command "*vc*" 0 vc-src-program (list old new) "mv"))) (provide 'vc-src) diff --git a/test/lisp/vc/vc-tests/vc-tests.el b/test/lisp/vc/vc-tests/vc-tests.el index 1199d94cd03..67589be7314 100644 --- a/test/lisp/vc/vc-tests/vc-tests.el +++ b/test/lisp/vc/vc-tests/vc-tests.el @@ -592,8 +592,8 @@ This checks also `vc-backend' and `vc-responsible-backend'." 'added)))) ;; Test OK-IF-ALREADY-EXISTS. - ;; RCS doesn't support `vc-delete-file'. - (unless (eq backend 'RCS) + ;; RCS and SRC don't support `vc-delete-file'. + (unless (memq backend '(RCS SRC)) (let ((tmp-name (expand-file-name "qux" default-directory)) (new-name (expand-file-name "quuux" default-directory))) (write-region "qux" nil tmp-name nil 'nomessage) @@ -1261,7 +1261,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." (format "vc-test-%s01-register" backend-string)))))) ;; `vc-mtn.el' gives me: ;; "Failed (status 1): mtn commit -m Testing vc-version-diff\n\n foo" - (skip-when (memq ',backend '(Mtn))) + (skip-when (memq ',backend '(Mtn SRC))) ;; `vc-hg.el' gives me, only on MS-Windows and only in batch mode: ;; "Failed (status 255): hg --config ui.report_untrusted=0 commit -m Testing vc-version-diff\n\n foo" (skip-when (and (memq ',backend '(Hg))