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

155 commits

Author SHA1 Message Date
Mattias Engdegård
e443811bd7 ; * test/lisp/vc/vc-tests/vc-tests.el: use write-region, again 2025-10-20 16:25:55 +02:00
Sean Whitton
095956a745 vc-test--with-temp-change: Use write-region
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--with-temp-change):
Use write-region (bug#79657).
2025-10-20 15:16:05 +01:00
Sean Whitton
b0012cb8e1 vc-rename-file: Make it work regardless of default-directory
* lisp/vc/vc.el (vc-rename-file): Make it work regardless of
default-directory; now the only influence of default-directory
should be resolving OLD and NEW if they are relative file names.
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--rename-file): Test
the influence of default-directory on vc-rename-file.
2025-10-19 15:39:22 +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
c24e173c9c vc-add-working-tree: Finish by starting Dired
There won't be any uncommitted changes in the new working tree
yet, so vc-dir is unlikely to be useful.

* lisp/vc/vc.el (vc-add-working-tree): Finish by calling 'dired'
not 'vc-dir'.
* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--other-working-trees): Delete stubbing out 'vc-dir'.
2025-10-01 11:26:18 +01:00
Sean Whitton
8453fd59d4 vc-test--checkin-patch: Use atomic change groups
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--with-temp-change):
New macro.
(vc-test--checkin-patch): Use it.
2025-09-30 16:15:44 +01:00
Sean Whitton
1d03eb590c vc-test--checkin-patch: Restore alternative revert code path
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--checkin-patch):
For the last stage of the test, restore alternative code path
for Git, though this time limited to when running the test on
MS-Windows.  Cf. subthread starting from
<https://lists.gnu.org/archive/html/emacs-devel/2025-09/msg00785.html>.
2025-09-27 21:31:38 +01:00
Sean Whitton
398b4f96ce vc-test--checkin-patch: Use {author} not {user}
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--checkin-patch):
Use Mercurial template '{author}' not '{user}' for
compatibility.
2025-09-26 15:10:13 +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
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
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
d4c9f08f26 vc-test--with-author-identity: Handle Mercurial
* test/lisp/vc/vc-tests/vc-tests.el (vc-hg-global-switches):
Declare.
(vc-test--with-author-identity): Handle Mercurial.
2025-08-16 14:12:04 +01:00
Sean Whitton
bb1c737531 vc-test--other-working-trees: Export env vars so Git finds an author
* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--with-author-identity): New macro, factored out of
vc-test--version-diff.
(vc-test--version-diff, vc-test--other-working-trees): Use it.
2025-08-12 20:35:49 +01:00
Sean Whitton
2923d244a3 vc-test--other-working-trees: Fix a skip condition
* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--other-working-trees): For Git, don't try moving the
first working tree unless we have Git>=2.29.
2025-08-12 14:36:15 +01:00
Sean Whitton
c687756ce2 vc-test-git07-other-working-trees: Widen scope of skip on Git<=2.17
* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--other-working-trees): Delete condition to skip
'move-working-tree' tests on Git<=2.17.
(vc-test-git07-other-working-trees): Skip this whole test on
Git<=2.17 (discussion in bug#79024).
2025-08-12 14:11:13 +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
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
Sean Whitton
e954b29f5f vc-test--other-working-trees: Stub out 'vc-dir'
* test/lisp/vc/vc-tests/vc-tests.el
(vc-test--other-working-trees): Stub out 'vc-dir' when adding
the second working tree.
2025-07-27 19:44:31 +01:00
Sean Whitton
eadc36a2af vc-tests: Fix two problems with other working tree tests
* test/lisp/vc/vc-tests/vc-tests.el (project, cl-lib): Require.
(vc-test--other-working-trees): Bind project-list-file to a
writeable file name.
(vc-test-hg07-other-working-trees): Use vc-hg-global-switches to
enable the share extension.
2025-07-27 09:24:02 +01:00
Sean Whitton
ed71aac7ea ; vc-test--other-working-trees: Fix unused variable warning. 2025-07-26 13:13:29 +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
08ca6caa0a vc-test--version-diff: Bind vc-async-checkin
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--version-diff):
Bind vc-async-checkin to disable async checkins during test.
2025-07-25 19:04:07 +01:00
Eli Zaretskii
0237e0d1a4 ; * test/lisp/vc/vc-tests/vc-tests.el (vc-test--version-diff): Fix for Bzr. 2025-07-15 19:30:05 +03:00
Sean Whitton
ac4869c712 VC: Deprecate log-incoming and log-outgoing backend functions
* lisp/vc/vc-git.el (vc-git-incoming-revision):
Inline vc-git--fetch-incoming.
(vc-git--fetch-incoming, vc-git-log-incoming)
(vc-git-log-outgoing): Delete.
* lisp/vc/vc-hg.el (vc-hg-mergebase):
* lisp/vc/vc.el (vc-default-log-incoming)
(vc-default-log-outgoing): New functions.
* lisp/vc/vc.el:
* etc/NEWS: Document the deprecation.
2025-06-06 09:53:32 +01:00
Eli Zaretskii
b87608c9c7 ; Fix VC tests
* test/lisp/vc/vc-tests/vc-tests.el (vc-test-hg06-version-diff):
Skip on MS-Windows in batch mode.

