1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00
Commit graph

438 commits

Author SHA1 Message Date
Sean Whitton
ed87a95a78 Query-on-exit for VC push, pull and async checkin commands
* lisp/vc/vc-bzr.el (vc-bzr--pushpull):
* lisp/vc/vc-git.el (vc-git--checkin, vc-git--pushpull):
* lisp/vc/vc-hg.el (vc-hg--checkin, vc-hg--pushpull): Set
query-on-exit flag for async processes.
2025-12-03 16:09:52 +00:00
Sean Whitton
917f5e25de Fix vc-git-uncommit-revisions-from-end
* lisp/vc/vc-git.el (vc-git-uncommit-revisions-from-end): Don't
leave changes staged.
2025-11-29 14:29:58 +00:00
Sean Whitton
54775983ac vc-git-revision-published-p: Resolve REV
* lisp/vc/vc-git.el (vc-git-revision-published-p): Resolve REV
before using it, using vc-git--rev-parse.
2025-11-22 12:46:16 +00:00
Sean Whitton
0bf1eb692b Fix '(vc-revert-file (vc-git-root)'
* 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.
2025-11-20 20:42:21 +00:00
Sean Whitton
1fd4d3e070 New *-revisions-from-end VC backend API functions (bug#79408)
* lisp/vc/vc-git.el (vc-git-delete-revisions-from-end)
(vc-git-uncommit-revisions-from-end):
* lisp/vc/vc-hg.el (vc-hg--assert-rev-on-current-branch)
(vc-hg--reset-back-to, vc-hg-delete-revisions-from-end)
(vc-hg-uncommit-revisions-from-end): New functions.
* lisp/vc/vc.el: Specify delete-revisions-from-end and
uncommit-revisions-from-end backend API functions (bug#79408).
2025-10-31 18:49:19 +00:00
Sean Whitton
3dc022a023 New delete-revision VC backend API function (bug#79408)
* 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).
2025-10-27 21:12:56 +00:00
Sean Whitton
ab5e64aa95 New revision-published-p VC 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).
2025-10-26 14:35:59 +00:00
Sean Whitton
b5303715cc * lisp/vc/vc-git.el (vc-git-branches): Use 'git for-each-ref'. 2025-10-24 21:17:36 +01:00
Sean Whitton
d0bcbc7ada Make UPSTREAM-LOCATION argument to incoming-revision optional
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.
2025-10-24 20:55:19 +01:00
Sean Whitton
4faebea822 vc-git-registered: Be quieter when Git is not installed
* lisp/vc/vc-git.el (vc-git-registered): If Git is not
installed, don't echo a message about it.
2025-10-19 16:41:11 +01:00
Sean Whitton
d3c4679acd VC: Use symbolic names for the working revision
* 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.
2025-10-05 15:27:07 +01:00
Sean Whitton
4e7cb37b84 VC prepare-patch: New :patch-start & :patch-end plist entries
* 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.
2025-09-27 21:36:51 +01:00
Sean Whitton
6eaa1d279b ; * lisp/vc/vc-git.el (vc-git-cherry-pick-comment): Fix logic. 2025-09-26 17:25:07 +01:00
Sean Whitton
9a86a093bc vc-git--checkin: Ignore 'git apply --3way' exiting 1
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.
2025-09-25 18:19:38 +01:00
Sean Whitton
b2e35d1d2c vc-git--checkin: Avoid passing --ours to git-apply
* lisp/vc/vc-git.el (vc-git--with-apply-temp): New BUFFER param.
(vc-git--checkin): Avoid passing --ours to git-apply.
2025-09-25 17:44:30 +01:00
Sean Whitton
19426ea56c VC: New cherry-pick-comment API function
* lisp/vc/vc-git.el (vc-git-cherry-pick-comment):
* lisp/vc/vc-hg.el (vc-hg-cherry-pick-comment):
* lisp/vc/vc.el (vc-default-cherry-pick-comment):
New functions (bug#79408).
2025-09-24 17:24:41 +01:00
Sean Whitton
8368fcb38c vc-git--checkin: Apply PATCH-STRING to working tree
* 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.
2025-09-24 16:07:51 +01:00
Sean Whitton
190450f4f0 vc-git--checkin: Restore dropping stash of staged changes
* 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.
2025-09-24 15:00:42 +01:00
Sean Whitton
192a0e1773 ; * lisp/vc/vc-git.el (vc-git--checkin): Fix error message. 2025-09-22 17:21:38 +01:00
Sean Whitton
8310795bab VC checkin-patch: Support extracting commit metadata from patches
* 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.
2025-09-21 21:59:02 +01:00
Sean Whitton
0109b4a758 * lisp/vc/vc-git.el (vc-git--checkin): Validate parameters. 2025-09-21 21:44:28 +01:00
Sean Whitton
d3a2541798 Refactor vc-git checkin functions
* lisp/vc/vc-git.el (vc-git-patch-string): Delete.  All uses
changed.
(vc-git--checkin): Rename vc-git-checkin to this.
(vc-git-checkin-patch, vc-git-checkin): New wrapper functions.
2025-09-18 12:48:32 +01:00
Sean Whitton
85b991a62d ; vc-git--log-edit-summary-check: Use and-let*. 2025-09-12 15:32:19 +01:00
Sean Whitton
66ef930ebe Rename arg REMOTE-LOCATION -> UPSTREAM-LOCATION
* lisp/vc/vc-bzr.el (vc-bzr-log-incoming)
(vc-bzr-incoming-revision, vc-bzr-log-outgoing):
* lisp/vc/vc-git.el (vc-git-incoming-revision):
* lisp/vc/vc-hg.el (vc-hg-incoming-revision):
* lisp/vc/vc.el (vc-root-diff-incoming, vc-diff-incoming)
(vc-root-diff-outgoing, vc-diff-outgoing)
(vc-root-diff-outgoing-base, vc-diff-outgoing-base)
(vc-incoming-outgoing-internal, vc-remote-location-history)
(vc--incoming-revision, vc-log-incoming, vc-default-log-incoming)
(vc-log-outgoing, vc-default-log-outgoing): Rename arguments
REMOTE-LOCATION -> UPSTREAM-LOCATION.  Adjust strings.
(vc--maybe-read-remote-location): Rename ...
(vc--maybe-read-upstream-location): ... to this.
2025-09-01 09:41:40 +01:00
Sean Whitton
fa256f11ed VC outgoing commands for Git: Don't unconditionally fetch
* 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).
2025-09-01 09:32:40 +01:00
Sean Whitton
18b87fab35 ; vc-git-command, vc-hg-command: Comments about MS-Windows encoding. 2025-08-16 12:58:22 +01:00
Sean Whitton
fb5e6c6bb7 vc-git-modify-change-comment: Bind c-s-f-w for command arguments too
* 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.
2025-08-14 14:56:07 +01:00
Sean Whitton
66eead6fd0 Fix some 'git worktree' compatibility issues
* 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'.
2025-08-10 13:25:41 +01:00
Michael Albinus
1fc4bb1fea Rename variables *-in-progress-p to *-in-progress
* doc/lispref/backups.texi (Reverting): Fix variable names
revert-buffer-in-progress and auto-revert-buffer-in-progress.

* etc/NEWS: Fix variable names revert-buffer-in-progress and
auto-revert-buffer-in-progress.
Presentational fixes and improvements.

* lisp/autorevert.el (auto-revert-buffer-in-progress): Rename.
(auto-revert-handler, auto-revert-buffer): Use renamed variables.

* lisp/dired-x.el (dired-omit-expunge):
Use `auto-revert-buffer-in-progress'.

* lisp/files.el (revert-buffer-in-progress): Rename.
(revert-buffer-in-progress-p): Declare obsolete.
(after-find-file, revert-buffer):
* lisp/saveplace.el (save-place-find-file-hook)
(save-place-dired-hook):
* lisp/vc/vc-git.el (vc-git-command, vc-git--out-ok):
* lisp/vc/vc.el (vc-diff-internal):
Use `revert-buffer-in-progress'.

* lisp/net/tramp-sh.el (tramp-sh-handle-vc-registered): Suppress warning.
2025-08-09 14:21:23 +02:00
Mattias Engdegård
1811cb294e Fix vc-git worktrees and vc-tests for directories with symlinks
* 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.
2025-08-04 10:55:25 +01:00
Mattias Engdegård
f9e0c06875 * lisp/vc/vc-git.el (vc-git--worktrees): Don't pass -z to older Git.
The -z option for 'git worktree list --porcelain' appeared in 2.36.
2025-08-04 10:54:34 +01:00
Sean Whitton
9f28f12ad5 vc-git-modify-change-comment: Error out for merge commits
* lisp/vc/vc-git.el (vc-git-modify-change-comment): Don't try to
modify merge commit comments.
2025-07-27 20:05:08 +01:00
Sean Whitton
fcdf2061ea ; VC: Improve documentation of other working trees features. 2025-07-26 13:06:51 +01:00
Sean Whitton
50ffb29d0b VC: New support for other working trees
* 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.
2025-07-25 19:34:04 +01:00
Sean Whitton
d381a7e799 * lisp/vc/vc-git.el (vc-git-diff): Don't pass --textconv.
This reverts this change:

    Author:     Sean Whitton <spwhitton@spwhitton.name>
    AuthorDate: Mon Jul 21 09:26:59 2025 +0100

      * lisp/vc/vc-git.el (vc-git-diff): Pass --textconv (bug#79050).
2025-07-22 11:34:44 +01:00
Sean Whitton
90fc061fd2 * lisp/vc/vc-git.el (vc-git-diff): Pass --textconv (bug#79050). 2025-07-21 09:26:59 +01:00
Stefan Monnier
e35e18ac18 lisp/vc: Try and avoid quoting lambdas
* lisp/vc/pcvs.el (cvs-menu, cvs-minor-mode-map):
* lisp/vc/vc-hg.el (vc-hg--extract-headers):
* lisp/vc/vc-git.el (vc-git-show-stash): Don't quote lambdas.
2025-07-19 14:42:28 -04:00
Sean Whitton
aec5c5f037 vc-git-diff: Fix case where REV1 & REV2 are nil and no commits yet
* 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).
2025-07-16 09:55:54 +01:00
Sean Whitton
8ff6e7fe58 ; vc-git-find-revision: Fix last change to this function. 2025-07-11 11:08:10 +01:00
Sean Whitton
191109e25e vc-git-find-revision: Pass --filters to git-cat-file
* lisp/vc/vc-git.el (vc-git-find-revision): Pass --filters to
git-cat-file.  Problem reported and fix suggested by Oscar
Fuentes <ofv@wanadoo.es>.
2025-07-11 09:13:47 +01:00
Sean Whitton
83da45ddd0 ; vc-git-checkin, vc-hg-checkin: Delete unused lexical variable. 2025-07-07 15:50:43 +01:00
Sean Whitton
6c0c985cee Resolve FIXME regarding running vc-checkin-hook
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.
2025-07-07 15:44:34 +01:00
Jim Porter
e88af5fff7 Use short revisions by default when navigating to revisions
* lisp/vc/vc-annotate.el (vc-annotate-revision-previous-to-line)
(vc-annotate-show-diff-revision-at-line-internal)
(vc-annotate-warp-revision): Let-bind 'vc-use-short-revision'
around calls to 'previous-revision' and 'next-revision'.

* lisp/vc/vc-git.el (vc-git-previous-revision, vc-git-next-revision):
Handle 'vc-use-short-revision' option (bug#78900).
2025-07-07 09:32:12 +01:00
Sean Whitton
7bf2a61623 ; * lisp/vc/vc-git.el (vc-git-print-log): Improve wording. 2025-06-29 16:30:13 +01:00
Sean Whitton
d23b605f75 VC: Fix several START-REVISION versus LIMIT issues
* 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'.
2025-06-29 14:53:37 +01:00
Dmitry Gutov
bec823b107 New user option: vc-allow-async-diff
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.
2025-06-13 06:00:52 +03:00
Sean Whitton
932e413f8a Replace vc-async-checkin-backends with a backend properties function
* lisp/vc/vc-git.el (vc-git-async-checkins):
* lisp/vc/vc-hg.el (vc-hg-async-checkins):
* lisp/vc/vc.el (vc-default-async-checkins): New functions.
(vc-checkin): Use them.
(vc-async-checkin-backends): Delete.
2025-06-12 10:18:54 +01:00
Sean Whitton
b195ccfe89 vc-git: Properly track unstaged deletions
* lisp/vc/vc-git.el (vc-git--git-status-to-vc-state)
(vc-git-after-dir-status-stage): Return/set 'missing' VC state,
not 'removed' state, for unstaged deletions.
(vc-git-dir-status-goto-stage): Add 'ls-files-missing' stage.
2025-06-07 13:27:00 +01:00
Sean Whitton
29990aadda ; * lisp/vc/vc-git.el (vc-git-after-dir-status-stage): Comments. 2025-06-07 13:27:00 +01:00
Sean Whitton
82109aa726 Inline sole call to vc-git--state-code
* lisp/vc/vc-git.el (vc-git--state-code): Delete.
(vc-git-after-dir-status-stage): Inline it here.
2025-06-07 13:27:00 +01:00