diff --git a/p4-lowlevel.el b/p4-lowlevel.el index 74d46b0..f82b986 100644 --- a/p4-lowlevel.el +++ b/p4-lowlevel.el @@ -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, don’t 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) diff --git a/vc-p4.el b/vc-p4.el index 8ee0a59..632856c 100644 --- a/vc-p4.el +++ b/vc-p4.el @@ -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)