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.
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.
When the command gets an error response it still returns 0 if there is output.
With this flag it'll still return a non-zero status code even when it outputs
text, assuming that the server responds with something of 400 or higher.
If ‘p4-vc-rename-file’ is used and the file that's been renamed is open in a
buffer, change that buffer's visited file name so that when you switch to it and
start editing it, it doesn't save to the original file and your modifications
will have to be moved over.
According to the documentation of ‘goto-line’, it's usually not what you want
for a lisp program. It's not entirely clear why, but I suspect it has something
to do with either hooks run, or some effect it'll have on state.
This commit replaces it with the suggested
(goto-char (point-min))
(forward-line (-1 N))
Where N is the argument previously given to ‘goto-line’.
It seems like it might be possible that this function gets called in the wrong
directory, so just to be sure set the current directory to the one passed in.
This _should_ make sure that ‘p4’ is called in the right directory.
As far as I can tell there is no ‘vc-workfile-version’ function anywhere. There
is a property with that name set on files by vc-p4, but it seems that the
function we’re looking for is actually ‘vc-working-revision’.
I use the ‘org-indent-mode’ now to view org-mode files, which means that
formatting looks even better without having to maintain much along the lines of
indentation.
When I wrote this feature I didn’t realize that this functionality is already
built into Perforce itself. By using the ‘P4CONFIG’ variable you can specify the
name of a file that ‘p4’ will look for that can specify the client (among
others) for that directory and all subdirectories.
It seems that nothing uses ‘vc-p4-find-version’, or ‘vc-find-version’, and it’s
not mentioned as a function to implement in vc.el. There is a ‘find-revision’
mentioned with the same signature though.
VC Expects the backend to report that the status is ‘needs-update’, not
‘needs-patch’. I don’t know if this has changed over the years, but this is what
it needs now.
- The arguments ‘comment’ and ‘rev’ have been switched. I don’t know if this
used to be different from how it is now, but ‘rev’ comes last now and is
optional.
- The ‘vc-p4-client’ needs to be collected from the first file in the list of
files to check in because ‘vc-p4-checkin’ is called from a different buffer
that isn’t in the same directory.
- ‘vc-p4-client’ also needs to be stored under a different name so that when it
changes to the ‘*p4-lowlevel-changes*’ buffer it doesn’t clear the value.
- Instead of inserting the specified comment directly, send it through
‘log-edit-extract-headers’ which removes the "Summary: " header that
‘vc-log-edit’ adds.
- Indent rigidly to ‘tab-width’ instead of 8. Indenting to 8 added too many tabs
to the description and caused all lines to be prefixed by a tab.
- Add command ‘vc-p4-logged-in-p’ to check if the user is currently logged in.
- Add command ‘vc-p4-login’ to log in if the user isn’t already logged in.
- Add better error reporting for the situation where a user isn’t logged in.
Quoting the string with Windows paths in it would double-quote the directory
separators. It also seems easier to use ‘string-prefix-p’ than an anchored
regular expression.
‘alist-get’ is a function that was introduced in Emacs 25 that is easier to use
than ‘assoc’ + ‘cdr’.