Add ‘vc-p4-rename’

In Perforce renaming and deleting and creating files are different things. In
the latter situation any history is lost.
This commit is contained in:
Tom Willemse 2021-02-24 22:17:00 -08:00
parent f3423ce275
commit 48237437e8
2 changed files with 21 additions and 0 deletions

View file

@ -820,4 +820,21 @@ current ticket is displayed (if there is one) instead."
(p4-not-logged-in-error
(unless status (signal (car err) (cdr err)))))))
(cl-defun p4-lowlevel-rename (from-file to-file &key changelist preview server-only)
"Call p4 move -r with arguments.
FROM-FILE is the source file. TO-FILE is the destination.
CHANGELIST specifies which changelist the operation should be
added to. If PREVIEW is specified, dont actually do the
operation. If SERVER-ONLY is specified it means to do the move
only on the server and not touch the local files."
(let* ((changelist-args (and changelist `("-c" ,changelist)))
(preview-args (and preview '("-n")))
(server-only-args (and server-only '("-k")))
(args (append '("move" "-r")
changelist-args
preview-args
server-only-args
(list from-file to-file))))
(p4-lowlevel-command-or-error args)))
(provide 'p4-lowlevel)

View file

@ -1057,4 +1057,8 @@ The difference to vc-do-command is that this function always invokes `p4'."
(propertize (alist-get "Server address" extra-info nil nil #'string=)
'face 'font-lock-variable-name-face))))
(defun vc-p4-rename (old new)
"Rename OLD to NEW in Perforce."
(p4-lowlevel-rename old new))
(provide 'vc-p4)