Make checking out files with a client work
This commit is contained in:
parent
2b270a93f0
commit
a60278efa7
2 changed files with 14 additions and 8 deletions
|
@ -524,10 +524,12 @@ optional BUFFER is non-nil, output goes in that buffer. Uses
|
|||
;; Do NOT need to support "-t".
|
||||
;; Do NOT need to support the specification of multiple files.
|
||||
|
||||
(defun p4-lowlevel-edit (file)
|
||||
(cl-defun p4-lowlevel-edit (file &key client)
|
||||
"Tell Perforce we want to edit FILE.
|
||||
Returns non-nil on success or nil on failure (or raises an error)."
|
||||
(p4-lowlevel-command-or-error (list "edit" file)))
|
||||
(let* ((client-args (if client (list "-c" client)))
|
||||
(args (append client-args (list "edit" file))))
|
||||
(p4-lowlevel-command-or-error args)))
|
||||
|
||||
;; Here's what we need to support from the "p4 filelog" command, at least for
|
||||
;; the time being:
|
||||
|
@ -696,14 +698,15 @@ resolve. Raises an error if the command fails."
|
|||
;; DO need to support the specification of a file revision.
|
||||
;; Do NOT need to support the specification of multiple files.
|
||||
|
||||
(defun p4-lowlevel-sync (file &optional rev force)
|
||||
(cl-defun p4-lowlevel-sync (file &key rev force client)
|
||||
"Call `p4 sync' for FILE.
|
||||
If optional REV is specified, use that revision specifier. If
|
||||
optional FORCE is non-nil, pass the `-f' flag."
|
||||
(setq rev (p4-lowlevel-canonicalize-revision rev))
|
||||
(let* ((fullfile (if rev (concat file rev) file))
|
||||
(force-args (if force (list "-f")))
|
||||
(args (append (list "sync") force-args (list fullfile))))
|
||||
(client-args (if client (list "-c" client)))
|
||||
(args (append client-args (list "sync") force-args (list fullfile))))
|
||||
(p4-lowlevel-command-or-error args)))
|
||||
|
||||
(defun p4-lowlevel-integrate (from-file to-file &optional rev1 rev2 force)
|
||||
|
|
11
vc-p4.el
11
vc-p4.el
|
@ -269,7 +269,7 @@ special case of a Perforce file that is added but not yet committed."
|
|||
(delete-file file)
|
||||
(rename-file tempfile file))
|
||||
(p4-lowlevel-revert file :client vc-p4-client))
|
||||
(p4-lowlevel-edit file))
|
||||
(p4-lowlevel-edit file :client vc-p4-client))
|
||||
(error "File %s already opened for delete." file))
|
||||
(p4-lowlevel-add file))))
|
||||
|
||||
|
@ -337,8 +337,8 @@ comment COMMENT."
|
|||
(eq rev t))
|
||||
(setq rev (vc-file-getprop file 'vc-latest-version))))
|
||||
(if (not (string= rev (vc-file-getprop file 'vc-workfile-version)))
|
||||
(p4-lowlevel-sync file rev))
|
||||
(p4-lowlevel-edit file))
|
||||
(p4-lowlevel-sync file :rev rev :client vc-p4-client))
|
||||
(p4-lowlevel-edit file :client vc-p4-client))
|
||||
(vc-p4-state file nil t))
|
||||
|
||||
(defun vc-p4-revert (file contents-done)
|
||||
|
@ -348,7 +348,10 @@ comment COMMENT."
|
|||
((null action)
|
||||
;; If Perforce doesn't believe that we edited the file, we have
|
||||
;; to use sync instead of revert.
|
||||
(p4-lowlevel-sync file (vc-workfile-version file) t))
|
||||
(p4-lowlevel-sync file
|
||||
:rev (vc-workfile-version file)
|
||||
:force t
|
||||
:client vc-p4-client))
|
||||
(t
|
||||
(p4-lowlevel-revert file :client vc-p4-client)))
|
||||
(if (string= action "add")
|
||||
|
|
Loading…
Reference in a new issue