diff --git a/p4-lowlevel.el b/p4-lowlevel.el index cf5f4c8..86b5ae2 100644 --- a/p4-lowlevel.el +++ b/p4-lowlevel.el @@ -374,13 +374,15 @@ commands." ;; Do NOT need to support "-t". ;; 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. Returns nil or raises an error on failure." - ;; 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 - ;; file which already exists in the repository. - (p4-lowlevel-command-or-error (list "add" file))) + (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 + ;; necessarily detect when the add fails, e.g., because of an attempt to add a + ;; file which already exists in the repository. + (p4-lowlevel-command-or-error args))) (defun p4-lowlevel-delete (file) "Tell Perforce to delet FILE from the repository. diff --git a/vc-p4.el b/vc-p4.el index 73e17e9..1a6759c 100644 --- a/vc-p4.el +++ b/vc-p4.el @@ -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-edit file :client vc-p4-client)) (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 () "Returns `1', the default initial version for Perforce files."