* test/lisp/vc/vc-git-tests.el (vc-git-test--start-branch): More
portable command for showing the current branch ("--show-current"
is only available since Git 2.22).
2025-05-09 14:43:03 +03:00
Sean Whitton
295c38b03d Create new test/lisp/vc/vc-tests/ for vc.el tests
* test/lisp/vc/vc-tests.el: Move ...
* test/lisp/vc/vc-tests/vc-tests.el: ... to here.
* test/lisp/vc/vc-misc-tests.el: Move ...
* test/lisp/vc/vc-tests/vc-test-misc.el: ... to here.
2025-05-09 11:00:47 +01:00
Sean Whitton
07c2b169ed Improve syncing VC buffers before generating diffs
* lisp/vc/vc.el (vc-maybe-buffer-sync): Delete.  Correct
handling of indirect buffers is now implicitly achieved by
vc-buffer-sync-fileset.
(vc-buffer-sync-fileset): Make NOT-ESSENTIAL argument optional,
new MISSING-IN-DIRS optional argument.  Rewrite to handle
directories named in the fileset, not only files.
(vc-ediff): Replace call to vc-maybe-buffer-sync with a call to
vc-buffer-sync-fileset.
(vc-root-diff): Similarly replace call to vc-maybe-buffer-sync.
This means the user is prompted to save additional buffers, that
they likely want to save before generating the diffs.
* test/lisp/vc/vc-misc-tests.el: New file.
2025-04-27 11:52:53 +08:00
Michael Albinus
8c04396b19 Fix emerge.el for remote files
* lisp/vc/emerge.el (emerge-make-diff-list)
(emerge-make-diff3-list): Set proper `default-directory' in order
to support remote files.  (Bug#6850, Bug#74352)

* test/lisp/vc/emerge-tests.el: New file.
2025-04-20 18:16:14 +02:00
Stefan Kangas
87d615e26c ; Fix failing diff-mode tests
* test/lisp/vc/diff-mode-resources/git.patch: Delete file, moving
its contents to...
* test/lisp/vc/diff-mode-tests.el (diff-mode-tests--git-patch):
...this new variable.  Git merges kept deleting a trailing
whitespace in the patch signature, so let's do this instead.
(diff-mode-test-git-patch)
(diff-mode-test-git-patch/before-first-hunk)
(diff-mode-test-git-patch/signature): Use above new variable.
2025-04-19 10:39:05 +02:00
Yuan Fu
e7ca83a2f4
Merge from savannah/emacs-30
01d4eb3dd4 ; Improve doc string of 'insert-char'
93ad8407ed * admin/notes/emba: Fix docker build instruction.
b901290ae7 * doc/lispref/text.texi (Margins): Grammar fix.
16855c89dd Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/...
8792d3431b Backport: Fix tree-sitter tests on Emba

# Conflicts:
#	test/infra/Dockerfile.emba
2025-04-18 16:30:39 -07:00
Sean Whitton
5f89eadb3f ; Drop Mtn from comment now vc-mtn is obsolete 2025-04-08 13:24:15 +08:00
Tomas Nordin
4980287e08 Teach diff-apply-hunk to handle hunks with empty context
* lisp/vc/diff-mode.el (diff-find-source-location):
Consider the case when there is no diff context above or below
edited lines.  (bug#72556)

* test/lisp/vc/diff-mode-tests.el: Add tests for undoing hunks
from diffs with addtions only in the beginning or end of the
source file.
2025-03-15 04:54:11 +02:00
john muhl
af5a75a0bd ; Fix 'diff-mode' tests (Bug#77014)
* test/lisp/vc/diff-mode-resources/git.patch: Restore missing space.
2025-03-14 19:58:35 +01:00
Yuan Fu
f2f1fb7fe0
Merge from origin/emacs-30
defc55bb6f Fix treesit-parser-create behavior regarding indirect buf...
20ac26e675 ; Fix with-delayed-message docstring metavars.
04034cd9ce Fix 'dired-movement-style' in Dired when subdirs are shown
f8443dffc1 ; * lisp/register.el (register-use-preview): Doc fix (bug...
f729828bcf ; Add texinfo reference to GNU Coding Standards.
a6abb88fdc ; * lisp/files.el (executable-find): Doc fix.

# Conflicts:
#	src/treesit.c
2025-03-13 20:18:03 -07:00
Stefan Kangas
731af8747c ; Fix byte-compiler warning 2025-03-09 18:29:01 +01:00
Mauro Aranda
d01b7c85fe Guard against user saving ediff-meta-diff-buffer
* lisp/vc/ediff-mult.el (ediff-collect-custom-diffs): If the
diff buffer is visiting a file, create a new buffer.  (Bug#3348)

* test/lisp/vc/ediff-mult-tests.el: New test file.
2025-03-09 08:10:17 -03:00
Christoph Badura
00e284fc52 VC: New hook to strip CVS template lines when committing
Add a hook function to strip all lines beginning with "CVS:" from the
commit message as CVS does.  Do this only if 'log-edit-vc-backend' is
'CVS'.  (Bug#72341)

* lisp/vc/log-edit.el
(log-edit-done-strip-cvs-lines): New command.
(log-edit-done-hook): Add it as an option.

* test/lisp/vc/log-edit-tests.el
(log-edit-done-strip-cvs-lines-helper): New function.
(log-edit-done-strip-cvs-lines-cvs)
(log-edit-done-strip-cvs-lines-non-cvs)
(log-edit-done-strip-cvs-lines-only-cvs-colon-blank)
(log-edit-done-strip-cvs-lines-only-cvs-colon): New test cases.

* etc/NEWS: Mention log-edit-done-strip-cvs-lines.
2025-03-09 14:28:25 +08:00
Stefan Kangas
10abb87f05 Fix fontification outside hunks in Git patches
* lisp/vc/diff-mode.el (diff-font-lock-keywords): Don't fontify lines in
Git patches starting with + or - as added/removed, if they are either
before the first hunk, or in the email signature.  (Bug#75884)
(diff-buffer-type): Move definition up.
(diff--indicator-added-re, diff--indicator-removed-re): New variables.
(diff--git-preamble-end, diff--git-footer-start)
(diff--indicator-matcher-helper, diff--indicator-added-matcher)
(diff--indicator-removed-matcher): New functions.
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-git-patch)
(diff-mode-test-git-patch/before-first-hunk)
(diff-mode-test-git-patch/signature): New tests.
* test/lisp/vc/diff-mode-resources/git.patch: New file.
2025-03-03 18:57:17 +01:00
Stefan Kangas
83e2e5e24b ; Fix thinko 2025-03-02 19:46:15 +01:00
Stefan Kangas
e4d8095c3d Fix a vc test for Breezy by setting $HOME
* test/lisp/vc/vc-tests.el (vc--fix-home-for-bzr): New macro.
(vc-test--create-repo, vc-test--register, vc-test--working-revision)
(vc-test--checkout-model, vc-test--rename-file)
(vc-test--version-diff): Fix test for Breezy by setting HOME to a
temporary directory.  (Bug#70195)
2025-03-02 13:37:34 +01:00
Kévin Le Gouguec
15d2fc6498 Test vc-git-dir-extra-headers directly (bug#76187)
* test/lisp/vc/vc-git-tests.el (vc-git-test--run): Make sure to
log output from failing Git commands.
(vc-git-test--dir-headers): Stop bothering with vc-dir
internals and just invoke the branch-munging and
header-formatting code we mean to test.
(vc-git-test-dir-branch-headers): Stop invoking vc-dir; just set
default-directory to be able to pass it to the backend function.
2025-02-17 21:47:14 +01:00
Stefan Monnier
7f2508e6e1 (diff-mode-test-font-lock): Fix spurious test failure
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-font-lock):
Don't nitpick about non-face-affecting overlays.
2025-02-15 11:12:36 -05:00
Stefan Kangas
7fa975adbc Update copyright year to 2025
Run "TZ=UTC0 admin/update-copyright".
2025-01-02 18:39:42 +01:00
Paul Eggert
4da38c6321 Update copyright year to 2025
Run "TZ=UTC0 admin/update-copyright".
2025-01-01 07:39:17 +00:00
Kévin Le Gouguec
2f710af5bf Test more vc-dir scenarios with Git (bug#68183)
* test/lisp/vc/vc-git-tests.el
(vc-git-test-dir-track-local-branch): Remove in favor of new
test.
(vc-git-test--start-branch): New helper to get a repository
going.
(vc-git-test--dir-headers): New helper to get a list of headers
in the current vc-dir buffer.
(vc-git-test-dir-branch-headers): New test, exercising the
original bug recipe plus more common scenarios.
2024-08-21 03:41:18 +03:00
Stefan Kangas
4a76af51bb Replace literal whitespace with \s
* test/lisp/vc/log-edit-tests.el (log-edit-fill-entry-confinement)
(log-edit-fill-entry-space-substitution)
(log-edit-fill-entry-initial-wrapping): Replace literal space character
with '\s', to avoid tripping up merge scripts.
2024-06-22 18:42:06 +02:00
Po Lu
145a77808e More effectually prevent defun list wrapping in C-x C-w
* lisp/vc/log-edit.el (log-edit-fill-entry): Match and replace
with NBSPs the opening defun list also.

* test/lisp/vc/log-edit-tests.el
(log-edit-fill-entry-no-defun-list-wrapping): New test.
2024-04-24 11:45:31 +08:00
Mattias Engdegård
2f0df93d8c ; * test/lisp/vc/vc-git-tests.el: bend doc string quote 2024-03-29 11:53:56 +01:00
Kévin Le Gouguec
014cd00402 Fix vc-git test when no identities are configured
Reported by john muhl <jm@pub.pink>.

* test/lisp/vc/vc-git-tests.el (vc-git-test--with-repo): Set
some environment variables (lifted from vc-tests.el) to let
'git commit' compute dummy author and committer identities.
2024-03-19 21:53:40 +01:00
Kévin Le Gouguec
8d4a8b7dfd ; Re-apply accidentally reverted commit
This re-applies:

  2024-03-17 "Fix vc-dir when "remote" Git branch is local"
  (21828f288e)

reverted as part of the unrelated:

  2024-03-17 "Update modus-themes to their 4.4.0 version"
  (67b0c1c09e)

The original commit message follows:

Fix vc-dir when "remote" Git branch is local

While in there, add that "tracking" branch to the vc-dir
buffer.  For bug#68183.

* lisp/vc/vc-git.el (vc-git-dir-extra-headers): Reduce
boilerplate with new function 'vc-git--out-ok'; stop calling
vc-git-repository-url when REMOTE is "." to avoid throwing an
error; display tracking branch; prefer "none (<details...>)" to
"not (<details...>)" since that reads more grammatically
correct.
(vc-git--out-ok): Add documentation.
(vc-git--out-str): New function to easily get the output from a
Git command.
* test/lisp/vc/vc-git-tests.el (vc-git-test--with-repo)
(vc-git-test--run): New helpers, defined to steer clear of
vc-git-- internal functions.
(vc-git-test-dir-track-local-branch): Check that vc-dir does
not crash.
2024-03-17 22:37:28 +01:00