* lisp/vc/vc-git.el (vc-git--file-list-is-rootdir):
Merge into vc-git-command.
(vc-git-command): When operating on the repository root, first
bind default-directory to that root. When operating on the
repository root with 'git checkout', pass "." as FILE-OR-LIST.
* lisp/vc/vc-git.el (vc-git--assert-revision-on-branch): New
function, factored out.
(vc-git-revision-published-p): Use it.
(vc-git-delete-revision):
* lisp/vc/vc-hg.el (vc-hg-delete-revision): New functions.
* lisp/vc/vc.el: Specify delete-revision backend API function
(bug#79408).
* lisp/vc/vc-git.el (vc-git-revision-published-p): New function.
(vc-git--assert-allowed-rewrite): Use it.
* lisp/vc/vc-hg.el (vc-hg-revision-published-p): New function.
* lisp/vc/vc.el: Specify revision-published-p backend API
function (bug#79408).
Using an empty string to mean the location from which vc-update
would pull was inherited from the old incoming/outgoing
functions, but we have opportunity to simplify things for this
new one.
* lisp/vc/vc-bzr.el (vc-bzr-incoming-revision):
* lisp/vc/vc-git.el (vc-git-incoming-revision):
* lisp/vc/vc-hg.el (vc-hg-incoming-revision):
* lisp/vc/vc.el (vc-diff-incoming, vc-diff-outgoing)
(vc-diff-outgoing-base, vc--incoming-revision): Make
UPSTREAM-LOCATION parameter optional. Use nil, rather than an
empty string, to mean the default.
* lisp/vc/vc-hg.el (vc-hg-diff): When OLDVERS is ".", behave the
same as if OLDVERS was the actual working revision.
(vc-hg-previous-revision): Return ".~1" for input ".", ".~3" for
input ".^^" et cetera.
Also, when passed non-symbolic revisions, use "REV~1" instead of
"REV^" for MS-Windows compatibility.
(vc-hg-working-revision-symbol):
* lisp/vc/vc-git.el (vc-git-working-revision-symbol):
* lisp/vc/vc-hooks.el (vc-symbolic-working-revision): New
functions.
(vc-default-mode-line-string):
* lisp/vc/ediff-vers.el (ediff-vc-merge-internal):
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--checkin-patch):
* lisp/vc/vc.el (vc-diff-build-argument-list-internal)
(vc-diff-outgoing, vc-revision-other-window, vc-default-revert):
Call vc-symbolic-working-revision.
(vc-buffer-revision): Specify that this should always be a
revision number/hash, not a symbolic name.
* lisp/vc/vc-git.el (vc-git-previous-revision): Return "HEAD~1"
for input "HEAD", "HEAD~3" for input "HEAD^^" et cetera.
* lisp/vc/vc.el (prepare-patch): Specify :patch-start and
:patch-end plist entries.
* lisp/vc/vc-git.el (vc-git-prepare-patch): Use -n1 to avoid
passing a revision range to git-format-patch, which is a bit
simpler. Catch search-failed errors and signal an error with a
more helpful message. Properly handle Subject: header by
looking for continuation lines. Return :patch-start and
:patch-end entries in the plist.
* lisp/vc/vc-hg.el (vc-hg-prepare-patch): Always pass --git to
'hg export' for consistency. Catch search-failed errors and
signal an error with a more helpful message. Return a
:patch-start entry in the plist.
This is expected to happen in some cases.
* lisp/vc/vc-git.el (vc-git--with-apply-temp): New OKSTATUS
parameter.
(vc-git--checkin): Use it to ignore 'git apply --3way' exiting
1.
* lisp/vc/vc-git.el
(vc-git--with-apply-temp-to-staging): Rename ...
(vc-git--with-apply-temp): ... to this. New ARGS parameter.
All uses changes.
(vc-git--checkin): In POST function, apply PATCH-STRING to the
working tree with 'git apply --3way --ours'.
* lisp/vc/vc-hg.el (vc-hg--checkin): Document what the call to
'hg update' is for.
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--checkin-patch):
Delete completed FIXME and workaround.
* lisp/vc/vc-git.el (vc-git--checkin): Restore dropping stash of
staged changes after applying it. This was accidentally lost
when factoring out vc-git--with-apply-temp-to-staging.
* lisp/vc/vc-git.el (vc-git--mailinfo): New function.
(vc-git-checkin-patch): Use it to extract authorship, date and
log message information from patches.
(vc-git--call): New INFILE argument. All uses changed.
* lisp/vc/vc-hg.el (vc-hg--checkin): When COMMENT is nil, take
authorship, date and log message information from the patch.
* lisp/vc/vc.el (checkin-patch): Specify to use authorship, date
and comment information in PATCH-STRING (bug#79408).
(prepare-patch): Specify that patch should include authorship
identity, date and log message information for REV if supported.
(diff-bounds-of-hunk): Declare.
(vc-default-checkin-patch): Warn if it looks like we will ignore
patch authorship information.
* test/lisp/vc/vc-tests/vc-tests.el (vc-hg-command)
(vc-git--out-str): Declare.
(vc-test--checkin-patch): New function.
(vc-test-git08-checkin-patch, vc-test-hg08-checkin-patch): New
tests.
* lisp/vc/vc-bzr.el (vc-bzr-incoming-revision):
* lisp/vc/vc-hg.el (vc-hg-incoming-revision):
* lisp/vc/vc.el (vc-diff-incoming, vc--incoming-revision): New
REFRESH optional argument.
(vc-default-log-incoming): Pass it.
* lisp/vc/vc-git.el (vc-git-incoming-revision): New REFRESH
optional argument. When nil, use cached info (bug#62940).
* lisp/vc/vc-git.el (vc-git-modify-change-comment): Bind
coding-system-for-write to locale-coding-system around the call
to vc-git-command on MS-Windows. The temporary file name could
contain non-ASCII, e.g. the user's username.
* lisp/vc/vc-git.el (vc-git-delete-working-tree): Reimplement to
avoid requiring 'git worktree remove'.
(vc-git-move-working-tree): Use 'git worktree move' if 'git
worktree repair' is not available. Give a more informative
error message if we don't even have that.
* test/lisp/vc/vc-tests/vc-tests.el (vc-git--program-version):
Declare.
(vc-test--other-working-trees): Skip vc-move-working-tree tests
with Git old enough to lack 'git worktree move'.
* lisp/vc/vc-git.el (vc-git-known-other-working-trees):
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--other-working-trees):
Tolerate directories with symlinks in them, such as the standard
temporary dirs on MacOS. 'git worktree list' outputs expanded names.
* lisp/vc/vc-git.el (vc-git--read-start-point): New function,
factored out of vc-git-create-tag.
(vc-git-create-tag): Use it.
(vc-git--worktrees, vc-git-known-other-working-trees)
(vc-git-add-working-tree, vc-git-delete-working-tree)
(vc-git-move-working-tree):
* lisp/vc/vc-hg.el (vc-hg-known-other-working-trees)
(vc-hg-add-working-tree, vc-hg--shared-p)
(vc-hg-delete-working-tree, vc-hg-move-working-tree): New
functions.
* lisp/vc/vc.el: Define API for known-other-working-tree,
add-working-tree, delete-working-tree and move-working-tree
backend functions.
(vc-dir-status-files): New function.
(project-current-directory-override): Declare.
(dired-rename-subdir): Autoload.
(vc-add-working-tree, vc-switch-working-tree)
(vc-delete-working-tree, vc-move-working-tree): New commands.
* lisp/vc/vc-hooks.el (vc-prefix-map): Bind them under C-x v.
* doc/emacs/vc1-xtra.texi (Other Working Trees): New node.
* etc/NEWS: Announce the new commands.
* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--other-working-trees): New function.
(vc-test-git07-other-working-trees)
(vc-test-hg07-other-working-trees): New tests.
* lisp/ldefs-boot.el: Regenerate.
* lisp/vc/vc-git.el (vc-git--empty-tree): New constant.
(vc-git-diff): When REV1 and REV2 are both nil and there are no
commits yet, diff against the empty tree object (bug#78987).
Running vc-checkin-hook needs to be delayed in the case of an
async checkin. As a quick fix we had been relying on the
backend checkin functions to run the hook in the async case.
This restores handling running the hook in generic code even for
the async case.
* lisp/vc/vc.el (vc-checkin): Always pass vc-checkin-hook to
vc-start-logentry. Return the result of calling the backend
'checkin-patch' or 'checkin' function to vc-finish-logentry.
* lisp/vc/vc-dispatcher.el (vc-finish-logentry): If the log
operation returns a cons of the form (async . #<process ...>),
use vc-exec-after to delay vc-resynch-buffer and hooks until the
async process completes. Approach suggested by Dmitry Gutov.
* lisp/vc/vc-git.el (vc-git-checkin):
* lisp/vc/vc-hg.el (vc-hg-checkin): For an async checkin, return
a cons (async . #<process ...>) containing the async checkin
process. No longer run vc-checkin-hook.
* lisp/vc/vc.el (with-vc-properties): Return the result of
evaluating FORM.
* lisp/vc/vc-dispatcher.el (vc-exec-after): Change to PROC's
buffer before calling vc-set-mode-line-busy-indicator.
* lisp/vc/vc-git.el (vc-git-print-log): When LIMIT and
START-REVISION are both supplied, use START-REVISION as the
newest commit, and LIMIT as a base (problem was introduced in
the commit adding 'vc-diff-mergebase' and 'vc-log-mergebase').
* lisp/vc/vc.el (vc-default-log-incoming)
(vc-default-log-outgoing): Fix order of START-REVISION and LIMIT
arguments passed to 'print-log' backend function.
(vc-log-mergebase): Fix order of START-REVISION and LIMIT
arguments passed to 'vc-print-log-internal'.
Centralize the control for whether 'vc-diff' is asynchronous
across the backends, while also allowing 'vc-BACKEND-diff' to be
called asynchronously when needed. Previously in bug#21969.
* lisp/vc/vc.el (vc-allow-async-diff): New user option.
* lisp/vc/vc.el (vc-version-diff, vc-diff, vc-diff-mergebase)
(vc-root-diff): Obey it.
* lisp/vc/log-view.el (log-view-diff-common): Same.
* lisp/vc/vc-annotate.el
(vc-annotate-show-diff-revision-at-line-internal): Same.
* lisp/vc/vc-git.el (vc-git-diff): Follow the ASYNC argument.
* lisp/vc/vc-hg.el (vc-hg-diff): Same.
* lisp/vc/vc-rcs.el (vc-rcs-diff): Same.