Compare commits

..

3 commits

Author SHA1 Message Date
0637cddd58 fix: vc-p4 doesn't recognize a file in its client because of case
When checking to see if a file is within a Perforce client, match the root
directory and current directory as reported by Perforce and ignore case
differences.

Sometimes (at least on Windows) the current directory and the client root can
point at the same directory, but because of the way Perforce creates directories
and files the case might differ.
2023-04-03 22:57:23 -07:00
43c4b8fa56 fix: ‘vc-ediff’ thinks everything in all files has changed
Calling ‘p4-lowlevel-command-or-error’ on a buffer will output the raw response
from Perforce, which includes tags like ‘text:’ and ‘exit:’ at the start of each
line. These tags are used by the low-level functions to find the right data and
figure out if the given command succeeded or not.

Using ‘p4-lowlevel-command-into-buffer’ should have the desired behaviour of
cutting out all the tags and showing only the actual contents of the response.
This will make sure that the “other” buffer doesn't display all lines have
changed because suddenly each line starts with a tag.
2023-04-03 22:53:23 -07:00
dd6e57b1e5 refactor: Simplify ‘p4-lowlevel-command-into-buffer’ 2023-04-03 22:53:02 -07:00
2 changed files with 4 additions and 5 deletions

View file

@ -352,9 +352,8 @@ that buffer. Returns the buffer."
(defun p4-lowlevel-command-messages () (defun p4-lowlevel-command-messages ()
"Return t if vc-command-messages bound and true. "Return t if vc-command-messages bound and true.
Fall back to the value of p4-lowlevel-command-messages." Fall back to the value of p4-lowlevel-command-messages."
(if (and (boundp 'vc-command-messages) vc-command-messages) (or (bound-and-true-p vc-command-messages)
t p4-lowlevel-command-messages))
p4-lowlevel-command-messages))
(defun p4-lowlevel-canonicalize-revision (rev) (defun p4-lowlevel-canonicalize-revision (rev)
"Turn REV into a form which can be concatenated to file names in P4 commands." "Turn REV into a form which can be concatenated to file names in P4 commands."
@ -627,7 +626,7 @@ then the `-q' flag is passed to `p4 print'."
(let* ((fullfile (if rev (concat file rev) file)) (let* ((fullfile (if rev (concat file rev) file))
(quiet-args (if quiet (list "-q"))) (quiet-args (if quiet (list "-q")))
(args (append (list "print") quiet-args (list fullfile)))) (args (append (list "print") quiet-args (list fullfile))))
(p4-lowlevel-command-or-error args nil output-format))) (p4-lowlevel-command-into-buffer args output-format)))
;; Here's what we need to support from the "p4 reopen" command, at least for the ;; Here's what we need to support from the "p4 reopen" command, at least for the
;; time being: ;; time being:

View file

@ -930,7 +930,7 @@ If DIRNAME is not specified, uses `default-directory'."
(info (p4-lowlevel-info)) (info (p4-lowlevel-info))
(root (alist-get "Client root" info nil nil #'string=)) (root (alist-get "Client root" info nil nil #'string=))
(cwd (alist-get "Current directory" info nil nil #'string=))) (cwd (alist-get "Current directory" info nil nil #'string=)))
(string-prefix-p root cwd))) (string-prefix-p root cwd t)))
(defun vc-p4-has-unresolved-conflicts-p (file) (defun vc-p4-has-unresolved-conflicts-p (file)
"Search through FILE's buffer for unresolved P4 conflicts. "Search through FILE's buffer for unresolved P4 conflicts.