Add client arguments for ‘p4 add’

This commit is contained in:
Tom Willemse 2021-01-23 09:34:20 -08:00
parent 5bc33dcc44
commit b95132e71e
2 changed files with 8 additions and 6 deletions

View file

@ -374,13 +374,15 @@ commands."
;; Do NOT need to support "-t". ;; Do NOT need to support "-t".
;; Do NOT need to support the specification of multiple files. ;; Do NOT need to support the specification of multiple files.
(defun p4-lowlevel-add (file) (cl-defun p4-lowlevel-add (file &key client)
"Tell Perforce to add FILE to the repository. "Tell Perforce to add FILE to the repository.
Returns nil or raises an error on failure." Returns nil or raises an error on failure."
(let* ((client-args (if client (list "-c" client)))
(args (append client-args (list "add" file))))
;; Note that because "p4 -s add" has bugs, at least as of p4 99.2, this won't ;; Note that because "p4 -s add" has bugs, at least as of p4 99.2, this won't
;; necessarily detect when the add fails, e.g., because of an attempt to add a ;; necessarily detect when the add fails, e.g., because of an attempt to add a
;; file which already exists in the repository. ;; file which already exists in the repository.
(p4-lowlevel-command-or-error (list "add" file))) (p4-lowlevel-command-or-error args)))
(defun p4-lowlevel-delete (file) (defun p4-lowlevel-delete (file)
"Tell Perforce to delet FILE from the repository. "Tell Perforce to delet FILE from the repository.

View file

@ -271,7 +271,7 @@ special case of a Perforce file that is added but not yet committed."
(p4-lowlevel-revert file :client vc-p4-client)) (p4-lowlevel-revert file :client vc-p4-client))
(p4-lowlevel-edit file :client vc-p4-client)) (p4-lowlevel-edit file :client vc-p4-client))
(error "File %s already opened for delete." file)) (error "File %s already opened for delete." file))
(p4-lowlevel-add file)))) (p4-lowlevel-add file :client vc-p4-client))))
(defun vc-p4-init-revision () (defun vc-p4-init-revision ()
"Returns `1', the default initial version for Perforce files." "Returns `1', the default initial version for Perforce files."