diff --git a/p4-lowlevel.el b/p4-lowlevel.el index e5f1e51..596539d 100644 --- a/p4-lowlevel.el +++ b/p4-lowlevel.el @@ -398,7 +398,7 @@ Returns nil or raises an error on failure." ;; DO need to support "-i". ;; DO need to support specified changelist #'s. -(defun p4-lowlevel-change (&optional buffer op) +(cl-defun p4-lowlevel-change (&key buffer op client) "Creates or edits a P4 changelist from/to BUFFER. If optional OP is a number, then the corresponding changelist is retrieved into BUFFER, or into a new buffer if BUFFER is nil. If OP @@ -410,7 +410,8 @@ buffer is returned." (let* ((input-buffer (if (and op (not (numberp op))) buffer nil)) (flag-arg (if (or (not op) (numberp op)) "-o" "-i")) (number-arg (if (numberp op) (list (number-to-string op)))) - (args (append (list "change" flag-arg) number-arg)) + (client-args (if client (list "-c" client))) + (args (append client-args (list "change" flag-arg) number-arg)) alist info) (setq alist (p4-lowlevel-command-or-error args input-buffer nil)) (setq info (p4-lowlevel-info-lines alist)) @@ -684,9 +685,11 @@ resolve. Raises an error if the command fails." ;; Only need to support non-interactive use; therefore, only need to ;; support "p4 submit -i". -(defun p4-lowlevel-submit (change-spec) +(cl-defun p4-lowlevel-submit (change-spec &key client) "Calls `p4 submit' on CHANGE-SPEC, which should be a string or buffer." - (let (buffer) + (let* ((client-args (if client (list "-c" client))) + (args (append client-args (list "submit" "-i"))) + buffer) (if (bufferp change-spec) (setq buffer change-spec) (setq buffer (p4-lowlevel-get-buffer-create @@ -695,7 +698,7 @@ resolve. Raises an error if the command fails." (set-buffer buffer) (erase-buffer) (insert change-spec))) - (p4-lowlevel-command-or-error (list "submit" "-i") buffer))) + (p4-lowlevel-command-or-error args buffer))) ;; Here's what we need to support from the "p4 sync" command, at least for the ;; time being: diff --git a/vc-p4.el b/vc-p4.el index 6fe9c8f..803b85c 100644 --- a/vc-p4.el +++ b/vc-p4.el @@ -303,7 +303,7 @@ comment COMMENT." (error "Can't specify revision for Perforce checkin.")) (let* (;; XXX: default-directory? this should work for most (all?) cases (default-directory (file-name-directory (car files))) - (change-buffer (p4-lowlevel-change)) + (change-buffer (p4-lowlevel-change :client vc-p4-client)) (indent-tabs-mode 1) insertion-start change-number) (dolist (file files) @@ -321,9 +321,15 @@ comment COMMENT." (delete-region (point) (point-max)) (dolist (file files) (insert "\t" (vc-file-getprop file 'vc-p4-depot-file) "\n")) - (setq change-number (p4-lowlevel-change (current-buffer) t)) - (p4-lowlevel-change (current-buffer) change-number) - (p4-lowlevel-submit (current-buffer)) + (setq change-number (p4-lowlevel-change + :buffer (current-buffer) + :op t + :client vc-p4-client)) + (p4-lowlevel-change + :buffer (current-buffer) + :op change-number + :client vc-p4-client) + (p4-lowlevel-submit (current-buffer) :client vc-p4-client) ; Update its properties (dolist (file files) (vc-p4-state file nil t)))))