From b95132e71ec7f862125a414d9b8cee9f97ec3da3 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 23 Jan 2021 09:34:20 -0800 Subject: [PATCH] =?UTF-8?q?Add=20client=20arguments=20for=20=E2=80=98p4=20?= =?UTF-8?q?add=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- p4-lowlevel.el | 12 +++++++----- vc-p4.el | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) 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."