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:
parent
f3423ce275
commit
48237437e8
2 changed files with 21 additions and 0 deletions
|
@ -820,4 +820,21 @@ current ticket is displayed (if there is one) instead."
|
||||||
(p4-not-logged-in-error
|
(p4-not-logged-in-error
|
||||||
(unless status (signal (car err) (cdr err)))))))
|
(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)
|
(provide 'p4-lowlevel)
|
||||||
|
|
4
vc-p4.el
4
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=)
|
(propertize (alist-get "Server address" extra-info nil nil #'string=)
|
||||||
'face 'font-lock-variable-name-face))))
|
'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)
|
(provide 'vc-p4)
|
||||||
|
|
Loading…
Reference in a new issue