Fix vc-tests for SRC

* lisp/vc/vc-src.el (vc-src-register): Support "registering"
directories in FILES.
(vc-src-rename-file): Fix implementation and support renaming
directories.

* test/lisp/vc/vc-tests/vc-tests.el (vc-test--rename-file)
(vc-test-src-version-diff): Skip parts that don't work with SRC.
(Bug#80862)
This commit is contained in:
Eli Zaretskii 2026-04-27 15:41:27 +03:00
parent f293becdd6
commit 8d4c47c880
2 changed files with 15 additions and 5 deletions

View file

@ -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)

View file

@ -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))