* 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.
* 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--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-hg.el (vc-hg--checkin): New function to do the work
of vc-hg-checkin and vc-hg-checkin-patch.
(vc-hg-checkin): Replace body with call to vc-hg--checkin.
(vc-hg-checkin-patch): Likewise. As compared with the old
implementation, this change (i) fixes encoding issues when
checking in patches on MS-Windows; and (ii) when
vc-async-checkin is non-nil, runs 'hg import' asynchronously
instead of running 'hg update' asynchronously (bug#79235).
* lisp/vc/vc-hg.el (vc-hg-checkin-patch): Use
make-nearby-temp-file. Protect the async process with
vc-wait-for-process-before-save. Don't call vc-checkin-hook
here, instead return a (async . #<process>) list so that
vc-finish-logentry does it.
* 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.
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-hg.el (vc-hg-incoming-revision): Pull the incoming
revision if we don't have it.
(vc-hg-mergebase): Don't invoke 'hg pull'.
* lisp/vc/vc.el: Document that the incoming-revision backend
function, for distributed VCS, should fetch the incoming
revision into local storage.
* lisp/vc/vc-hg.el (vc-hg-print-log): Implement string LIMIT for
this backend. Use a DAG range when 'vc-log-view-type' is
'log-outgoing'. Document differences between -rN:M and -rN::M.
(vc-hg-log-view-mode): Treat 'log-incoming' and 'log-outgoing'
values for 'vc-log-view-type' as short logs too.
(vc-hg-log-incoming, vc-hg-log-outgoing): Delete.
* lisp/vc/vc-hg.el (vc-hg-mergebase): If the first attempt
fails, execute a pull, then try again.
(vc-hg-incoming-revision): Use 'hg identify' not 'hg incoming'.
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.
* lisp/vc/vc-git.el (vc-git-revert-files):
* lisp/vc/vc-hg.el (vc-hg-revert-files):
* lisp/vc/vc.el (vc-revert-files): New functions.
(vc-revert-files): Incorporate vc-revert's calls to message here
so that the messages are displayed more consistently.
(vc-next-action, vc-default-checkin-patch, vc-revert): Use
vc-revert-files instead of vc-revert-file.
* lisp/vc/vc-git.el (vc-git-checkin):
* lisp/vc/vc-hg.el (vc-hg-checkin, vc-hg-checkin-patch): Run
vc-checkin-hook using vc-run-delayed.
* lisp/vc/vc.el (vc-checkin): Don't pass vc-checkin-hook to
vc-start-logentry when doing an async checkin. That runs the
hook too early.
* lisp/vc/vc.el: New incoming-revision backend action (bug#62940).
* lisp/vc/vc-git.el (vc-git--fetch-incoming): New function,
factored out of vc-git-log-incoming.
(vc-git-log-incoming): Use it.
(vc-git-incoming-revision):
* lisp/vc/vc-hg.el (vc-hg-incoming-revision): New functions.
* lisp/vc/vc.el (vc-async-checkin): New option.
(vc-checkin): Don't use with-vc-properties on or display
messages around asynchronous checkins.
* lisp/vc/vc-git.el (vc-git-checkin):
* lisp/vc/vc-hg.el (vc-hg-checkin, vc-hg-checkin-patch): Perform
an async checkin operation when vc-async-checkin is non-nil.
* doc/emacs/vc1-xtra.texi (General VC Options):
* etc/NEWS: Document the new option.
* lisp/vc/vc-dispatcher.el (vc-wait-for-process-before-save):
New function.
(vc-set-async-update): If the current buffer visits a file, call
vc-refresh-state.
* lisp/vc/vc-hg.el (vc-wait-for-process-before-save): Autoload.
(vc-hg--async-command, vc-hg--async-buffer, vc-hg--command-1):
New utilities, partially factored out of vc-hg-command.
(vc-hg-merge-branch): Use vc-hg--async-command, thereby newly
respecting vc-hg-global-switches.
This fixes Bug#3860.
* lisp/vc/vc.el (vc-resolve-conflicts): New user option.
* lisp/vc/vc-bzr.el (vc-bzr-resolve-conflicts): New user option.
(vc-bzr-find-file-hook): Use it.
* lisp/vc/vc-hg.el (vc-hg-resolve-conflicts): New user option.
(vc-hg-find-file-hook): Use it.
* lisp/vc/vc-svn.el (vc-svn-resolve-conflicts): New user option.
(vc-svn-find-file-hook): Use it.
* lisp/vc/vc-git.el (vc-git-resolve-conflicts): Support
'default' as an option. Adjust docstring and version.
(vc-git-find-file-hook): Respect vc-resolve-conflicts.
* etc/NEWS: Announce the new options.