From 6d4e7ef5502c7eabc24d348561a30cac9c5c0c26 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 18 Nov 2020 16:26:30 +0100 Subject: [PATCH] update magit to 20200608.928 --- elpa/magit-20200126.1750/magit-pkg.el | 12 - elpa/magit-20200126.1750/magit.info | 193 --- .../AUTHORS.md | 0 .../LICENSE | 0 .../dir | 0 .../git-rebase.el | 0 .../magit-apply.el | 0 .../magit-autoloads.el | 48 +- .../magit-autorevert.el | 4 +- .../magit-bisect.el | 2 +- .../magit-blame.el | 19 +- .../magit-bookmark.el | 0 .../magit-branch.el | 34 +- .../magit-clone.el | 26 +- .../magit-commit.el | 67 +- .../magit-core.el | 0 .../magit-diff.el | 55 +- .../magit-ediff.el | 2 +- .../magit-extras.el | 113 +- .../magit-fetch.el | 6 +- .../magit-files.el | 2 +- .../magit-git.el | 47 +- .../magit-gitignore.el | 2 +- .../magit-imenu.el | 0 .../magit-log.el | 59 +- .../magit-margin.el | 2 +- .../magit-merge.el | 21 +- .../magit-mode.el | 31 +- .../magit-notes.el | 14 +- .../magit-obsolete.el | 0 .../magit-patch.el | 104 +- elpa/magit-20200608.928/magit-pkg.el | 12 + .../magit-process.el | 4 +- .../magit-pull.el | 6 +- .../magit-push.el | 6 +- .../magit-reflog.el | 0 .../magit-refs.el | 23 +- .../magit-remote.el | 16 +- .../magit-repos.el | 0 .../magit-reset.el | 10 +- .../magit-section.el | 5 +- .../magit-sequence.el | 28 +- .../magit-stash.el | 2 +- .../magit-status.el | 12 +- .../magit-submodule.el | 16 +- .../magit-subtree.el | 16 +- .../magit-tag.el | 82 +- .../magit-transient.el | 0 .../magit-utils.el | 4 +- .../magit-wip.el | 30 +- .../magit-worktree.el | 2 +- .../magit.el | 38 +- elpa/magit-20200608.928/magit.info | 193 +++ .../magit.info-1 | 62 +- .../magit.info-2 | 143 +- .../dir | 0 .../magit-popup-autoloads.el | 0 .../magit-popup-pkg.el | 4 +- .../magit-popup.el | 2 +- .../magit-popup.info | 22 +- elpa/magit-popup-readme.txt | 2 +- .../magit-todos-autoloads.el | 48 + .../magit-todos-pkg.el | 2 + elpa/magit-todos-20200310.28/magit-todos.el | 1447 +++++++++++++++++ 64 files changed, 2425 insertions(+), 675 deletions(-) delete mode 100644 elpa/magit-20200126.1750/magit-pkg.el delete mode 100644 elpa/magit-20200126.1750/magit.info rename elpa/{magit-20200126.1750 => magit-20200608.928}/AUTHORS.md (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/LICENSE (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/dir (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/git-rebase.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-apply.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-autoloads.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-autorevert.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-bisect.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-blame.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-bookmark.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-branch.el (97%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-clone.el (94%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-commit.el (90%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-core.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-diff.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-ediff.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-extras.el (89%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-fetch.el (97%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-files.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-git.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-gitignore.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-imenu.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-log.el (97%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-margin.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-merge.el (95%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-mode.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-notes.el (94%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-obsolete.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-patch.el (73%) create mode 100644 elpa/magit-20200608.928/magit-pkg.el rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-process.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-pull.el (97%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-push.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-reflog.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-refs.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-remote.el (96%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-repos.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-reset.el (92%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-section.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-sequence.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-stash.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-status.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-submodule.el (98%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-subtree.el (93%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-tag.el (71%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-transient.el (100%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-utils.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-wip.el (92%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit-worktree.el (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit.el (95%) create mode 100644 elpa/magit-20200608.928/magit.info rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit.info-1 (99%) rename elpa/{magit-20200126.1750 => magit-20200608.928}/magit.info-2 (98%) rename elpa/{magit-popup-20200102.1811 => magit-popup-20200306.223}/dir (100%) rename elpa/{magit-popup-20200102.1811 => magit-popup-20200306.223}/magit-popup-autoloads.el (100%) rename elpa/{magit-popup-20200102.1811 => magit-popup-20200306.223}/magit-popup-pkg.el (63%) rename elpa/{magit-popup-20200102.1811 => magit-popup-20200306.223}/magit-popup.el (99%) rename elpa/{magit-popup-20200102.1811 => magit-popup-20200306.223}/magit-popup.info (98%) create mode 100644 elpa/magit-todos-20200310.28/magit-todos-autoloads.el create mode 100644 elpa/magit-todos-20200310.28/magit-todos-pkg.el create mode 100644 elpa/magit-todos-20200310.28/magit-todos.el diff --git a/elpa/magit-20200126.1750/magit-pkg.el b/elpa/magit-20200126.1750/magit-pkg.el deleted file mode 100644 index 352f1413..00000000 --- a/elpa/magit-20200126.1750/magit-pkg.el +++ /dev/null @@ -1,12 +0,0 @@ -(define-package "magit" "20200126.1750" "A Git porcelain inside Emacs." - '((emacs "25.1") - (async "20180527") - (dash "20180910") - (git-commit "20181104") - (transient "20190812") - (with-editor "20181103")) - :keywords - '("git" "tools" "vc")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/magit-20200126.1750/magit.info b/elpa/magit-20200126.1750/magit.info deleted file mode 100644 index 0b515dd9..00000000 --- a/elpa/magit-20200126.1750/magit.info +++ /dev/null @@ -1,193 +0,0 @@ -This is magit.info, produced by makeinfo version 6.5 from magit.texi. - - Copyright (C) 2015-2020 Jonas Bernoulli - - You can redistribute this document and/or modify it under the terms - of the GNU General Public License as published by the Free Software - Foundation, either version 3 of the License, or (at your option) - any later version. - - This document is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - -INFO-DIR-SECTION Emacs -START-INFO-DIR-ENTRY -* Magit: (magit). Using Git from Emacs with Magit. -END-INFO-DIR-ENTRY - - -Indirect: -magit.info-1: 754 -magit.info-2: 301088 - -Tag Table: -(Indirect) -Node: Top754 -Node: Introduction6475 -Node: Installation11198 -Node: Installing from Melpa11528 -Node: Installing from the Git Repository12601 -Node: Post-Installation Tasks14949 -Node: Getting Started16234 -Node: Interface Concepts21683 -Node: Modes and Buffers22044 -Node: Switching Buffers23793 -Node: Naming Buffers28544 -Node: Quitting Windows31851 -Node: Automatic Refreshing of Magit Buffers33597 -Node: Automatic Saving of File-Visiting Buffers36449 -Node: Automatic Reverting of File-Visiting Buffers37634 -Node: Risk of Reverting Automatically42629 -Node: Sections45011 -Node: Section Movement45937 -Node: Section Visibility50847 -Node: Section Hooks56924 -Node: Section Types and Values59331 -Node: Section Options60634 -Node: Transient Commands61106 -Node: Transient Arguments and Buffer Variables62343 -Node: Completion Confirmation and the Selection69361 -Node: Action Confirmation69805 -Node: Completion and Confirmation77155 -Node: The Selection80341 -Node: The hunk-internal region83240 -Node: Support for Completion Frameworks84329 -Node: Additional Completion Options89236 -Node: Running Git89835 -Node: Viewing Git Output90108 -Node: Git Process Status91241 -Node: Running Git Manually92206 -Node: Git Executable94676 -Node: Global Git Arguments96958 -Node: Inspecting97764 -Node: Status Buffer98921 -Node: Status Sections102911 -Node: Status Header Sections108463 -Node: Status Module Sections111093 -Node: Status Options113598 -Node: Repository List115473 -Node: Logging118511 -Node: Refreshing Logs121074 -Node: Log Buffer122520 -Node: Log Margin126376 -Node: Select from Log129555 -Node: Reflog131780 -Node: Cherries133437 -Node: Diffing135285 -Node: Refreshing Diffs138366 -Node: Commands Available in Diffs141945 -Node: Diff Options144481 -Node: Revision Buffer149519 -Node: Ediffing152849 -Node: References Buffer156497 -Node: References Sections167017 -Node: Bisecting167878 -Node: Visiting Files and Blobs169691 -Node: General-Purpose Visit Commands170161 -Node: Visiting Files and Blobs from a Diff171117 -Node: Blaming174576 -Node: Manipulating181139 -Node: Creating Repository181481 -Node: Cloning Repository182036 -Node: Staging and Unstaging187279 -Node: Staging from File-Visiting Buffers191362 -Node: Applying192530 -Node: Committing194423 -Node: Initiating a Commit195006 -Node: Editing Commit Messages198391 -Node: Using the Revision Stack201194 -Node: Commit Pseudo Headers204245 -Node: Commit Mode and Hooks205581 -Node: Commit Message Conventions208519 -Node: Branching210647 -Node: The Two Remotes210873 -Node: Branch Commands213526 -Node: Branch Git Variables225909 -Node: Auxiliary Branch Commands231300 -Node: Merging232418 -Node: Resolving Conflicts236426 -Node: Rebasing241427 -Node: Editing Rebase Sequences246286 -Node: Information About In-Progress Rebase250614 -Ref: Information About In-Progress Rebase-Footnote-1259496 -Node: Cherry Picking260092 -Node: Reverting264423 -Node: Resetting265872 -Node: Stashing267526 -Node: Transferring272227 -Node: Remotes272449 -Node: Remote Commands272601 -Node: Remote Git Variables276682 -Node: Fetching277961 -Node: Pulling280448 -Node: Pushing281494 -Node: Plain Patches284964 -Node: Maildir Patches286455 -Node: Miscellaneous287969 -Node: Tagging288285 -Node: Notes290213 -Node: Submodules292585 -Node: Listing Submodules292803 -Node: Submodule Transient294731 -Node: Subtree297253 -Node: Worktree299229 -Node: Common Commands301088 -Node: Wip Modes303135 -Node: Wip Graph308068 -Node: Legacy Wip Modes310382 -Node: Minor Mode for Buffers Visiting Files313277 -Node: Minor Mode for Buffers Visiting Blobs320378 -Node: Customizing321191 -Node: Per-Repository Configuration322787 -Node: Essential Settings325042 -Node: Safety325366 -Node: Performance327127 -Node: Microsoft Windows Performance334188 -Node: MacOS Performance335379 -Ref: MacOS Performance-Footnote-1336084 -Node: Plumbing336166 -Node: Calling Git336995 -Node: Getting a Value from Git338520 -Node: Calling Git for Effect341606 -Node: Section Plumbing348126 -Node: Creating Sections348354 -Node: Section Selection352254 -Node: Matching Sections354053 -Node: Refreshing Buffers360026 -Node: Conventions363174 -Node: Theming Faces363366 -Node: FAQ371481 -Node: FAQ - How to ...?371923 -Node: How to show git's output?372283 -Node: How to install the gitman info manual?373037 -Node: How to show diffs for gpg-encrypted files?374007 -Node: How does branching and pushing work?374603 -Node: Can Magit be used as ediff-version-control-package?374966 -Node: FAQ - Issues and Errors376955 -Node: Magit is slow377887 -Node: I changed several thousand files at once and now Magit is unusable378101 -Node: I am having problems committing378830 -Node: I am using MS Windows and cannot push with Magit379311 -Node: I am using OS X and SOMETHING works in shell but not in Magit379928 -Node: Diffs contain control sequences380734 -Node: Expanding a file to show the diff causes it to disappear381847 -Node: Point is wrong in the COMMIT_EDITMSG buffer382398 -Node: The mode-line information isn't always up-to-date383444 -Node: A branch and tag sharing the same name breaks SOMETHING384526 -Node: My Git hooks work on the command-line but not inside Magit385414 -Node: git-commit-mode isn't used when committing from the command-line386260 -Node: Point ends up inside invisible text when jumping to a file-visiting buffer388527 -Node: Debugging Tools389325 -Node: Keystroke Index391504 -Node: Command Index425488 -Node: Function Index462513 -Node: Variable Index478865 - -End Tag Table - - -Local Variables: -coding: utf-8 -End: diff --git a/elpa/magit-20200126.1750/AUTHORS.md b/elpa/magit-20200608.928/AUTHORS.md similarity index 100% rename from elpa/magit-20200126.1750/AUTHORS.md rename to elpa/magit-20200608.928/AUTHORS.md diff --git a/elpa/magit-20200126.1750/LICENSE b/elpa/magit-20200608.928/LICENSE similarity index 100% rename from elpa/magit-20200126.1750/LICENSE rename to elpa/magit-20200608.928/LICENSE diff --git a/elpa/magit-20200126.1750/dir b/elpa/magit-20200608.928/dir similarity index 100% rename from elpa/magit-20200126.1750/dir rename to elpa/magit-20200608.928/dir diff --git a/elpa/magit-20200126.1750/git-rebase.el b/elpa/magit-20200608.928/git-rebase.el similarity index 100% rename from elpa/magit-20200126.1750/git-rebase.el rename to elpa/magit-20200608.928/git-rebase.el diff --git a/elpa/magit-20200126.1750/magit-apply.el b/elpa/magit-20200608.928/magit-apply.el similarity index 100% rename from elpa/magit-20200126.1750/magit-apply.el rename to elpa/magit-20200608.928/magit-apply.el diff --git a/elpa/magit-20200126.1750/magit-autoloads.el b/elpa/magit-20200608.928/magit-autoloads.el similarity index 98% rename from elpa/magit-20200126.1750/magit-autoloads.el rename to elpa/magit-20200608.928/magit-autoloads.el index 4689dfa2..8ec6d07c 100644 --- a/elpa/magit-20200126.1750/magit-autoloads.el +++ b/elpa/magit-20200608.928/magit-autoloads.el @@ -451,7 +451,7 @@ Then show the status buffer for the new repository. \(fn REPOSITORY DIRECTORY ARGS)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-clone" '("magit-clone"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-clone" '("magit-clone-"))) ;;;*** @@ -547,8 +547,9 @@ history element. \(fn DATE)" t nil) (autoload 'magit-commit-absorb "magit-commit" nil t) + (autoload 'magit-commit-autofixup "magit-commit" nil t) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-commit" '("magit"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-commit" '("magit-"))) ;;;*** @@ -632,7 +633,7 @@ for a revision. \(fn REV &optional ARGS FILES MODULE)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-diff" '("magit"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-diff" '("magit-"))) ;;;*** @@ -722,7 +723,7 @@ stash that were staged. \(fn STASH)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-ediff" '("magit-ediff"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-ediff" '("magit-ediff-"))) ;;;*** @@ -1377,7 +1378,7 @@ Show commits in a branch that are not merged in the upstream branch. \(fn HEAD UPSTREAM)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-log" '("magit"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-log" '("magit-"))) ;;;*** @@ -1481,7 +1482,7 @@ Abort the current merge operation. ;;; Generated autoloads from magit-notes.el (autoload 'magit-notes "magit" nil t) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-notes" '("magit-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-notes" '("magit-notes-"))) ;;;*** @@ -1556,7 +1557,7 @@ Pull from a branch read in the minibuffer. \(fn SOURCE ARGS)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-pull" '("magit-pull"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-pull" '("magit-pull-"))) ;;;*** @@ -1793,6 +1794,13 @@ Reset the `HEAD', index, and working tree to COMMIT. \(fn COMMIT)" t nil) +(autoload 'magit-reset-keep "magit-reset" "\ +Reset the `HEAD' and index to COMMIT, while keeping uncommitted changes. + +\(git reset --keep REVISION) + +\(fn COMMIT)" t nil) + (autoload 'magit-reset-index "magit-reset" "\ Reset the index to COMMIT. Keep the `HEAD' and working tree as-is, so if COMMIT refers to the @@ -1816,7 +1824,7 @@ With a prefix argument reset the working tree otherwise don't. \(fn COMMIT &optional HARD)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-reset" '("magit-reset"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-reset" '("magit-reset-"))) ;;;*** @@ -2208,7 +2216,7 @@ Like `magit-status' but with non-nil `magit-status-goto-file-position'. Unregister MODULES and remove their working directories. For safety reasons, do not remove the gitdirs and if a module has -uncomitted changes, then do not remove it at all. If a module's +uncommitted changes, then do not remove it at all. If a module's gitdir is located inside the working directory, then move it into the gitdir of the superproject first. @@ -2336,7 +2344,7 @@ Offer to delete tags missing locally from REMOTE, and vice versa. \(fn TAGS REMOTE-TAGS REMOTE)" t nil) (autoload 'magit-tag-release "magit-tag" "\ -Create an annotated release tag. +Create a release tag. Assume that release tags match `magit-release-tag-regexp'. @@ -2344,19 +2352,15 @@ First prompt for the name of the new tag using the highest existing tag as initial input and leaving it to the user to increment the desired part of the version string. -Then prompt for the message of the new tag. Base the proposed -tag message on the message of the highest tag, provided that -that contains the corresponding version string and substituting -the new version string for that. Otherwise propose something -like \"Foo-Bar 1.2.3\", given, for example, a TAG \"v1.2.3\" and a -repository located at something like \"/path/to/foo-bar\". - -Then call \"git tag --annotate --sign -m MSG TAG\" to create the, -tag, regardless of whether these arguments are enabled in the -popup. Finally show the refs buffer to let the user quickly -review the result. +If `--annotate' is enabled, then prompt for the message of the +new tag. Base the proposed tag message on the message of the +highest tag, provided that that contains the corresponding +version string and substituting the new version string for that. +Otherwise propose something like \"Foo-Bar 1.2.3\", given, for +example, a TAG \"v1.2.3\" and a repository located at something +like \"/path/to/foo-bar\". -\(fn TAG MSG)" t nil) +\(fn TAG MSG &optional ARGS)" t nil) (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-tag" '("magit-"))) diff --git a/elpa/magit-20200126.1750/magit-autorevert.el b/elpa/magit-20200608.928/magit-autorevert.el similarity index 98% rename from elpa/magit-20200126.1750/magit-autorevert.el rename to elpa/magit-20200608.928/magit-autorevert.el index 41ccbfea..74c07210 100644 --- a/elpa/magit-20200126.1750/magit-autorevert.el +++ b/elpa/magit-20200608.928/magit-autorevert.el @@ -110,7 +110,9 @@ seconds of user inactivity. That is not desirable." (file-readable-p buffer-file-name) (or (< emacs-major-version 27) (with-no-warnings - (executable-find magit-git-executable t))) ; see #3684 + (condition-case nil + (executable-find magit-git-executable t) ; see #3684 + (wrong-number-of-arguments t)))) ; very old 27 built (magit-toplevel) (or (not magit-auto-revert-tracked-only) (magit-file-tracked-p buffer-file-name)) diff --git a/elpa/magit-20200126.1750/magit-bisect.el b/elpa/magit-20200608.928/magit-bisect.el similarity index 99% rename from elpa/magit-20200126.1750/magit-bisect.el rename to elpa/magit-20200608.928/magit-bisect.el index 451914e0..3ed42c8b 100644 --- a/elpa/magit-20200126.1750/magit-bisect.el +++ b/elpa/magit-20200608.928/magit-bisect.el @@ -55,7 +55,7 @@ ;;; Commands ;;;###autoload (autoload 'magit-bisect "magit-bisect" nil t) -(define-transient-command magit-bisect () +(transient-define-prefix magit-bisect () "Narrow in on the commit that introduced a bug." :man-page "git-bisect" ["Actions" diff --git a/elpa/magit-20200126.1750/magit-blame.el b/elpa/magit-20200608.928/magit-blame.el similarity index 98% rename from elpa/magit-20200126.1750/magit-blame.el rename to elpa/magit-20200608.928/magit-blame.el index 50657034..d537a341 100644 --- a/elpa/magit-20200126.1750/magit-blame.el +++ b/elpa/magit-20200608.928/magit-blame.el @@ -56,7 +56,7 @@ "List of styles used to visualize blame information. Each entry has the form (IDENT (KEY . VALUE)...). IDENT has -to be a symbol uniquely identifing the style. The following +to be a symbol uniquely identifying the style. The following KEYs are recognized: `show-lines' @@ -284,6 +284,7 @@ in `magit-blame-read-only-mode-map' instead.") (define-key map (kbd "q") 'magit-blame-quit) (define-key map (kbd "M-w") 'magit-blame-copy-hash) (define-key map (kbd "SPC") 'magit-diff-show-or-scroll-up) + (define-key map (kbd "S-SPC") 'magit-diff-show-or-scroll-down) (define-key map (kbd "DEL") 'magit-diff-show-or-scroll-down) map) "Keymap for `magit-blame-read-only-mode'.") @@ -708,7 +709,7 @@ modes is toggled, then this mode also gets toggled automatically. ;;; Commands ;;;###autoload (autoload 'magit-blame-echo "magit-blame" nil t) -(define-suffix-command magit-blame-echo (args) +(transient-define-suffix magit-blame-echo (args) "For each line show the revision in which it was added. Show the information about the chunk at point in the echo area when moving between chunks. Unlike other blaming commands, do @@ -733,7 +734,7 @@ not turn on `read-only-mode'." (magit-blame--update-overlays))) ;;;###autoload (autoload 'magit-blame-addition "magit-blame" nil t) -(define-suffix-command magit-blame-addition (args) +(transient-define-suffix magit-blame-addition (args) "For each line show the revision in which it was added." (interactive (list (magit-blame-arguments))) (magit-blame--pre-blame-assert 'addition) @@ -741,7 +742,7 @@ not turn on `read-only-mode'." (magit-blame--run args)) ;;;###autoload (autoload 'magit-blame-removal "magit-blame" nil t) -(define-suffix-command magit-blame-removal (args) +(transient-define-suffix magit-blame-removal (args) "For each line show the revision in which it was removed." :if-nil 'buffer-file-name (interactive (list (magit-blame-arguments))) @@ -752,7 +753,7 @@ not turn on `read-only-mode'." (magit-blame--run args)) ;;;###autoload (autoload 'magit-blame-reverse "magit-blame" nil t) -(define-suffix-command magit-blame-reverse (args) +(transient-define-suffix magit-blame-reverse (args) "For each line show the last revision in which it still exists." :if-nil 'buffer-file-name (interactive (list (magit-blame-arguments))) @@ -811,7 +812,7 @@ not turn on `read-only-mode'." (goto-char (point-min)) (forward-line (1- orig-line)))) -(define-suffix-command magit-blame-quit () +(transient-define-suffix magit-blame-quit () "Turn off Magit-Blame mode. If the buffer was created during a recursive blame, then also kill the buffer." @@ -885,7 +886,7 @@ instead of the hash, like `kill-ring-save' would." ;;; Popup ;;;###autoload (autoload 'magit-blame "magit-blame" nil t) -(define-transient-command magit-blame () +(transient-define-prefix magit-blame () "Show the commits that added or removed lines in the visited file." :man-page "git-blame" :value '("-w") @@ -907,13 +908,13 @@ instead of the hash, like `kill-ring-save' would." (defun magit-blame-arguments () (transient-args 'magit-blame)) -(define-infix-argument magit-blame:-M () +(transient-define-argument magit-blame:-M () :description "Detect lines moved or copied within a file" :class 'transient-option :argument "-M" :reader 'transient-read-number-N+) -(define-infix-argument magit-blame:-C () +(transient-define-argument magit-blame:-C () :description "Detect lines moved or copied between files" :class 'transient-option :argument "-C" diff --git a/elpa/magit-20200126.1750/magit-bookmark.el b/elpa/magit-20200608.928/magit-bookmark.el similarity index 100% rename from elpa/magit-20200126.1750/magit-bookmark.el rename to elpa/magit-20200608.928/magit-bookmark.el diff --git a/elpa/magit-20200126.1750/magit-branch.el b/elpa/magit-20200608.928/magit-branch.el similarity index 97% rename from elpa/magit-20200126.1750/magit-branch.el rename to elpa/magit-20200608.928/magit-branch.el index a7ac1b54..e50c8100 100644 --- a/elpa/magit-20200126.1750/magit-branch.el +++ b/elpa/magit-20200608.928/magit-branch.el @@ -201,7 +201,7 @@ has to be used to view and change branch related variables." ;;; Commands ;;;###autoload (autoload 'magit-branch "magit" nil t) -(define-transient-command magit-branch (branch) +(transient-define-prefix magit-branch (branch) "Add, configure or remove a branch." :man-page "git-branch" ["Variables" @@ -340,7 +340,7 @@ when using `magit-branch-and-checkout'." (list choice (magit-read-starting-point "Create" choice)))))) (if (not start-point) (magit-checkout branch) - (when (magit-anything-modified-p) + (when (magit-anything-modified-p t) (user-error "Cannot checkout when there are uncommitted changes")) (magit-branch-and-checkout branch start-point) (when (magit-remote-branch-p start-point) @@ -515,6 +515,9 @@ that is being reset." (magit-branch-maybe-adjust-upstream branch to))) (magit-refresh)) +(defvar magit-branch-delete-never-verify nil + "Whether `magit-branch-delete' always pushes with \"--no-verify\".") + ;;;###autoload (defun magit-branch-delete (branches &optional force) "Delete one or multiple branches. @@ -561,7 +564,10 @@ defaulting to the branch at point." (offset (1+ (length remote)))) ;; Assume the branches actually still exists on the remote. (magit-run-git-async - "push" remote (--map (concat ":" (substring it offset)) branches)) + "push" + (and (or force magit-branch-delete-never-verify) "--no-verify") + remote + (--map (concat ":" (substring it offset)) branches)) ;; If that is not the case, then this deletes the tracking branches. (set-process-sentinel magit-this-process @@ -756,7 +762,7 @@ and also rename the respective reflog file." ;;; Configure ;;;###autoload (autoload 'magit-branch-configure "magit-branch" nil t) -(define-transient-command magit-branch-configure (branch) +(transient-define-prefix magit-branch-configure (branch) "Configure a branch." :man-page "git-branch" [:description @@ -777,7 +783,7 @@ and also rename the respective reflog file." (interactive (list (or (and (not current-prefix-arg) (not (and magit-branch-direct-configure - (eq current-transient-command 'magit-branch))) + (eq transient-current-command 'magit-branch))) (magit-get-current-branch)) (magit--read-branch-scope)))) (transient-setup 'magit-branch-configure nil nil :scope branch)) @@ -789,12 +795,12 @@ and also rename the respective reflog file." (format (oref obj variable) "")) "Configure branch"))) -(define-suffix-command magit-branch..description (branch) +(transient-define-suffix magit-branch..description (branch) "Edit the description of BRANCH." :class 'magit--git-variable :transient nil :variable "branch.%s.description" - (interactive (list (oref current-transient-prefix scope))) + (interactive (list (oref transient-current-prefix scope))) (magit-run-git-with-editor "branch" "--edit-description" branch)) (add-hook 'find-file-hook 'magit-branch-description-check-buffers) @@ -806,7 +812,7 @@ and also rename the respective reflog file." (defclass magit--git-branch:upstream (magit--git-variable) ((format :initform " %k %m %M\n %r %R"))) -(define-infix-command magit-branch..merge/remote () +(transient-define-infix magit-branch..merge/remote () :class 'magit--git-branch:upstream) (cl-defmethod transient-init-value ((obj magit--git-branch:upstream)) @@ -844,7 +850,7 @@ and also rename the respective reflog file." (propertize value 'face 'transient-argument) (propertize "unset" 'face 'transient-inactive-argument))) -(define-infix-command magit-branch..rebase () +(transient-define-infix magit-branch..rebase () :class 'magit--git-variable:choices :scope 'magit--read-branch-scope :variable "branch.%s.rebase" @@ -852,31 +858,31 @@ and also rename the respective reflog file." :choices '("true" "false") :default "false") -(define-infix-command magit-branch..pushRemote () +(transient-define-infix magit-branch..pushRemote () :class 'magit--git-variable:choices :scope 'magit--read-branch-scope :variable "branch.%s.pushRemote" :fallback "remote.pushDefault" :choices 'magit-list-remotes) -(define-infix-command magit-pull.rebase () +(transient-define-infix magit-pull.rebase () :class 'magit--git-variable:choices :variable "pull.rebase" :choices '("true" "false") :default "false") -(define-infix-command magit-remote.pushDefault () +(transient-define-infix magit-remote.pushDefault () :class 'magit--git-variable:choices :variable "remote.pushDefault" :choices 'magit-list-remotes) -(define-infix-command magit-branch.autoSetupMerge () +(transient-define-infix magit-branch.autoSetupMerge () :class 'magit--git-variable:choices :variable "branch.autoSetupMerge" :choices '("always" "true" "false") :default "true") -(define-infix-command magit-branch.autoSetupRebase () +(transient-define-infix magit-branch.autoSetupRebase () :class 'magit--git-variable:choices :variable "branch.autoSetupRebase" :choices '("always" "local" "remote" "never") diff --git a/elpa/magit-20200126.1750/magit-clone.el b/elpa/magit-20200608.928/magit-clone.el similarity index 94% rename from elpa/magit-20200126.1750/magit-clone.el rename to elpa/magit-20200608.928/magit-clone.el index e2b3f695..11d6b5cc 100644 --- a/elpa/magit-20200126.1750/magit-clone.el +++ b/elpa/magit-20200608.928/magit-clone.el @@ -104,7 +104,7 @@ the name of the owner. Also see `magit-clone-name-alist'." ;;; Commands ;;;###autoload (autoload 'magit-clone "magit-clone" nil t) -(define-transient-command magit-clone (&optional transient) +(transient-define-prefix magit-clone (&optional transient) "Clone a repository." :man-page "git-clone" ["Fetch arguments" @@ -247,21 +247,23 @@ Then show the status buffer for the new repository." (pcase-lambda (`(,re ,host ,user)) (and (string-match re name) (let ((repo (match-string 1 name))) - (format-spec - magit-clone-url-format - `((?h . ,host) - (?n . ,(if (string-match-p "/" repo) - repo - (if (string-match-p "\\." user) - (if-let ((user (magit-get user))) - (concat user "/" repo) - (user-error - "Set %S or specify owner explicitly" user)) - (concat user "/" repo))))))))) + (magit-clone--format-url host user repo)))) magit-clone-name-alist) (user-error "Not an url and no matching entry in `%s'" 'magit-clone-name-alist))) +(defun magit-clone--format-url (host user repo) + (format-spec + magit-clone-url-format + `((?h . ,host) + (?n . ,(if (string-match-p "/" repo) + repo + (if (string-match-p "\\." user) + (if-let ((user (magit-get user))) + (concat user "/" repo) + (user-error "Set %S or specify owner explicitly" user)) + (concat user "/" repo))))))) + ;;; _ (provide 'magit-clone) ;;; magit-clone.el ends here diff --git a/elpa/magit-20200126.1750/magit-commit.el b/elpa/magit-20200608.928/magit-commit.el similarity index 90% rename from elpa/magit-20200126.1750/magit-commit.el rename to elpa/magit-20200608.928/magit-commit.el index d7572cec..511c4227 100644 --- a/elpa/magit-20200126.1750/magit-commit.el +++ b/elpa/magit-20200608.928/magit-commit.el @@ -100,7 +100,7 @@ Also see `git-commit-post-finish-hook'." ;;; Popup ;;;###autoload (autoload 'magit-commit "magit-commit" nil t) -(define-transient-command magit-commit () +(transient-define-prefix magit-commit () "Create a new commit or replace an existing commit." :info-manual "(magit)Initiating a Commit" :man-page "git-commit" @@ -126,7 +126,7 @@ Also see `git-commit-post-finish-hook'." ("f" "Fixup" magit-commit-fixup) ("s" "Squash" magit-commit-squash) ("A" "Augment" magit-commit-augment) - (6 "x" "Absorb changes" magit-commit-absorb)] + (6 "x" "Absorb changes" magit-commit-autofixup)] ["" ("F" "Instant fixup" magit-commit-instant-fixup) ("S" "Instant squash" magit-commit-instant-squash)]] @@ -138,7 +138,7 @@ Also see `git-commit-post-finish-hook'." (defun magit-commit-arguments nil (transient-args 'magit-commit)) -(define-infix-argument magit:--gpg-sign () +(transient-define-argument magit:--gpg-sign () :description "Sign using gpg" :class 'transient-option :shortarg "-S" @@ -166,7 +166,7 @@ Also see `git-commit-post-finish-hook'." (set-text-properties 0 (length choice) nil choice) choice)) -(define-infix-argument magit-commit:--reuse-message () +(transient-define-argument magit-commit:--reuse-message () :description "Reuse commit message" :class 'transient-option :shortarg "-C" @@ -411,23 +411,63 @@ history element." (concat "--date=" date))))) ;;;###autoload (autoload 'magit-commit-absorb "magit-commit" nil t) -(define-transient-command magit-commit-absorb (phase commit args) +(transient-define-prefix magit-commit-absorb (phase commit args) + "Spread staged changes across recent commits. +With a prefix argument use a transient command to select infix +arguments. This command requires git-absorb executable, which +is available from https://github.com/tummychow/git-absorb. +See `magit-commit-autofixup' for an alternative implementation." + ["Arguments" + ("-f" "Skip safety checks" ("-f" "--force")) + ("-v" "Display more output" ("-v" "--verbose"))] + ["Actions" + ("x" "Absorb" magit-commit-absorb)] + (interactive (if current-prefix-arg + (list 'transient nil nil) + (list 'select + (magit-get-upstream-branch) + (transient-args 'magit-commit-absorb)))) + (if (eq phase 'transient) + (transient-setup 'magit-commit-absorb) + (unless (executable-find "git-absorb") + (user-error "This command requires the git-absorb executable, which %s" + "is available from https://github.com/tummychow/git-absorb")) + (unless (magit-anything-staged-p) + (if (magit-anything-unstaged-p) + (if (y-or-n-p "Nothing staged. Absorb all unstaged changes? ") + (magit-with-toplevel + (magit-run-git "add" "-u" ".")) + (user-error "Abort")) + (user-error "There are no changes that could be absorbed"))) + (when commit + (setq commit (magit-rebase-interactive-assert commit t))) + (if (and commit (eq phase 'run)) + (progn (magit-run-git-async "absorb" "-v" args "-b" commit) t) + (magit-log-select + (lambda (commit) + (with-no-warnings ; about non-interactive use + (magit-commit-absorb 'run commit args))) + nil nil nil nil commit)))) + +;;;###autoload (autoload 'magit-commit-autofixup "magit-commit" nil t) +(transient-define-prefix magit-commit-autofixup (phase commit args) "Spread unstaged changes across recent commits. With a prefix argument use a transient command to select infix arguments. This command requires the git-autofixup script, which -is available from https://github.com/torbiak/git-autofixup." +is available from https://github.com/torbiak/git-autofixup. +See `magit-commit-absorb' for an alternative implementation." ["Arguments" (magit-autofixup:--context) (magit-autofixup:--strict)] ["Actions" - ("x" "Absorb" magit-commit-absorb)] + ("x" "Absorb" magit-commit-autofixup)] (interactive (if current-prefix-arg (list 'transient nil nil) (list 'select (magit-get-upstream-branch) - (transient-args 'magit-commit-absorb)))) + (transient-args 'magit-commit-autofixup)))) (if (eq phase 'transient) - (transient-setup 'magit-commit-absorb) + (transient-setup 'magit-commit-autofixup) (unless (executable-find "git-autofixup") (user-error "This command requires the git-autofixup script, which %s" "is available from https://github.com/torbiak/git-autofixup")) @@ -442,17 +482,17 @@ is available from https://github.com/torbiak/git-autofixup." (magit-log-select (lambda (commit) (with-no-warnings ; about non-interactive use - (magit-commit-absorb 'run commit args))) + (magit-commit-autofixup 'run commit args))) nil nil nil nil commit)))) -(define-infix-argument magit-autofixup:--context () +(transient-define-argument magit-autofixup:--context () :description "Diff context lines" :class 'transient-option :shortarg "-c" :argument "--context=" :reader 'transient-read-number-N0) -(define-infix-argument magit-autofixup:--strict () +(transient-define-argument magit-autofixup:--strict () :description "Strictness" :class 'transient-option :shortarg "-s" @@ -472,7 +512,8 @@ is available from https://github.com/torbiak/git-autofixup." (let ((args (car (magit-diff-arguments))) (magit-inhibit-save-previous-winconf 'unset) (magit-display-buffer-noselect t) - (inhibit-quit nil)) + (inhibit-quit nil) + (display-buffer-overriding-action '(nil (inhibit-same-window t)))) (message "Diffing changes to be committed (C-g to abort diffing)") (cl-case last-command (magit-commit diff --git a/elpa/magit-20200126.1750/magit-core.el b/elpa/magit-20200608.928/magit-core.el similarity index 100% rename from elpa/magit-20200126.1750/magit-core.el rename to elpa/magit-20200608.928/magit-core.el diff --git a/elpa/magit-20200126.1750/magit-diff.el b/elpa/magit-20200608.928/magit-diff.el similarity index 98% rename from elpa/magit-20200126.1750/magit-diff.el rename to elpa/magit-20200608.928/magit-diff.el index 75031626..57236205 100644 --- a/elpa/magit-20200126.1750/magit-diff.el +++ b/elpa/magit-20200608.928/magit-diff.el @@ -744,7 +744,7 @@ and `:slant'." (pcase-let ((`(,args ,files) (magit-diff--get-value 'magit-diff-mode magit-prefix-use-buffer-arguments))) - (unless (eq current-transient-command 'magit-dispatch) + (unless (eq transient-current-command 'magit-dispatch) (when-let ((file (magit-file-relative-name))) (setq files (list file)))) (oset obj value (if files `(("--" ,@files) ,args) args)))) @@ -765,7 +765,7 @@ and `:slant'." (defun magit-diff-arguments (&optional mode) "Return the current diff arguments." - (if (memq current-transient-command '(magit-diff magit-diff-refresh)) + (if (memq transient-current-command '(magit-diff magit-diff-refresh)) (pcase-let ((`(,args ,alist) (-separate #'atom (transient-get-value)))) (list args (cdr (assoc "--" alist)))) @@ -783,7 +783,7 @@ and `:slant'." ((and (memq use-buffer-args '(always selected)) (when-let ((buffer (magit-get-mode-buffer mode nil - (or (eq use-buffer-args 'selected) 'all)))) + (eq use-buffer-args 'selected)))) (setq args (buffer-local-value 'magit-buffer-diff-args buffer)) (setq files (buffer-local-value 'magit-buffer-diff-files buffer)) t))) @@ -838,7 +838,7 @@ and `:slant'." ;;;; Prefix Commands ;;;###autoload (autoload 'magit-diff "magit-diff" nil t) -(define-transient-command magit-diff () +(transient-define-prefix magit-diff () "Show changes between different versions." :man-page "git-diff" :class 'magit-diff-prefix @@ -846,7 +846,8 @@ and `:slant'." (magit:--) (magit-diff:--ignore-submodules) ("-b" "Ignore whitespace changes" ("-b" "--ignore-space-change")) - ("-w" "Ignore all whitespace" ("-w" "--ignore-all-space"))] + ("-w" "Ignore all whitespace" ("-w" "--ignore-all-space")) + (5 "-D" "Omit preimage for deletes" ("-D" "--irreversible-delete"))] ["Context arguments" (magit-diff:-U) ("-W" "Show surrounding functions" ("-W" "--function-context"))] @@ -870,7 +871,7 @@ and `:slant'." ("t" "Show stash" magit-stash-show)]]) ;;;###autoload (autoload 'magit-diff-refresh "magit-diff" nil t) -(define-transient-command magit-diff-refresh () +(transient-define-prefix magit-diff-refresh () "Change the arguments used for the diff(s) in the current buffer." :man-page "git-diff" :class 'magit-diff-refresh-prefix @@ -878,7 +879,8 @@ and `:slant'." (magit:--) (magit-diff:--ignore-submodules) ("-b" "Ignore whitespace changes" ("-b" "--ignore-space-change")) - ("-w" "Ignore all whitespace" ("-w" "--ignore-all-space"))] + ("-w" "Ignore all whitespace" ("-w" "--ignore-all-space")) + (5 "-D" "Omit preimage for deletes" ("-D" "--irreversible-delete"))] ["Context arguments" (magit-diff:-U) ("-W" "Show surrounding functions" ("-W" "--function-context"))] @@ -907,7 +909,7 @@ and `:slant'." ("r" "switch range type" magit-diff-switch-range-type) ("f" "flip revisions" magit-diff-flip-revs)]] (interactive) - (if (not (eq current-transient-command 'magit-diff-refresh)) + (if (not (eq transient-current-command 'magit-diff-refresh)) (transient-setup 'magit-diff-refresh) (pcase-let ((`(,args ,files) (magit-diff-arguments))) (setq magit-buffer-diff-args args) @@ -916,7 +918,7 @@ and `:slant'." ;;;; Infix Commands -(define-infix-argument magit:-- () +(transient-define-argument magit:-- () :description "Limit to files" :class 'transient-files :key "--" @@ -930,25 +932,25 @@ and `:slant'." (magit-list-files) nil nil initial-input history)) -(define-infix-argument magit-diff:-U () +(transient-define-argument magit-diff:-U () :description "Context lines" :class 'transient-option :argument "-U" :reader 'transient-read-number-N+) -(define-infix-argument magit-diff:-M () +(transient-define-argument magit-diff:-M () :description "Detect renames" :class 'transient-option :argument "-M" :reader 'transient-read-number-N+) -(define-infix-argument magit-diff:-C () +(transient-define-argument magit-diff:-C () :description "Detect copies" :class 'transient-option :argument "-C" :reader 'transient-read-number-N+) -(define-infix-argument magit-diff:--diff-algorithm () +(transient-define-argument magit-diff:--diff-algorithm () :description "Diff algorithm" :class 'transient-option :key "-A" @@ -962,7 +964,7 @@ and `:slant'." (?p "[p]atience" "patience") (?h "[h]istogram" "histogram"))) -(define-infix-argument magit-diff:--ignore-submodules () +(transient-define-argument magit-diff:--ignore-submodules () :description "Ignore submodules" :class 'transient-option :key "-i" @@ -975,7 +977,7 @@ and `:slant'." (?d "[d]irty" "dirty") (?a "[a]ll" "all"))) -(define-infix-argument magit-diff:--color-moved () +(transient-define-argument magit-diff:--color-moved () :description "Color moved lines" :class 'transient-option :key "-m" @@ -990,7 +992,7 @@ and `:slant'." (?z "[z]ebra" "zebra") (?Z "[Z] dimmed-zebra" "dimmed-zebra"))) -(define-infix-argument magit-diff:--color-moved-ws () +(transient-define-argument magit-diff:--color-moved-ws () :description "Whitespace treatment for --color-moved" :class 'transient-option :key "=w" @@ -1266,6 +1268,7 @@ for a revision." (atpoint (or (and (bound-and-true-p magit-blame-mode) (oref (magit-current-blame-chunk) orig-rev)) mcommit + (thing-at-point 'git-revision t) (magit-branch-or-commit-at-point))) (`(,args ,files) (magit-show-commit--arguments))) (list (or (and (not current-prefix-arg) atpoint) @@ -1883,7 +1886,8 @@ Staging and applying changes is documented in info node (magit-buffer-range range) (magit-buffer-typearg typearg) (magit-buffer-diff-args args) - (magit-buffer-diff-files files))) + (magit-buffer-diff-files files) + (magit-buffer-diff-files-suspended nil))) (defun magit-diff-refresh-buffer () "Refresh the current `magit-diff-mode' buffer." @@ -1998,12 +2002,13 @@ Staging and applying changes is documented in info node ;; --ita-visible-in-index so that `magit-stage' can work with ;; intent-to-add files (see #4026). Cache the result for each ;; repo to avoid a `git version' call for every diff insertion. - (when (pcase (magit-repository-local-get 'diff-ita-kludge-p 'unset) - (`unset - (let ((val (version<= "2.19.0" (magit-git-version)))) - (magit-repository-local-set 'diff-ita-kludge-p val) - val)) - (val val)) + (when (and (not (equal (car args) "merge-tree")) + (pcase (magit-repository-local-get 'diff-ita-kludge-p 'unset) + (`unset + (let ((val (version<= "2.19.0" (magit-git-version)))) + (magit-repository-local-set 'diff-ita-kludge-p val) + val)) + (val val))) (push "--ita-visible-in-index" (cdr args))) (when (cl-member-if (lambda (arg) (string-prefix-p "--color-moved" arg)) args) (push "--color=always" (cdr args)) @@ -2013,6 +2018,7 @@ Staging and applying changes is documented in info node (magit-git-wash #'magit-diff-wash-diffs args))) (defun magit-diff-wash-diffs (args &optional limit) + (run-hooks 'magit-diff-wash-diffs-hook) (when (member "--show-signature" args) (magit-diff-wash-signature)) (when (member "--stat" args) @@ -2331,7 +2337,8 @@ Staging and applying changes is documented in info node (magit-buffer-revision rev) (magit-buffer-range (format "%s^..%s" rev rev)) (magit-buffer-diff-args args) - (magit-buffer-diff-files files))) + (magit-buffer-diff-files files) + (magit-buffer-diff-files-suspended nil))) (defun magit-revision-refresh-buffer () (magit-set-header-line-format diff --git a/elpa/magit-20200126.1750/magit-ediff.el b/elpa/magit-20200608.928/magit-ediff.el similarity index 99% rename from elpa/magit-20200126.1750/magit-ediff.el rename to elpa/magit-20200608.928/magit-ediff.el index 058dd882..f7e21932 100644 --- a/elpa/magit-20200126.1750/magit-ediff.el +++ b/elpa/magit-20200608.928/magit-ediff.el @@ -104,7 +104,7 @@ tree at the time of stashing." (defvar magit-ediff-previous-winconf nil) ;;;###autoload (autoload 'magit-ediff "magit-ediff" nil) -(define-transient-command magit-ediff () +(transient-define-prefix magit-ediff () "Show differences using the Ediff package." :info-manual "(ediff)" ["Ediff" diff --git a/elpa/magit-20200126.1750/magit-extras.el b/elpa/magit-20200608.928/magit-extras.el similarity index 89% rename from elpa/magit-20200126.1750/magit-extras.el rename to elpa/magit-20200608.928/magit-extras.el index fe47d290..39366922 100644 --- a/elpa/magit-20200126.1750/magit-extras.el +++ b/elpa/magit-20200608.928/magit-extras.el @@ -260,7 +260,11 @@ a position in a file-visiting buffer." (prompt-for-change-log-name))) (pcase-let ((`(,buf ,pos) (magit-diff-visit-file--noselect))) (magit--with-temp-position buf pos - (add-change-log-entry whoami file-name other-window)))) + (let ((add-log-buffer-file-name-function + (lambda () + (or magit-buffer-file-name + (buffer-file-name))))) + (add-change-log-entry whoami file-name other-window))))) ;;;###autoload (defun magit-add-change-log-entry-other-window (&optional whoami file-name) @@ -344,6 +348,13 @@ use `magit-rebase-edit-command' instead of this command." ;;; Reshelve +(defcustom magit-reshelve-since-committer-only nil + "Whether `magit-reshelve-since' changes only the committer dates. +Otherwise the author dates are also changed." + :package-version '(magit . "3.0.0") + :group 'magit-commands + :type 'boolean) + ;;;###autoload (defun magit-reshelve-since (rev) "Change the author and committer dates of the commits since REV. @@ -357,51 +368,57 @@ on. This command is only intended for interactive use and should only be used on highly rearranged and unpublished history." (interactive (list nil)) - (cond - ((not rev) - (let ((backup (concat "refs/original/refs/heads/" - (magit-get-current-branch)))) + (let* ((current (or (magit-get-current-branch) + (user-error "Refusing to reshelve detached head"))) + (backup (concat "refs/original/refs/heads/" current))) + (cond + ((not rev) (when (and (magit-ref-p backup) (not (magit-y-or-n-p - "Backup ref %s already exists. Override? " backup))) - (user-error "Abort"))) - (magit-log-select 'magit-reshelve-since - "Type %p on a commit to reshelve it and the commits above it,")) - (t - (cl-flet ((adjust (time offset) - (format-time-string - "%F %T %z" - (+ (floor time) - (* offset 60) - (- (car (decode-time time))))))) - (let* ((start (concat rev "^")) - (range (concat start ".." (magit-get-current-branch))) - (time-rev (adjust (float-time (string-to-number - (magit-rev-format "%at" start))) - 1)) - (time-now (adjust (float-time) - (- (string-to-number - (magit-git-string "rev-list" "--count" - range)))))) - (push time-rev magit--reshelve-history) - (let ((date (floor - (float-time - (date-to-time - (read-string "Date for first commit: " - time-now 'magit--reshelve-history)))))) - (magit-with-toplevel - (magit-run-git-async - "filter-branch" "--force" "--env-filter" - (format "case $GIT_COMMIT in %s\nesac" - (mapconcat (lambda (rev) - (prog1 (format "%s) \ -export GIT_AUTHOR_DATE=\"%s\"; \ -export GIT_COMMITTER_DATE=\"%s\";;" rev date date) - (cl-incf date 60))) - (magit-git-lines "rev-list" "--reverse" - range) - " ")) - range "--") + (format "Backup ref %s already exists. Override? " backup)))) + (user-error "Abort")) + (magit-log-select 'magit-reshelve-since + "Type %p on a commit to reshelve it and the commits above it,")) + (t + (cl-flet ((adjust (time offset) + (format-time-string + "%F %T %z" + (+ (floor time) + (* offset 60) + (- (car (decode-time time))))))) + (let* ((start (concat rev "^")) + (range (concat start ".." current)) + (time-rev (adjust (float-time (string-to-number + (magit-rev-format "%at" start))) + 1)) + (time-now (adjust (float-time) + (- (string-to-number + (magit-git-string "rev-list" "--count" + range)))))) + (push time-rev magit--reshelve-history) + (let ((date (floor + (float-time + (date-to-time + (read-string "Date for first commit: " + time-now 'magit--reshelve-history))))) + (process-environment process-environment)) + (push "FILTER_BRANCH_SQUELCH_WARNING=1" process-environment) + (magit-with-toplevel + (magit-run-git-async + "filter-branch" "--force" "--env-filter" + (format + "case $GIT_COMMIT in %s\nesac" + (mapconcat + (lambda (rev) + (prog1 (concat + (format "%s) " rev) + (and (not magit-reshelve-since-committer-only) + (format "export GIT_AUTHOR_DATE=\"%s\"; " date)) + (format "export GIT_COMMITTER_DATE=\"%s\";;" date)) + (cl-incf date 60))) + (magit-git-lines "rev-list" "--reverse" range) + " ")) + range "--")) (set-process-sentinel magit-this-process (lambda (process event) @@ -410,9 +427,7 @@ export GIT_COMMITTER_DATE=\"%s\";;" rev date date) (magit-process-sentinel process event) (process-put process 'inhibit-refresh t) (magit-process-sentinel process event) - (magit-run-git "update-ref" "-d" - (concat "refs/original/refs/heads/" - (magit-get-current-branch)))))))))))))) + (magit-run-git "update-ref" "-d" backup)))))))))))) ;;; Revision Stack @@ -575,11 +590,11 @@ hunk, strip the outer diff marker column." ((and current-prefix-arg (magit-section-internal-region-p) (magit-section-match 'hunk)) - (deactivate-mark) (kill-new (replace-regexp-in-string "^[ \\+\\-]" "" (buffer-substring-no-properties - (region-beginning) (region-end))))) + (region-beginning) (region-end)))) + (deactivate-mark)) ((use-region-p) (call-interactively #'copy-region-as-kill)) (t diff --git a/elpa/magit-20200126.1750/magit-fetch.el b/elpa/magit-20200608.928/magit-fetch.el similarity index 97% rename from elpa/magit-20200126.1750/magit-fetch.el rename to elpa/magit-20200608.928/magit-fetch.el index a3a0cc65..b8fed371 100644 --- a/elpa/magit-20200126.1750/magit-fetch.el +++ b/elpa/magit-20200608.928/magit-fetch.el @@ -41,7 +41,7 @@ Ignored for Git versions before v2.8.0." ;;; Commands ;;;###autoload (autoload 'magit-fetch "magit-fetch" nil t) -(define-transient-command magit-fetch () +(transient-define-prefix magit-fetch () "Fetch from another repository." :man-page "git-fetch" ["Arguments" @@ -67,7 +67,7 @@ Ignored for Git versions before v2.8.0." (magit-run-git-async "fetch" remote args)) ;;;###autoload (autoload 'magit-fetch-from-pushremote "magit-fetch" nil t) -(define-suffix-command magit-fetch-from-pushremote (args) +(transient-define-suffix magit-fetch-from-pushremote (args) "Fetch from the current push-remote. With a prefix argument or when the push-remote is either not @@ -96,7 +96,7 @@ push-remote." (format "%s, setting that" v))))) ;;;###autoload (autoload 'magit-fetch-from-upstream "magit-fetch" nil t) -(define-suffix-command magit-fetch-from-upstream (remote args) +(transient-define-suffix magit-fetch-from-upstream (remote args) "Fetch from the \"current\" remote, usually the upstream. If the upstream is configured for the current branch and names diff --git a/elpa/magit-20200126.1750/magit-files.el b/elpa/magit-20200608.928/magit-files.el similarity index 99% rename from elpa/magit-20200126.1750/magit-files.el rename to elpa/magit-20200608.928/magit-files.el index 3f0758d2..3ba31a9c 100644 --- a/elpa/magit-20200126.1750/magit-files.el +++ b/elpa/magit-20200608.928/magit-files.el @@ -290,7 +290,7 @@ directory, while reading the FILENAME." "Keymap for `magit-file-mode'.") ;;;###autoload (autoload 'magit-file-dispatch "magit" nil t) -(define-transient-command magit-file-dispatch () +(transient-define-prefix magit-file-dispatch () "Invoke a Magit command that acts on the visited file." :info-manual "(magit) Minor Mode for Buffers Visiting Files" ["Actions" diff --git a/elpa/magit-20200126.1750/magit-git.el b/elpa/magit-20200608.928/magit-git.el similarity index 98% rename from elpa/magit-20200126.1750/magit-git.el rename to elpa/magit-20200608.928/magit-git.el index ebd56103..6ee11b11 100644 --- a/elpa/magit-20200126.1750/magit-git.el +++ b/elpa/magit-20200608.928/magit-git.el @@ -133,7 +133,7 @@ successfully.") (defcustom magit-git-executable ;; Git might be installed in a different location on a remote, so ;; it is better not to use the full path to the executable, except - ;; on Window were we would otherwise end up using one one of the + ;; on Window where we would otherwise end up using one of the ;; wrappers "cmd/git.exe" or "cmd/git.cmd", which are much slower ;; than using "bin/git.exe" directly. (or (and (eq system-type 'windows-nt) @@ -169,8 +169,11 @@ successfully.") :type 'string) (defcustom magit-git-global-arguments - `("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" + `("--no-pager" "--literal-pathspecs" + "-c" "core.preloadindex=true" "-c" "log.showSignature=false" + "-c" "color.ui=false" + "-c" "color.diff=false" ,@(and (eq system-type 'windows-nt) (list "-c" "i18n.logOutputEncoding=UTF-8"))) "Global Git arguments. @@ -743,7 +746,7 @@ returning the truename." (signal 'magit-outside-git-repo default-directory) (signal 'magit-git-executable-not-found magit-git-executable))) -(defun magit-inside-gitdir-p (&optioal noerror) +(defun magit-inside-gitdir-p (&optional noerror) "Return t if `default-directory' is below the repository directory. If it is below the working directory, then return nil. If it isn't below either, then signal an error unless NOERROR @@ -1600,7 +1603,7 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (magit-list-related-branches "--contains" commit args)) (defun magit-list-publishing-branches (&optional commit) - (--filter (magit-rev-ancestor-p commit it) + (--filter (magit-rev-ancestor-p (or commit "HEAD") it) magit-published-branches)) (defun magit-list-merged-branches (&optional commit &rest args) @@ -1775,15 +1778,26 @@ Return a list of two integers: (A>B B>A)." "\t"))) (defun magit-abbrev-length () - (--if-let (magit-get "core.abbrev") - (string-to-number it) - ;; Guess the length git will be using based on an example - ;; abbreviation. Actually HEAD's abbreviation might be an - ;; outlier, so use the shorter of the abbreviations for two - ;; commits. When a commit does not exist, then fall back - ;; to the default of 7. See #3034. - (min (--if-let (magit-rev-parse "--short" "HEAD") (length it) 7) - (--if-let (magit-rev-parse "--short" "HEAD~") (length it) 7)))) + (let ((abbrev (magit-get "core.abbrev"))) + (if (and abbrev (not (equal abbrev "auto"))) + (string-to-number abbrev) + ;; Guess the length git will be using based on an example + ;; abbreviation. Actually HEAD's abbreviation might be an + ;; outlier, so use the shorter of the abbreviations for two + ;; commits. See #3034. + (if-let ((head (magit-rev-parse "--short" "HEAD")) + (head-len (length head))) + (min head-len + (--if-let (magit-rev-parse "--short" "HEAD~") + (length it) + head-len)) + ;; We're on an unborn branch, but perhaps the repository has + ;; other commits. See #4123. + (if-let ((commits (magit-git-lines "rev-list" "-n2" "--all" + "--abbrev-commit"))) + (apply #'min (mapcar #'length commits)) + ;; A commit does not exist. Fall back to the default of 7. + 7))))) (defun magit-abbrev-arg (&optional arg) (format "--%s=%d" (or arg "abbrev") (magit-abbrev-length))) @@ -2051,9 +2065,10 @@ and this option only controls what face is used.") (--when-let (let ((c "\s\n\t~^:?*[\\")) (cl-letf (((get 'git-revision 'beginning-op) - (if (re-search-backward (format "[%s]" c) nil t) - (forward-char) - (goto-char (point-min)))) + (lambda () + (if (re-search-backward (format "[%s]" c) nil t) + (forward-char) + (goto-char (point-min))))) ((get 'git-revision 'end-op) (lambda () (re-search-forward (format "\\=[^%s]*" c) nil t)))) diff --git a/elpa/magit-20200126.1750/magit-gitignore.el b/elpa/magit-20200608.928/magit-gitignore.el similarity index 99% rename from elpa/magit-20200126.1750/magit-gitignore.el rename to elpa/magit-20200608.928/magit-gitignore.el index ad1ac91d..6004413d 100644 --- a/elpa/magit-20200126.1750/magit-gitignore.el +++ b/elpa/magit-20200608.928/magit-gitignore.el @@ -35,7 +35,7 @@ ;;; Transient ;;;###autoload (autoload 'magit-gitignore "magit-gitignore" nil t) -(define-transient-command magit-gitignore () +(transient-define-prefix magit-gitignore () "Instruct Git to ignore a file or pattern." :man-page "gitignore" ["Gitignore" diff --git a/elpa/magit-20200126.1750/magit-imenu.el b/elpa/magit-20200608.928/magit-imenu.el similarity index 100% rename from elpa/magit-20200126.1750/magit-imenu.el rename to elpa/magit-20200608.928/magit-imenu.el diff --git a/elpa/magit-20200126.1750/magit-log.el b/elpa/magit-20200608.928/magit-log.el similarity index 97% rename from elpa/magit-20200126.1750/magit-log.el rename to elpa/magit-20200608.928/magit-log.el index 39b8fe9b..6450dfde 100644 --- a/elpa/magit-20200126.1750/magit-log.el +++ b/elpa/magit-20200608.928/magit-log.el @@ -318,7 +318,7 @@ the upstream isn't ahead of the current branch) show." (pcase-let ((`(,args ,files) (magit-log--get-value 'magit-log-mode magit-prefix-use-buffer-arguments))) - (unless (eq current-transient-command 'magit-dispatch) + (unless (eq transient-current-command 'magit-dispatch) (when-let ((file (magit-file-relative-name))) (setq files (list file)))) (oset obj value (if files `(("--" ,@files) ,args) args)))) @@ -339,7 +339,7 @@ the upstream isn't ahead of the current branch) show." (defun magit-log-arguments (&optional mode) "Return the current log arguments." - (if (memq current-transient-command '(magit-log magit-log-refresh)) + (if (memq transient-current-command '(magit-log magit-log-refresh)) (pcase-let ((`(,args ,alist) (-separate #'atom (transient-get-value)))) (list args (cdr (assoc "--" alist)))) @@ -357,7 +357,7 @@ the upstream isn't ahead of the current branch) show." ((and (memq use-buffer-args '(always selected)) (when-let ((buffer (magit-get-mode-buffer mode nil - (or (eq use-buffer-args 'selected) 'all)))) + (eq use-buffer-args 'selected)))) (setq args (buffer-local-value 'magit-buffer-log-args buffer)) (setq files (buffer-local-value 'magit-buffer-log-files buffer)) t))) @@ -392,7 +392,7 @@ the upstream isn't ahead of the current branch) show." ;;;; Prefix Commands ;;;###autoload (autoload 'magit-log "magit-log" nil t) -(define-transient-command magit-log () +(transient-define-prefix magit-log () "Show a commit or reference log." :man-page "git-log" :class 'magit-log-prefix @@ -450,13 +450,13 @@ the upstream isn't ahead of the current branch) show." ("r" "current" magit-reflog-current) ("O" "other" magit-reflog-other) ("H" "HEAD" magit-reflog-head)] - [:if-non-nil magit-wip-mode + [:if magit--any-wip-mode-enabled-p :description "Wiplog" ("i" "index" magit-wip-log-index) ("w" "worktree" magit-wip-log-worktree)]]) ;;;###autoload (autoload 'magit-log-refresh "magit-log" nil t) -(define-transient-command magit-log-refresh () +(transient-define-prefix magit-log-refresh () "Change the arguments used for the log(s) in the current buffer." :man-page "git-log" :class 'magit-log-refresh-prefix @@ -511,7 +511,7 @@ the upstream isn't ahead of the current branch) show." ("b" "buffer lock" magit-toggle-buffer-lock)]] (interactive) (cond - ((not (eq current-transient-command 'magit-log-refresh)) + ((not (eq transient-current-command 'magit-log-refresh)) (pcase major-mode (`magit-reflog-mode (user-error "Cannot change log arguments in reflog buffers")) @@ -527,7 +527,7 @@ the upstream isn't ahead of the current branch) show." ;;;; Infix Commands -(define-infix-argument magit-log:-n () +(transient-define-argument magit-log:-n () :description "Limit number of commits" :class 'transient-option ;; For historic reasons (and because it easy to guess what "-n" @@ -537,14 +537,14 @@ the upstream isn't ahead of the current branch) show." :argument "-n" :reader 'transient-read-number-N+) -(define-infix-argument magit:--author () +(transient-define-argument magit:--author () :description "Limit to author" :class 'transient-option :key "-A" :argument "--author=" :reader 'magit-transient-read-person) -(define-infix-argument magit-log:--*-order () +(transient-define-argument magit-log:--*-order () :description "Order commits by" :class 'transient-switches :key "-o" @@ -552,23 +552,23 @@ the upstream isn't ahead of the current branch) show." :argument-regexp "\\(--\\(topo\\|author-date\\|date\\)-order\\)" :choices '("topo" "author-date" "date")) -(define-infix-argument magit-log:--grep () +(transient-define-argument magit-log:--grep () :description "Search messages" :class 'transient-option :key "-F" :argument "--grep=") -(define-infix-argument magit-log:-G () +(transient-define-argument magit-log:-G () :description "Search changes" :class 'transient-option :argument "-G") -(define-infix-argument magit-log:-S () +(transient-define-argument magit-log:-S () :description "Search occurrences" :class 'transient-option :argument "-S") -(define-infix-argument magit-log:-L () +(transient-define-argument magit-log:-L () :description "Trace line evolution" :class 'transient-option :argument "-L" @@ -719,7 +719,8 @@ restrict the log to the lines that the region touches." "Show log for the definition at point." (interactive (list (or (magit-file-relative-name) (user-error "Buffer isn't visiting a file")) - (funcall magit-log-trace-definition-function) + (or (funcall magit-log-trace-definition-function) + (user-error "No function at point found")) (or magit-buffer-refname (magit-get-current-branch) "HEAD"))) @@ -727,7 +728,7 @@ restrict the log to the lines that the region touches." (magit-log-setup-buffer (list rev) (cons (format "-L:%s%s:%s" - (regexp-quote fn) + (replace-regexp-in-string ":" "\\:" (regexp-quote fn) nil t) (if (derived-mode-p 'lisp-mode 'emacs-lisp-mode) ;; Git doesn't treat "-" the same way as ;; "_", leading to false-positives such as @@ -938,9 +939,10 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (unless (magit-file-tracked-p (car files)) (setq args (cons "--full-history" args))) (setq args (remove "--follow" args))) - (when (--any-p (string-match-p - (concat "^" (regexp-opt magit-log-remove-graph-args)) it) - args) + (when (and (car magit-log-remove-graph-args) + (--any-p (string-match-p + (concat "^" (regexp-opt magit-log-remove-graph-args)) it) + args)) (setq args (remove "--graph" args))) (unless (member "--graph" args) (setq args (remove "--color" args))) @@ -997,7 +999,7 @@ Do not add this to a hook variable." (remove "--literal-pathspecs" magit-git-global-arguments))) (magit-git-wash (apply-partially #'magit-log-wash-log 'log) "log" - (format "--format=%s%%h%%x00%s%%x00%s%%x00%%aN%%x00%s%%x00%%s%s" + (format "--format=%s%%h%%x0c%s%%x0c%s%%x0c%%aN%%x0c%s%%x0c%%s%s" (if (and (member "--left-right" args) (not (member "--graph" args))) "%m " @@ -1037,15 +1039,18 @@ Do not add this to a hook variable." "Keymap for `module-commit' sections.") (defconst magit-log-heading-re + ;; Note: A form feed instead of a null byte is used as the delimiter + ;; because using the latter interferes with the graph prefix when + ;; ++header is used. (concat "^" "\\(?4:[-_/|\\*o<>. ]*\\)" ; graph - "\\(?1:[0-9a-fA-F]+\\)?\0" ; sha1 - "\\(?3:[^\0\n]+\\)?\0" ; refs - "\\(?7:[BGUXYREN]\\)?\0" ; gpg - "\\(?5:[^\0\n]*\\)\0" ; author + "\\(?1:[0-9a-fA-F]+\\)? " ; sha1 + "\\(?3:[^ \n]+\\)? " ; refs + "\\(?7:[BGUXYREN]\\)? " ; gpg + "\\(?5:[^ \n]*\\) " ; author ;; Note: Date is optional because, prior to Git v2.19.0, ;; `git rebase -i --root` corrupts the root's author date. - "\\(?6:[^\0\n]*\\)\0" ; date + "\\(?6:[^ \n]*\\) " ; date "\\(?2:.*\\)$")) ; msg (defconst magit-log-cherry-re @@ -1109,6 +1114,8 @@ Do not add this to a hook variable." (when (eq style 'cherry) (reverse-region (point-min) (point-max))) (let ((magit-log-count 0)) + (when (looking-at "^\\.\\.\\.") + (magit-delete-line)) (magit-wash-sequence (apply-partially 'magit-log-wash-rev style (magit-abbrev-length))) (if (derived-mode-p 'magit-log-mode 'magit-reflog-mode) @@ -1256,7 +1263,7 @@ Do not add this to a hook variable." (forward-line -1) (looking-at "[-_/|\\*o<>. ]*")) (setq graph (match-string 0)) - (unless (string-match-p "[/\\]" graph) + (unless (string-match-p "[/\\.]" graph) (insert graph ?\n)))))))) t) diff --git a/elpa/magit-20200126.1750/magit-margin.el b/elpa/magit-20200608.928/magit-margin.el similarity index 99% rename from elpa/magit-20200126.1750/magit-margin.el rename to elpa/magit-20200608.928/magit-margin.el index af85389c..bd411b71 100644 --- a/elpa/magit-20200126.1750/magit-margin.el +++ b/elpa/magit-20200608.928/magit-margin.el @@ -62,7 +62,7 @@ does not carry to other options." ;;; Commands -(define-transient-command magit-margin-settings () +(transient-define-prefix magit-margin-settings () "Change what information is displayed in the margin." :info-manual "(magit) Log Margin" ["Margin" diff --git a/elpa/magit-20200126.1750/magit-merge.el b/elpa/magit-20200608.928/magit-merge.el similarity index 95% rename from elpa/magit-20200126.1750/magit-merge.el rename to elpa/magit-20200608.928/magit-merge.el index 18de7a57..35d80bc4 100644 --- a/elpa/magit-20200126.1750/magit-merge.el +++ b/elpa/magit-20200608.928/magit-merge.el @@ -38,7 +38,7 @@ ;;; Commands ;;;###autoload (autoload 'magit-merge "magit" nil t) -(define-transient-command magit-merge () +(transient-define-prefix magit-merge () "Merge branches." :man-page "git-merge" :incompatible '(("--ff-only" "--no-ff")) @@ -67,12 +67,12 @@ (defun magit-merge-arguments () (transient-args 'magit-merge)) -(define-infix-argument magit-merge:--strategy () +(transient-define-argument magit-merge:--strategy () :description "Strategy" :class 'transient-option - ;; key for merge: "-s" + ;; key for merge and rebase: "-s" ;; key for cherry-pick and revert: "=s" - ;; shortarg for merge: "-s" + ;; shortarg for merge and rebase: "-s" ;; shortarg for cherry-pick and revert: none :key "-s" :argument "--strategy=" @@ -133,15 +133,20 @@ if `forge-branch-pullreq' was used to create the merged branch, branch, then also remove the respective remote branch." (interactive (list (magit-read-other-local-branch - (format "Merge `%s' into" (magit-get-current-branch)) + (format "Merge `%s' into" + (or (magit-get-current-branch) + (magit-rev-parse "HEAD"))) nil (when-let ((upstream (magit-get-upstream-branch)) (upstream (cdr (magit-split-branch-name upstream)))) (and (magit-branch-p upstream) upstream))) (magit-merge-arguments))) - (let ((current (magit-get-current-branch))) + (let ((current (magit-get-current-branch)) + (head (magit-rev-parse "HEAD"))) (when (zerop (magit-call-git "checkout" branch)) - (magit--merge-absorb current args)))) + (if current + (magit--merge-absorb current args) + (magit-run-git-with-editor "merge" args head))))) ;;;###autoload (defun magit-merge-absorb (branch &optional args) @@ -180,7 +185,7 @@ then also remove the respective remote branch." (if-let ((pr (magit-get "branch" branch "pullRequest"))) (magit-run-git-async "merge" args "-m" - (format "Merge branch '%s'%s [%s]" + (format "Merge branch '%s'%s [#%s]" branch (let ((current (magit-get-current-branch))) (if (equal current "master") "" (format " into %s" current))) diff --git a/elpa/magit-20200126.1750/magit-mode.el b/elpa/magit-20200608.928/magit-mode.el similarity index 98% rename from elpa/magit-20200126.1750/magit-mode.el rename to elpa/magit-20200608.928/magit-mode.el index 6c8b4a76..db9c0af4 100644 --- a/elpa/magit-20200126.1750/magit-mode.el +++ b/elpa/magit-20200608.928/magit-mode.el @@ -222,7 +222,7 @@ Valid values are: `always': Always use the set of arguments that is currently active in the respective buffer, provided that buffer exists of course. -`selected' or t: Use the set of arguments from the respective +`selected': Use the set of arguments from the respective buffer, but only if it is displayed in a window of the current frame. This is the default. `current': Use the set of arguments from the respective buffer, @@ -235,9 +235,11 @@ and Buffer Arguments'." :package-version '(magit . "3.0.0") :group 'magit-buffers :group 'magit-commands - :type '(choice (const :tag "always use args from buffer" always) - (const :tag "use args from buffer if it is current" current) - (const :tag "never use args from buffer" never))) + :type '(choice + (const :tag "always use args from buffer" always) + (const :tag "use args from buffer if displayed in frame" selected) + (const :tag "use args from buffer if it is current" current) + (const :tag "never use args from buffer" never))) (defcustom magit-direct-use-buffer-arguments 'selected "Whether certain commands reuse arguments active in relevant buffer. @@ -251,7 +253,7 @@ Valid values are: `always': Always use the set of arguments that is currently active in the respective buffer, provided that buffer exists of course. -`selected' or t: Use the set of arguments from the respective +`selected': Use the set of arguments from the respective buffer, but only if it is displayed in a window of the current frame. This is the default. `current': Use the set of arguments from the respective buffer, @@ -264,9 +266,11 @@ and Buffer Arguments'." :package-version '(magit . "3.0.0") :group 'magit-buffers :group 'magit-commands - :type '(choice (const :tag "always use args from buffer" always) - (const :tag "use args from buffer if it is current" current) - (const :tag "never use args from buffer" never))) + :type '(choice + (const :tag "always use args from buffer" always) + (const :tag "use args from buffer if displayed in frame" selected) + (const :tag "use args from buffer if it is current" current) + (const :tag "never use args from buffer" never))) (defcustom magit-region-highlight-hook '(magit-diff-update-hunk-region) "Functions used to highlight the region. @@ -343,6 +347,7 @@ recommended value." (define-key map (kbd "i") 'magit-gitignore) (define-key map (kbd "I") 'magit-gitignore) (define-key map (kbd "SPC") 'magit-diff-show-or-scroll-up) + (define-key map (kbd "S-SPC") 'magit-diff-show-or-scroll-down) (define-key map (kbd "DEL") 'magit-diff-show-or-scroll-down) (define-key map "+" 'magit-diff-more-context) (define-key map "-" 'magit-diff-less-context) @@ -419,7 +424,7 @@ which deletes the thing at point." Where applicable, section-specific keymaps bind another command which visits the thing at point." (interactive) - (if (eq current-transient-command 'magit-dispatch) + (if (eq transient-current-command 'magit-dispatch) (call-interactively (key-binding (this-command-keys))) (user-error "There is no thing at point that could be visited"))) @@ -428,7 +433,7 @@ which visits the thing at point." Where applicable, section-specific keymaps bind another command which lets you edit the thing at point, likely in another buffer." (interactive) - (if (eq current-transient-command 'magit-dispatch) + (if (eq transient-current-command 'magit-dispatch) (call-interactively (key-binding (this-command-keys))) (user-error "There is no thing at point that could be edited"))) @@ -541,6 +546,10 @@ Magit is documented in info node `(magit)'." (put 'magit-buffer-revision 'permanent-local t) (put 'magit-buffer-revision-hash 'permanent-local t) +;; `magit-status' re-enables mode function but its refresher +;; function does not reinstate this. +(put 'magit-buffer-diff-files-suspended 'permanent-local t) + (defvar-local magit-refresh-args nil "Obsolete. Possibly the arguments used to refresh the current buffer. Some third-party packages might still use this, but Magit does not.") @@ -686,7 +695,7 @@ other buffers in the selected window." (display-buffer buffer (if (with-current-buffer buffer (derived-mode-p 'magit-diff-mode 'magit-process-mode)) - nil ; display in another window + '(nil (inhibit-same-window . t)) '(display-buffer-same-window)))) (defun magit--display-buffer-fullframe (buffer alist) diff --git a/elpa/magit-20200126.1750/magit-notes.el b/elpa/magit-20200608.928/magit-notes.el similarity index 94% rename from elpa/magit-20200126.1750/magit-notes.el rename to elpa/magit-20200608.928/magit-notes.el index 99196089..99566254 100644 --- a/elpa/magit-20200126.1750/magit-notes.el +++ b/elpa/magit-20200608.928/magit-notes.el @@ -32,7 +32,7 @@ ;;; Commands ;;;###autoload (autoload 'magit-notes "magit" nil t) -(define-transient-command magit-notes () +(transient-define-prefix magit-notes () "Edit notes attached to commits." :man-page "git-notes" ["Configure local settings" @@ -66,40 +66,40 @@ (and (file-directory-p dir) (directory-files dir nil "^[^.]")))) -(define-infix-command magit-core.notesRef () +(transient-define-infix magit-core.notesRef () :class 'magit--git-variable :variable "core.notesRef" :reader 'magit-notes-read-ref :prompt "Set local core.notesRef") -(define-infix-command magit-notes.displayRef () +(transient-define-infix magit-notes.displayRef () :class 'magit--git-variable :variable "notes.displayRef" :multi-value t :reader 'magit-notes-read-refs :prompt "Set local notes.displayRef") -(define-infix-command magit-global-core.notesRef () +(transient-define-infix magit-global-core.notesRef () :class 'magit--git-variable :variable "core.notesRef" :reader 'magit-notes-read-ref :prompt "Set global core.notesRef") -(define-infix-command magit-global-notes.displayRef () +(transient-define-infix magit-global-notes.displayRef () :class 'magit--git-variable :variable "notes.displayRef" :multi-value t :reader 'magit-notes-read-refs :prompt "Set global notes.displayRef") -(define-infix-argument magit-notes:--ref () +(transient-define-argument magit-notes:--ref () :description "Merge strategy" :class 'transient-option :key "-r" :argument "--ref=" :reader 'magit-notes-read-ref) -(define-infix-argument magit-notes:--strategy () +(transient-define-argument magit-notes:--strategy () :description "Merge strategy" :class 'transient-option :shortarg "-s" diff --git a/elpa/magit-20200126.1750/magit-obsolete.el b/elpa/magit-20200608.928/magit-obsolete.el similarity index 100% rename from elpa/magit-20200126.1750/magit-obsolete.el rename to elpa/magit-20200608.928/magit-obsolete.el diff --git a/elpa/magit-20200126.1750/magit-patch.el b/elpa/magit-20200608.928/magit-patch.el similarity index 73% rename from elpa/magit-20200126.1750/magit-patch.el rename to elpa/magit-20200608.928/magit-patch.el index 713a2d6a..3a63f221 100644 --- a/elpa/magit-20200126.1750/magit-patch.el +++ b/elpa/magit-20200608.928/magit-patch.el @@ -55,7 +55,7 @@ the prefix argument." ;;; Commands ;;;###autoload (autoload 'magit-patch "magit-patch" nil t) -(define-transient-command magit-patch () +(transient-define-prefix magit-patch () "Create or apply patches." ["Actions" ("c" "Create patches" magit-patch-create) @@ -64,22 +64,30 @@ the prefix argument." ("r" "Request pull" magit-request-pull)]) ;;;###autoload (autoload 'magit-patch-create "magit-patch" nil t) -(define-transient-command magit-patch-create (range args files) +(transient-define-prefix magit-patch-create (range args files) "Create patches for the commits in RANGE. When a single commit is given for RANGE, create a patch for the changes introduced by that commit (unlike 'git format-patch' which creates patches for all commits that are reachable from `HEAD' but not from the specified commit)." :man-page "git-format-patch" + :incompatible '(("--subject-prefix=" "--rfc")) ["Mail arguments" - (magit-format-patch:--in-reply-to) - (magit-format-patch:--thread) + (6 magit-format-patch:--in-reply-to) + (6 magit-format-patch:--thread) + (6 magit-format-patch:--from) + (6 magit-format-patch:--to) + (6 magit-format-patch:--cc)] + ["Patch arguments" + (magit-format-patch:--base) (magit-format-patch:--reroll-count) + (5 magit-format-patch:--interdiff) + (magit-format-patch:--range-diff) (magit-format-patch:--subject-prefix) + ("C-m r " "RFC subject prefix" "--rfc") ("C-m l " "Add cover letter" "--cover-letter") - (magit-format-patch:--from) - (magit-format-patch:--to) - (magit-format-patch:--cc) + (5 magit-format-patch:--cover-from-description) + (5 magit-format-patch:--notes) (magit-format-patch:--output-directory)] ["Diff arguments" (magit-diff:-U) @@ -92,7 +100,7 @@ which creates patches for all commits that are reachable from ["Actions" ("c" "Create patches" magit-patch-create)] (interactive - (if (not (eq current-transient-command 'magit-patch-create)) + (if (not (eq transient-current-command 'magit-patch-create)) (list nil nil nil) (cons (if-let ((revs (magit-region-values 'commit t))) (concat (car (last revs)) "^.." (car revs)) @@ -121,19 +129,37 @@ which creates patches for all commits that are reachable from args) topdir)))))))) -(define-infix-argument magit-format-patch:--in-reply-to () +(transient-define-argument magit-format-patch:--in-reply-to () :description "In reply to" :class 'transient-option - :key "C-m r " + :key "C-m C-r" :argument "--in-reply-to=") -(define-infix-argument magit-format-patch:--thread () +(transient-define-argument magit-format-patch:--thread () :description "Thread style" :class 'transient-option :key "C-m s " - :argument "--thread=") + :argument "--thread=" + :reader #'magit-format-patch-select-thread-style) -(define-infix-argument magit-format-patch:--reroll-count () +(defun magit-format-patch-select-thread-style (&rest _ignore) + (magit-read-char-case "Thread style " t + (?d "[d]eep" "deep") + (?s "[s]hallow" "shallow"))) + +(transient-define-argument magit-format-patch:--base () + :description "Insert base commit" + :class 'transient-option + :key "C-m b " + :argument "--base=" + :reader #'magit-format-patch-select-base) + +(defun magit-format-patch-select-base (prompt initial-input history) + (or (magit-completing-read prompt (cons "auto" (magit-list-refnames)) + nil nil initial-input history "auto") + (user-error "Nothing selected"))) + +(transient-define-argument magit-format-patch:--reroll-count () :description "Reroll count" :class 'transient-option :key "C-m v " @@ -141,34 +167,72 @@ which creates patches for all commits that are reachable from :argument "--reroll-count=" :reader 'transient-read-number-N+) -(define-infix-argument magit-format-patch:--subject-prefix () +(transient-define-argument magit-format-patch:--interdiff () + :description "Insert interdiff" + :class 'transient-option + :key "C-m d i" + :argument "--interdiff=" + :reader #'magit-transient-read-revision) + +(transient-define-argument magit-format-patch:--range-diff () + :description "Insert range-diff" + :class 'transient-option + :key "C-m d r" + :argument "--range-diff=" + :reader #'magit-format-patch-select-range-diff) + +(defun magit-format-patch-select-range-diff (prompt _initial-input _history) + (magit-read-range-or-commit prompt)) + +(transient-define-argument magit-format-patch:--subject-prefix () :description "Subject Prefix" :class 'transient-option :key "C-m p " :argument "--subject-prefix=") -(define-infix-argument magit-format-patch:--from () +(transient-define-argument magit-format-patch:--cover-from-description () + :description "Use branch description" + :class 'transient-option + :key "C-m D " + :argument "--cover-from-description=" + :reader #'magit-format-patch-select-description-mode) + +(defun magit-format-patch-select-description-mode (&rest _ignore) + (magit-read-char-case "Use description as " t + (?m "[m]essage" "message") + (?s "[s]ubject" "subject") + (?a "[a]uto" "auto") + (?n "[n]othing" "none"))) + +(transient-define-argument magit-format-patch:--notes () + :description "Insert commentary from notes" + :class 'transient-option + :key "C-m n " + :argument "--notes=" + :reader #'magit-notes-read-ref) + +(transient-define-argument magit-format-patch:--from () :description "From" :class 'transient-option :key "C-m C-f" :argument "--from=" :reader 'magit-transient-read-person) -(define-infix-argument magit-format-patch:--to () +(transient-define-argument magit-format-patch:--to () :description "To" :class 'transient-option :key "C-m C-t" :argument "--to=" :reader 'magit-transient-read-person) -(define-infix-argument magit-format-patch:--cc () +(transient-define-argument magit-format-patch:--cc () :description "CC" :class 'transient-option :key "C-m C-c" :argument "--cc=" :reader 'magit-transient-read-person) -(define-infix-argument magit-format-patch:--output-directory () +(transient-define-argument magit-format-patch:--output-directory () :description "Output directory" :class 'transient-option :key "C-m o " @@ -177,7 +241,7 @@ which creates patches for all commits that are reachable from :reader 'transient-read-existing-directory) ;;;###autoload (autoload 'magit-patch-apply "magit-patch" nil t) -(define-transient-command magit-patch-apply (file &rest args) +(transient-define-prefix magit-patch-apply (file &rest args) "Apply the patch file FILE." :man-page "git-apply" ["Arguments" @@ -187,7 +251,7 @@ which creates patches for all commits that are reachable from ["Actions" ("a" "Apply patch" magit-patch-apply)] (interactive - (if (not (eq current-transient-command 'magit-patch-apply)) + (if (not (eq transient-current-command 'magit-patch-apply)) (list nil) (list (expand-file-name (read-file-name "Apply patch: " diff --git a/elpa/magit-20200608.928/magit-pkg.el b/elpa/magit-20200608.928/magit-pkg.el new file mode 100644 index 00000000..eeb1cf0d --- /dev/null +++ b/elpa/magit-20200608.928/magit-pkg.el @@ -0,0 +1,12 @@ +(define-package "magit" "20200608.928" "A Git porcelain inside Emacs." + '((emacs "25.1") + (async "20200113") + (dash "20200524") + (git-commit "20200516") + (transient "20200601") + (with-editor "20200522")) + :commit "5341b7cd61258d2ad1e0511a50ece0f1221a718d" :keywords + '("git" "tools" "vc")) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/magit-20200126.1750/magit-process.el b/elpa/magit-20200608.928/magit-process.el similarity index 99% rename from elpa/magit-20200126.1750/magit-process.el rename to elpa/magit-20200608.928/magit-process.el index c7780b07..12eedf8d 100644 --- a/elpa/magit-20200126.1750/magit-process.el +++ b/elpa/magit-20200608.928/magit-process.el @@ -166,6 +166,8 @@ itself from the hook, to avoid further futile attempts." '("^\\(Enter \\)?[Pp]assphrase\\( for \\(RSA \\)?key '.*'\\)?: ?$" ;; Match-group 99 is used to identify the "user@host" part. "^\\(Enter \\)?[Pp]assword\\( for '?\\(https?://\\)?\\(?99:[^']*\\)'?\\)?: ?$" + "Please enter the passphrase for the ssh key" + "Please enter the passphrase to unlock the OpenPGP secret key" "^.*'s password: ?$" "^Yubikey for .*: ?$" "^Enter PIN for .*: ?$") @@ -424,7 +426,7 @@ conversion." "Call Git in a separate process. ARGS is flattened and then used as arguments to Git. -The current buffer's content is used as the process' standard +The current buffer's content is used as the process's standard input. Option `magit-git-executable' specifies the Git executable and diff --git a/elpa/magit-20200126.1750/magit-pull.el b/elpa/magit-20200608.928/magit-pull.el similarity index 97% rename from elpa/magit-20200126.1750/magit-pull.el rename to elpa/magit-20200608.928/magit-pull.el index 33b2bf9f..91939d7c 100644 --- a/elpa/magit-20200126.1750/magit-pull.el +++ b/elpa/magit-20200608.928/magit-pull.el @@ -40,7 +40,7 @@ ;;; Commands ;;;###autoload (autoload 'magit-pull "magit-pull" nil t) -(define-transient-command magit-pull () +(transient-define-prefix magit-pull () "Pull from another repository." :man-page "git-pull" [:description @@ -77,7 +77,7 @@ (transient-args 'magit-pull)) ;;;###autoload (autoload 'magit-pull-from-pushremote "magit-pull" nil t) -(define-suffix-command magit-pull-from-pushremote (args) +(transient-define-suffix magit-pull-from-pushremote (args) "Pull from the push-remote of the current branch. With a prefix argument or when the push-remote is either not @@ -107,7 +107,7 @@ push-remote." (format "%s, setting that" v))))) ;;;###autoload (autoload 'magit-pull-from-upstream "magit-pull" nil t) -(define-suffix-command magit-pull-from-upstream (args) +(transient-define-suffix magit-pull-from-upstream (args) "Pull from the upstream of the current branch. With a prefix argument or when the upstream is either not diff --git a/elpa/magit-20200126.1750/magit-push.el b/elpa/magit-20200608.928/magit-push.el similarity index 98% rename from elpa/magit-20200126.1750/magit-push.el rename to elpa/magit-20200608.928/magit-push.el index 910c5141..8783205a 100644 --- a/elpa/magit-20200126.1750/magit-push.el +++ b/elpa/magit-20200608.928/magit-push.el @@ -35,7 +35,7 @@ ;;; Commands ;;;###autoload (autoload 'magit-push "magit-push" nil t) -(define-transient-command magit-push () +(transient-define-prefix magit-push () "Push to another repository." :man-page "git-push" ["Arguments" @@ -78,7 +78,7 @@ (format "%s:%s%s" branch namespace target)))) ;;;###autoload (autoload 'magit-push-current-to-pushremote "magit-push" nil t) -(define-suffix-command magit-push-current-to-pushremote (args) +(transient-define-suffix magit-push-current-to-pushremote (args) "Push the current branch to its push-remote. When the push-remote is not configured, then read the push-remote @@ -111,7 +111,7 @@ argument the push-remote can be changed before pushed to it." (format "%s, setting that" v))))) ;;;###autoload (autoload 'magit-push-current-to-upstream "magit-push" nil t) -(define-suffix-command magit-push-current-to-upstream (args) +(transient-define-suffix magit-push-current-to-upstream (args) "Push the current branch to its upstream branch. With a prefix argument or when the upstream is either not diff --git a/elpa/magit-20200126.1750/magit-reflog.el b/elpa/magit-20200608.928/magit-reflog.el similarity index 100% rename from elpa/magit-20200126.1750/magit-reflog.el rename to elpa/magit-20200608.928/magit-reflog.el diff --git a/elpa/magit-20200126.1750/magit-refs.el b/elpa/magit-20200608.928/magit-refs.el similarity index 98% rename from elpa/magit-20200126.1750/magit-refs.el rename to elpa/magit-20200608.928/magit-refs.el index 1d090f0a..c5de5670 100644 --- a/elpa/magit-20200126.1750/magit-refs.el +++ b/elpa/magit-20200608.928/magit-refs.el @@ -327,10 +327,11 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. ;;; Commands ;;;###autoload (autoload 'magit-show-refs "magit-refs" nil t) -(define-transient-command magit-show-refs (&optional transient) +(transient-define-prefix magit-show-refs (&optional transient) "List and compare references in a dedicated buffer." :man-page "git-branch" - :value 'magit-show-refs-arguments + :value (lambda () + (magit-show-refs-arguments magit-prefix-use-buffer-arguments)) ["Arguments" (magit-for-each-ref:--contains) ("=m" "Merged" "--merged=" magit-transient-read-revision) @@ -350,33 +351,33 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (transient-setup 'magit-show-refs) (magit-refs-setup-buffer "HEAD" (magit-show-refs-arguments)))) -(defun magit-show-refs-arguments () +(defun magit-show-refs-arguments (&optional use-buffer-args) + (unless use-buffer-args + (setq use-buffer-args magit-direct-use-buffer-arguments)) (let (args) (cond - ((eq current-transient-command 'magit-show-refs) + ((eq transient-current-command 'magit-show-refs) (setq args (transient-args 'magit-show-refs))) - ((eq major-mode 'magit-show-refs-mode) + ((eq major-mode 'magit-refs-mode) (setq args magit-buffer-arguments)) - ((and (memq magit-prefix-use-buffer-arguments '(always selected)) + ((and (memq use-buffer-args '(always selected)) (when-let ((buffer (magit-get-mode-buffer 'magit-refs-mode nil - (or (eq magit-prefix-use-buffer-arguments - 'selected) - 'all)))) + (eq use-buffer-args 'selected)))) (setq args (buffer-local-value 'magit-buffer-arguments buffer)) t))) (t (setq args (alist-get 'magit-show-refs transient-values)))) args)) -(define-infix-argument magit-for-each-ref:--contains () +(transient-define-argument magit-for-each-ref:--contains () :description "Contains" :class 'transient-option :key "-c" :argument "--contains=" :reader 'magit-transient-read-revision) -(define-infix-argument magit-for-each-ref:--sort () +(transient-define-argument magit-for-each-ref:--sort () :description "Sort" :class 'transient-option :key "-s" diff --git a/elpa/magit-20200126.1750/magit-remote.el b/elpa/magit-20200608.928/magit-remote.el similarity index 96% rename from elpa/magit-20200126.1750/magit-remote.el rename to elpa/magit-20200608.928/magit-remote.el index ab74ac81..86b9c066 100644 --- a/elpa/magit-20200126.1750/magit-remote.el +++ b/elpa/magit-20200608.928/magit-remote.el @@ -64,7 +64,7 @@ has to be used to view and change remote related variables." ;;; Commands ;;;###autoload (autoload 'magit-remote "magit-remote" nil t) -(define-transient-command magit-remote (remote) +(transient-define-prefix magit-remote (remote) "Add, configure or remove a remote." :man-page "git-remote" :value '("-f") @@ -251,7 +251,7 @@ Delete the symbolic-ref \"refs/remotes//HEAD\"." ;;; Configure ;;;###autoload (autoload 'magit-remote-configure "magit-remote" nil t) -(define-transient-command magit-remote-configure (remote) +(transient-define-prefix magit-remote-configure (remote) "Configure a remote." :man-page "git-remote" [:description @@ -267,7 +267,7 @@ Delete the symbolic-ref \"refs/remotes//HEAD\"." (interactive (list (or (and (not current-prefix-arg) (not (and magit-remote-direct-configure - (eq current-transient-command 'magit-remote))) + (eq transient-current-command 'magit-remote))) (magit-get-current-remote)) (magit--read-remote-scope)))) (transient-setup 'magit-remote-configure nil nil :scope remote)) @@ -279,20 +279,20 @@ Delete the symbolic-ref \"refs/remotes//HEAD\"." (format (oref obj variable) "")) "Configure remote"))) -(define-infix-command magit-remote..url () +(transient-define-infix magit-remote..url () :class 'magit--git-variable:urls :scope 'magit--read-remote-scope :variable "remote.%s.url" :multi-value t :history-key 'magit-remote..*url) -(define-infix-command magit-remote..fetch () +(transient-define-infix magit-remote..fetch () :class 'magit--git-variable :scope 'magit--read-remote-scope :variable "remote.%s.fetch" :multi-value t) -(define-infix-command magit-remote..pushurl () +(transient-define-infix magit-remote..pushurl () :class 'magit--git-variable:urls :scope 'magit--read-remote-scope :variable "remote.%s.pushurl" @@ -300,12 +300,12 @@ Delete the symbolic-ref \"refs/remotes//HEAD\"." :history-key 'magit-remote..*url :seturl-arg "--push") -(define-infix-command magit-remote..push () +(transient-define-infix magit-remote..push () :class 'magit--git-variable :scope 'magit--read-remote-scope :variable "remote.%s.push") -(define-infix-command magit-remote..tagopt () +(transient-define-infix magit-remote..tagopt () :class 'magit--git-variable:choices :scope 'magit--read-remote-scope :variable "remote.%s.tagOpt" diff --git a/elpa/magit-20200126.1750/magit-repos.el b/elpa/magit-20200608.928/magit-repos.el similarity index 100% rename from elpa/magit-20200126.1750/magit-repos.el rename to elpa/magit-20200608.928/magit-repos.el diff --git a/elpa/magit-20200126.1750/magit-reset.el b/elpa/magit-20200608.928/magit-reset.el similarity index 92% rename from elpa/magit-20200126.1750/magit-reset.el rename to elpa/magit-20200608.928/magit-reset.el index 823a6753..82d0e9a6 100644 --- a/elpa/magit-20200126.1750/magit-reset.el +++ b/elpa/magit-20200608.928/magit-reset.el @@ -30,13 +30,14 @@ (require 'magit) ;;;###autoload (autoload 'magit-reset "magit" nil t) -(define-transient-command magit-reset () +(transient-define-prefix magit-reset () "Reset the `HEAD', index and/or worktree to a previous state." :man-page "git-reset" ["Reset" ("m" "mixed (HEAD and index)" magit-reset-mixed) ("s" "soft (HEAD only)" magit-reset-soft) ("h" "hard (HEAD, index and files)" magit-reset-hard) + ("k" "keep (HEAD and index, keeping uncommitted)" magit-reset-keep) ("i" "index (only)" magit-reset-index) ("w" "worktree (only)" magit-reset-worktree) "" @@ -65,6 +66,13 @@ " reset %s to")))) (magit-reset-internal "--hard" commit)) +;;;###autoload +(defun magit-reset-keep (commit) + "Reset the `HEAD' and index to COMMIT, while keeping uncommitted changes. +\n(git reset --keep REVISION)" + (interactive (list (magit-reset-read-branch-or-commit "Reset %s to"))) + (magit-reset-internal "--keep" commit)) + ;;;###autoload (defun magit-reset-index (commit) "Reset the index to COMMIT. diff --git a/elpa/magit-20200126.1750/magit-section.el b/elpa/magit-20200608.928/magit-section.el similarity index 99% rename from elpa/magit-20200126.1750/magit-section.el rename to elpa/magit-20200608.928/magit-section.el index 2216a120..c31024d2 100644 --- a/elpa/magit-20200126.1750/magit-section.el +++ b/elpa/magit-20200608.928/magit-section.el @@ -8,7 +8,7 @@ ;; Author: Jonas Bernoulli ;; Maintainer: Jonas Bernoulli -;; Package-Requires: ((emacs "25.1") (dash "20180910")) +;; Package-Requires: ((emacs "25.1") (dash "20200524")) ;; Keywords: tools ;; Homepage: https://github.com/magit/magit @@ -369,7 +369,8 @@ Magit-Section is documented in info node `(magit-section)'." (when (and (fboundp 'display-line-numbers-mode) (bound-and-true-p global-display-line-numbers-mode)) (display-line-numbers-mode -1))) - (add-hook 'kill-buffer-hook 'magit-preserve-section-visibility-cache)) + (when (fboundp 'magit-preserve-section-visibility-cache) + (add-hook 'kill-buffer-hook #'magit-preserve-section-visibility-cache))) ;;; Core diff --git a/elpa/magit-20200126.1750/magit-sequence.el b/elpa/magit-20200608.928/magit-sequence.el similarity index 98% rename from elpa/magit-20200126.1750/magit-sequence.el rename to elpa/magit-20200608.928/magit-sequence.el index e5b82cb3..456a5392 100644 --- a/elpa/magit-20200126.1750/magit-sequence.el +++ b/elpa/magit-20200608.928/magit-sequence.el @@ -131,7 +131,7 @@ This discards all changes made since the sequence started." "The Perl executable.") ;;;###autoload (autoload 'magit-cherry-pick "magit-sequence" nil t) -(define-transient-command magit-cherry-pick () +(transient-define-prefix magit-cherry-pick () "Apply or transplant commits." :man-page "git-cherry-pick" :value '("--ff") @@ -160,7 +160,7 @@ This discards all changes made since the sequence started." ("s" "Skip" magit-sequencer-skip) ("a" "Abort" magit-sequencer-abort)]) -(define-infix-argument magit-cherry-pick:--mainline () +(transient-define-argument magit-cherry-pick:--mainline () :description "Replay merge relative to parent" :class 'transient-option :shortarg "-m" @@ -351,7 +351,7 @@ the process manually." ;;; Revert ;;;###autoload (autoload 'magit-revert "magit-sequence" nil t) -(define-transient-command magit-revert () +(transient-define-prefix magit-revert () "Revert existing commits, with or without creating new commits." :man-page "git-revert" :value '("--edit") @@ -403,7 +403,7 @@ without prompting." ;;; Patch ;;;###autoload (autoload 'magit-am "magit-sequence" nil t) -(define-transient-command magit-am () +(transient-define-prefix magit-am () "Apply patches received by email." :man-page "git-am" :value '("--3way") @@ -432,7 +432,7 @@ without prompting." (defun magit-am-arguments () (transient-args 'magit-am)) -(define-infix-argument magit-apply:-p () +(transient-define-argument magit-apply:-p () :description "Remove leading slashes from paths" :class 'transient-option :argument "-p" @@ -495,18 +495,20 @@ This discards all changes made since the sequence started." ;;; Rebase ;;;###autoload (autoload 'magit-rebase "magit-sequence" nil t) -(define-transient-command magit-rebase () +(transient-define-prefix magit-rebase () "Transplant commits and/or modify existing commits." :man-page "git-rebase" ["Arguments" :if-not magit-rebase-in-progress-p ("-k" "Keep empty commits" "--keep-empty") ("-p" "Preserve merges" ("-p" "--preserve-merges")) + (7 magit-merge:--strategy) ("-d" "Lie about committer date" "--committer-date-is-author-date") ("-a" "Autosquash" "--autosquash") ("-A" "Autostash" "--autostash") ("-i" "Interactive" ("-i" "--interactive")) ("-h" "Disable hooks" "--no-verify") + (7 magit-rebase:--exec) (5 magit:--gpg-sign) (5 "-r" "Rebase merges" "--rebase-merges=" magit-rebase-merges-select-mode)] [:if-not magit-rebase-in-progress-p @@ -533,6 +535,13 @@ This discards all changes made since the sequence started." ("e" "Edit" magit-rebase-edit) ("a" "Abort" magit-rebase-abort)]) +(transient-define-argument magit-rebase:--exec () + :description "Run command after commits" + :class 'transient-option + :shortarg "-x" + :argument "--exec=" + :reader #'read-shell-command) + (defun magit-rebase-merges-select-mode (&rest _ignore) (magit-read-char-case nil t (?n "[n]o-rebase-cousins" "no-rebase-cousins") @@ -545,7 +554,7 @@ This discards all changes made since the sequence started." (magit-run-git-sequencer "rebase" args target)) ;;;###autoload (autoload 'magit-rebase-onto-pushremote "magit-sequence" nil t) -(define-suffix-command magit-rebase-onto-pushremote (args) +(transient-define-suffix magit-rebase-onto-pushremote (args) "Rebase the current branch onto its push-remote branch. With a prefix argument or when the push-remote is either not @@ -559,7 +568,7 @@ push-remote." (magit-git-rebase (concat remote "/" branch) args))) ;;;###autoload (autoload 'magit-rebase-onto-upstream "magit-sequence" nil t) -(define-suffix-command magit-rebase-onto-upstream (args) +(transient-define-suffix magit-rebase-onto-upstream (args) "Rebase the current branch onto its upstream branch. With a prefix argument or when the upstream is either not @@ -774,7 +783,8 @@ edit. With a prefix argument the old message is reused as-is." (file-exists-p (magit-git-dir "rebase-merge")) (not (member (magit-toplevel) magit--rebase-public-edit-confirmed))) - (magit-commit-amend-assert)) + (magit-commit-amend-assert + (magit-file-line (magit-git-dir "rebase-merge/orig-head")))) (if noedit (let ((process-environment process-environment)) (push "GIT_EDITOR=true" process-environment) diff --git a/elpa/magit-20200126.1750/magit-stash.el b/elpa/magit-20200608.928/magit-stash.el similarity index 99% rename from elpa/magit-20200126.1750/magit-stash.el rename to elpa/magit-20200608.928/magit-stash.el index 7ac1b29c..d4e358c9 100644 --- a/elpa/magit-20200126.1750/magit-stash.el +++ b/elpa/magit-20200608.928/magit-stash.el @@ -86,7 +86,7 @@ AUTHOR-WIDTH has to be an integer. When the name of the author ;;; Commands ;;;###autoload (autoload 'magit-stash "magit-stash" nil t) -(define-transient-command magit-stash () +(transient-define-prefix magit-stash () "Stash uncommitted changes." :man-page "git-stash" ["Arguments" diff --git a/elpa/magit-20200126.1750/magit-status.el b/elpa/magit-20200608.928/magit-status.el similarity index 98% rename from elpa/magit-20200126.1750/magit-status.el rename to elpa/magit-20200608.928/magit-status.el index 90e8980d..739c12c8 100644 --- a/elpa/magit-20200126.1750/magit-status.el +++ b/elpa/magit-20200608.928/magit-status.el @@ -327,7 +327,7 @@ doesn't find the executable, then consult the info node map) "Keymap for `magit-status-mode'.") -(define-transient-command magit-status-jump () +(transient-define-prefix magit-status-jump () "In a Magit-Status buffer, jump to a section." ["Jump to" [("z " "Stashes" magit-jump-to-stashes @@ -344,10 +344,16 @@ doesn't find the executable, then consult the info node :if (lambda () (memq 'magit-insert-unpulled-from-upstream magit-status-sections-hook))) ("fp" "Unpulled from pushremote" magit-jump-to-unpulled-from-pushremote :if (lambda () (memq 'magit-insert-unpulled-from-pushremote magit-status-sections-hook))) - ("pu" "Unpushed to upstream" magit-jump-to-unpushed-to-upstream + ("pu" magit-jump-to-unpushed-to-upstream :if (lambda () (or (memq 'magit-insert-unpushed-to-upstream-or-recent magit-status-sections-hook) - (memq 'magit-insert-unpushed-to-upstream magit-status-sections-hook)))) + (memq 'magit-insert-unpushed-to-upstream magit-status-sections-hook))) + :description (lambda () + (let ((upstream (magit-get-upstream-branch))) + (if (or (not upstream) + (magit-rev-ancestor-p "HEAD" upstream)) + "Recent commits" + "Unmerged into upstream")))) ("pp" "Unpushed to pushremote" magit-jump-to-unpushed-to-pushremote :if (lambda () (memq 'magit-insert-unpushed-to-pushremote magit-status-sections-hook))) ("a " "Assumed unstaged" magit-jump-to-assume-unchanged diff --git a/elpa/magit-20200126.1750/magit-submodule.el b/elpa/magit-20200608.928/magit-submodule.el similarity index 98% rename from elpa/magit-20200126.1750/magit-submodule.el rename to elpa/magit-20200608.928/magit-submodule.el index 3f201631..ca154177 100644 --- a/elpa/magit-20200126.1750/magit-submodule.el +++ b/elpa/magit-20200608.928/magit-submodule.el @@ -114,7 +114,7 @@ and also setting this variable to t will lead to tears." ;;; Popup ;;;###autoload (autoload 'magit-submodule "magit-submodule" nil t) -(define-transient-command magit-submodule () +(transient-define-prefix magit-submodule () "Act on a submodule." :man-page "git-submodule" ["Arguments" @@ -161,7 +161,7 @@ and also setting this variable to t will lead to tears." (cl-call-next-method obj)))) ;;;###autoload (autoload 'magit-submodule-add "magit-submodule" nil t) -(define-suffix-command magit-submodule-add (url &optional path name args) +(transient-define-suffix magit-submodule-add (url &optional path name args) "Add the repository at URL as a module. Optional PATH is the path to the module relative to the root of @@ -225,7 +225,7 @@ it is nil, then PATH also becomes the name." (if prefer-short name path))))) ;;;###autoload (autoload 'magit-submodule-register "magit-submodule" nil t) -(define-suffix-command magit-submodule-register (modules) +(transient-define-suffix magit-submodule-register (modules) "Register MODULES. With a prefix argument act on all suitable modules. Otherwise, @@ -244,7 +244,7 @@ single module from the user." (magit-run-git-async "submodule" "init" "--" modules))) ;;;###autoload (autoload 'magit-submodule-populate "magit-submodule" nil t) -(define-suffix-command magit-submodule-populate (modules) +(transient-define-suffix magit-submodule-populate (modules) "Create MODULES working directories, checking out the recorded commits. With a prefix argument act on all suitable modules. Otherwise, @@ -261,7 +261,7 @@ single module from the user." (magit-run-git-async "submodule" "update" "--init" "--" modules))) ;;;###autoload (autoload 'magit-submodule-update "magit-submodule" nil t) -(define-suffix-command magit-submodule-update (modules args) +(transient-define-suffix magit-submodule-update (modules args) "Update MODULES by checking out the recorded commits. With a prefix argument act on all suitable modules. Otherwise, @@ -284,7 +284,7 @@ single module from the user." (magit-run-git-async "submodule" "update" args "--" modules))) ;;;###autoload (autoload 'magit-submodule-synchronize "magit-submodule" nil t) -(define-suffix-command magit-submodule-synchronize (modules args) +(transient-define-suffix magit-submodule-synchronize (modules args) "Synchronize url configuration of MODULES. With a prefix argument act on all suitable modules. Otherwise, @@ -300,7 +300,7 @@ single module from the user." (magit-run-git-async "submodule" "sync" args "--" modules))) ;;;###autoload (autoload 'magit-submodule-unpopulate "magit-submodule" nil t) -(define-suffix-command magit-submodule-unpopulate (modules args) +(transient-define-suffix magit-submodule-unpopulate (modules args) "Remove working directories of MODULES. With a prefix argument act on all suitable modules. Otherwise, @@ -327,7 +327,7 @@ single module from the user." "Unregister MODULES and remove their working directories. For safety reasons, do not remove the gitdirs and if a module has -uncomitted changes, then do not remove it at all. If a module's +uncommitted changes, then do not remove it at all. If a module's gitdir is located inside the working directory, then move it into the gitdir of the superproject first. diff --git a/elpa/magit-20200126.1750/magit-subtree.el b/elpa/magit-20200608.928/magit-subtree.el similarity index 93% rename from elpa/magit-20200126.1750/magit-subtree.el rename to elpa/magit-20200608.928/magit-subtree.el index 1ea3bbe0..005e07ed 100644 --- a/elpa/magit-20200126.1750/magit-subtree.el +++ b/elpa/magit-20200608.928/magit-subtree.el @@ -28,7 +28,7 @@ ;;; Commands ;;;###autoload (autoload 'magit-subtree "magit-subtree" nil t) -(define-transient-command magit-subtree () +(transient-define-prefix magit-subtree () "Import or export subtrees." :man-page "git-subtree" ["Actions" @@ -36,7 +36,7 @@ ("e" "Export" magit-subtree-export)]) ;;;###autoload (autoload 'magit-subtree-import "magit-subtree" nil t) -(define-transient-command magit-subtree-import () +(transient-define-prefix magit-subtree-import () "Import subtrees." :man-page "git-subtree" ["Arguments" @@ -50,7 +50,7 @@ ("f" "Pull" magit-subtree-pull)]]) ;;;###autoload (autoload 'magit-subtree-export "magit-subtree" nil t) -(define-transient-command magit-subtree-export () +(transient-define-prefix magit-subtree-export () "Export subtrees." :man-page "git-subtree" ["Arguments" @@ -64,7 +64,7 @@ ("p" "Push" magit-subtree-push) ("s" "Split" magit-subtree-split)]) -(define-infix-argument magit-subtree:--prefix () +(transient-define-argument magit-subtree:--prefix () :description "Prefix" :class 'transient-option :shortarg "-P" @@ -82,25 +82,25 @@ (user-error "%s isn't inside the repository at %s" prefix topdir)) prefix))) -(define-infix-argument magit-subtree:--message () +(transient-define-argument magit-subtree:--message () :description "Message" :class 'transient-option :shortarg "-m" :argument "--message=") -(define-infix-argument magit-subtree:--annotate () +(transient-define-argument magit-subtree:--annotate () :description "Annotate" :class 'transient-option :key "-a" :argument "--annotate=") -(define-infix-argument magit-subtree:--branch () +(transient-define-argument magit-subtree:--branch () :description "Branch" :class 'transient-option :shortarg "-b" :argument "--branch=") -(define-infix-argument magit-subtree:--onto () +(transient-define-argument magit-subtree:--onto () :description "Onto" :class 'transient-option :key "-o" diff --git a/elpa/magit-20200126.1750/magit-tag.el b/elpa/magit-20200608.928/magit-tag.el similarity index 71% rename from elpa/magit-20200126.1750/magit-tag.el rename to elpa/magit-20200608.928/magit-tag.el index c11dae8b..e49e17ea 100644 --- a/elpa/magit-20200126.1750/magit-tag.el +++ b/elpa/magit-20200608.928/magit-tag.el @@ -30,7 +30,7 @@ (require 'magit) ;;;###autoload (autoload 'magit-tag "magit" nil t) -(define-transient-command magit-tag () +(transient-define-prefix magit-tag () "Create or delete a tag." :man-page "git-tag" ["Arguments" @@ -48,7 +48,7 @@ (defun magit-tag-arguments () (transient-args 'magit-tag)) -(define-infix-argument magit-tag:--local-user () +(transient-define-argument magit-tag:--local-user () :description "Sign as" :class 'transient-option :shortarg "-u" @@ -110,16 +110,33 @@ defaulting to the tag at point. (when remote-tags (magit-run-git-async "push" remote (--map (concat ":" it) remote-tags)))) +(defvar magit-tag-version-regexp-alist + '(("^[-._+ ]?snapshot\\.?$" . -4) + ("^[-._+]$" . -4) + ("^[-._+ ]?\\(cvs\\|git\\|bzr\\|svn\\|hg\\|darcs\\)\\.?$" . -4) + ("^[-._+ ]?unknown\\.?$" . -4) + ("^[-._+ ]?alpha\\.?$" . -3) + ("^[-._+ ]?beta\\.?$" . -2) + ("^[-._+ ]?\\(pre\\|rc\\)\\.?$" . -1)) + "Overrides `version-regexp-alist' for `magit-tag-release'. +See also `magit-release-tag-regexp'.") + (defvar magit-release-tag-regexp "\\`\ \\(?1:\\(?:v\\(?:ersion\\)?\\|r\\(?:elease\\)?\\)?[-_]?\\)?\ -\\(?2:[0-9]+\\(?:\\.[0-9]+\\)*\\)\\'" - "Regexp used to parse release tag names. -The first submatch must match the prefix, if any. -The second submatch must match the version string.") +\\(?2:[0-9]+\\(?:\\.[0-9]+\\)*\ +\\(?:-[a-zA-Z0-9-]+\\(?:\\.[a-zA-Z0-9-]+\\)*\\)?\\)\\'" + "Regexp used by `magit-tag-release' to parse release tags. + +The first submatch must match the prefix, if any. The second +submatch must match the version string. + +If this matches versions that are not dot separated numbers, +then `magit-tag-version-regexp-alist' has to contain entries +for the separators allowed here.") ;;;###autoload -(defun magit-tag-release (tag msg) - "Create an annotated release tag. +(defun magit-tag-release (tag msg &optional args) + "Create a release tag. Assume that release tags match `magit-release-tag-regexp'. @@ -127,17 +144,13 @@ First prompt for the name of the new tag using the highest existing tag as initial input and leaving it to the user to increment the desired part of the version string. -Then prompt for the message of the new tag. Base the proposed -tag message on the message of the highest tag, provided that -that contains the corresponding version string and substituting -the new version string for that. Otherwise propose something -like \"Foo-Bar 1.2.3\", given, for example, a TAG \"v1.2.3\" and a -repository located at something like \"/path/to/foo-bar\". - -Then call \"git tag --annotate --sign -m MSG TAG\" to create the, -tag, regardless of whether these arguments are enabled in the -popup. Finally show the refs buffer to let the user quickly -review the result." +If `--annotate' is enabled, then prompt for the message of the +new tag. Base the proposed tag message on the message of the +highest tag, provided that that contains the corresponding +version string and substituting the new version string for that. +Otherwise propose something like \"Foo-Bar 1.2.3\", given, for +example, a TAG \"v1.2.3\" and a repository located at something +like \"/path/to/foo-bar\"." (interactive (save-match-data (pcase-let* @@ -145,17 +158,22 @@ review the result." (tag (read-string "Create release tag: " ptag)) (ver (and (string-match magit-release-tag-regexp tag) (match-string 2 tag))) - (msg (cond ((and pver (string-match (regexp-quote pver) pmsg)) - (replace-match ver t t pmsg)) - ((and ptag (string-match (regexp-quote ptag) pmsg)) - (replace-match tag t t pmsg)) - (t (format "%s %s" - (capitalize - (file-name-nondirectory - (directory-file-name (magit-toplevel)))) - ver))))) - (list tag (read-string (format "Message for %S: " tag) msg))))) - (magit-run-git-async "tag" "--annotate" "--sign" "-m" msg tag) + (args (magit-tag-arguments))) + (list tag + (and (member "--annotate" args) + (read-string + (format "Message for %S: " tag) + (cond ((and pver (string-match (regexp-quote pver) pmsg)) + (replace-match ver t t pmsg)) + ((and ptag (string-match (regexp-quote ptag) pmsg)) + (replace-match tag t t pmsg)) + (t (format "%s %s" + (capitalize + (file-name-nondirectory + (directory-file-name (magit-toplevel)))) + ver))))) + args)))) + (magit-run-git-async "tag" args (and msg (list "-m" msg)) tag) (set-process-sentinel magit-this-process (lambda (process event) @@ -179,7 +197,9 @@ a tag qualifies as a release tag." (let ((tag (substring line 0 (match-beginning 0))) (msg (substring line (match-end 0)))) (and (string-match magit-release-tag-regexp tag) - (let ((ver (match-string 2 tag))) + (let ((ver (match-string 2 tag)) + (version-regexp-alist + magit-tag-version-regexp-alist)) (list (list (version-to-list ver) ver tag msg))))))) ;; Cannot rely on "--sort=-version:refname" because diff --git a/elpa/magit-20200126.1750/magit-transient.el b/elpa/magit-20200608.928/magit-transient.el similarity index 100% rename from elpa/magit-20200126.1750/magit-transient.el rename to elpa/magit-20200608.928/magit-transient.el diff --git a/elpa/magit-20200126.1750/magit-utils.el b/elpa/magit-20200608.928/magit-utils.el similarity index 99% rename from elpa/magit-20200126.1750/magit-utils.el rename to elpa/magit-20200608.928/magit-utils.el index 8177a7e2..613d0e2a 100644 --- a/elpa/magit-20200126.1750/magit-utils.el +++ b/elpa/magit-20200608.928/magit-utils.el @@ -434,8 +434,8 @@ acts similarly to `completing-read', except for the following: - If REQUIRE-MATCH is nil and the user exits without a choice, then nil is returned instead of an empty string. -- If REQUIRE-MATCH is non-nil and the users exits without a - choice, an user-error is raised. +- If REQUIRE-MATCH is non-nil and the user exits without a + choice, `user-error' is raised. - FALLBACK specifies a secondary default that is only used if the primary default DEF is nil. The secondary default is not diff --git a/elpa/magit-20200126.1750/magit-wip.el b/elpa/magit-20200608.928/magit-wip.el similarity index 92% rename from elpa/magit-20200126.1750/magit-wip.el rename to elpa/magit-20200608.928/magit-wip.el index 6fcdf19b..b24f93cf 100644 --- a/elpa/magit-20200126.1750/magit-wip.el +++ b/elpa/magit-20200608.928/magit-wip.el @@ -227,6 +227,14 @@ command which is about to be called are committed." (add-hook 'before-save-hook 'magit-wip-commit-initial-backup) (remove-hook 'before-save-hook 'magit-wip-commit-initial-backup))) +(defun magit--any-wip-mode-enabled-p () + "Return non-nil if any global wip mode is enabled." + (or magit-wip-mode + magit-wip-after-save-mode + magit-wip-after-apply-mode + magit-wip-before-change-mode + magit-wip-initial-backup-mode)) + (defvar-local magit-wip-buffer-backed-up nil) (put 'magit-wip-buffer-backed-up 'permanent-local t) @@ -281,9 +289,24 @@ commit message." (defun magit-wip-commit-worktree (ref files msg) (let* ((wipref (magit--wip-wtree-ref ref)) (parent (magit-wip-get-parent ref wipref)) - (tree (magit-with-temp-index parent "--reset" + (tree (magit-with-temp-index parent (list "--reset" "-i") (if files - (magit-call-git "add" "--" files) + ;; Note: `update-index' is used instead of `add' + ;; because `add' will fail if a file is already + ;; deleted in the temporary index. + (magit-call-git + "update-index" "--add" "--remove" + (and (pcase (magit-repository-local-get + 'update-index-has-ignore-sw-p 'unset) + (`unset + (let ((val (version<= "2.25.0" + (magit-git-version)))) + (magit-repository-local-set + 'update-index-has-ignore-sw-p val) + val)) + (val val)) + "--ignore-skip-worktree-entries") + "--" files) (magit-with-toplevel (magit-call-git "add" "-u" "."))) (magit-git-string "write-tree")))) @@ -349,7 +372,8 @@ commit message." (defun magit--wip-ref (namespace &optional ref) (concat magit-wip-namespace namespace (or (and ref (string-prefix-p "refs/" ref) ref) - (when-let ((branch (or ref (magit-get-current-branch)))) + (when-let ((branch (and (not (equal ref "HEAD")) + (or ref (magit-get-current-branch))))) (concat "refs/heads/" branch)) "HEAD"))) diff --git a/elpa/magit-20200126.1750/magit-worktree.el b/elpa/magit-20200608.928/magit-worktree.el similarity index 99% rename from elpa/magit-20200126.1750/magit-worktree.el rename to elpa/magit-20200608.928/magit-worktree.el index 609a4a32..106e91b3 100644 --- a/elpa/magit-20200126.1750/magit-worktree.el +++ b/elpa/magit-20200608.928/magit-worktree.el @@ -43,7 +43,7 @@ Used by `magit-worktree-checkout' and `magit-worktree-branch'." ;;; Commands ;;;###autoload (autoload 'magit-worktree "magit-worktree" nil t) -(define-transient-command magit-worktree () +(transient-define-prefix magit-worktree () "Act on a worktree." :man-page "git-worktree" [["Create new" diff --git a/elpa/magit-20200126.1750/magit.el b/elpa/magit-20200608.928/magit.el similarity index 95% rename from elpa/magit-20200126.1750/magit.el rename to elpa/magit-20200608.928/magit.el index 6af8b22e..b6b8e548 100644 --- a/elpa/magit-20200126.1750/magit.el +++ b/elpa/magit-20200608.928/magit.el @@ -78,7 +78,7 @@ own faces for the `header-line', or for parts of the :group 'magit-faces) (defface magit-header-line-key - '((t :inherit magit-popup-key)) + '((t :inherit font-lock-builtin-face)) "Face for keys in the `header-line'." :group 'magit-faces) @@ -222,7 +222,7 @@ and/or `magit-branch-remote-head'." ;;; Dispatch Popup ;;;###autoload (autoload 'magit-dispatch "magit" nil t) -(define-transient-command magit-dispatch () +(transient-define-prefix magit-dispatch () "Invoke a Magit command from a list of available commands." ["Transient and dwim commands" [("A" "Apply" magit-cherry-pick) @@ -284,8 +284,10 @@ This affects `magit-git-command', `magit-git-command-topdir', (defvar magit-git-command-history nil) ;;;###autoload (autoload 'magit-run "magit" nil t) -(define-transient-command magit-run () +(transient-define-prefix magit-run () "Run git or another command, or launch a graphical utility." + + [["Run git subcommand" ("!" "in repository root" magit-git-command-topdir) ("p" "in working directory" magit-git-command)] @@ -350,13 +352,14 @@ is run in the top-level directory of the current working tree." (magit-process-buffer)) (defun magit-read-shell-command (&optional toplevel initial-input) - (let ((dir (abbreviate-file-name - (if (or toplevel current-prefix-arg) - (or (magit-toplevel) - (magit--not-inside-repository-error)) - default-directory)))) + (let ((default-directory + (if (or toplevel current-prefix-arg) + (or (magit-toplevel) + (magit--not-inside-repository-error)) + default-directory))) (read-shell-command (if magit-shell-command-verbose-prompt - (format "Async shell command in %s: " dir) + (format "Async shell command in %s: " + (abbreviate-file-name default-directory)) "Async shell command: ") initial-input 'magit-git-command-history))) @@ -442,9 +445,20 @@ and Emacs to it." (push 'dirname debug) (let ((dirname (file-name-nondirectory (directory-file-name topdir)))) - (when (string-match "\\`magit-\\([0-9]\\{8\\}\\.[0-9]*\\)" - dirname) - (setq magit-version (match-string 1 dirname)))))))) + (when (string-match "\\`magit-\\([0-9].*\\)" dirname) + (setq magit-version (match-string 1 dirname))))) + ;; If all else fails, just report the commit hash. It's + ;; better than nothing and we cannot do better in the case + ;; of e.g. a shallow clone. + (progn + (push 'hash debug) + ;; Same check as above to see if it's really the Magit repo. + (when (and (file-exists-p gitdir) + (file-exists-p + (expand-file-name "../lisp/magit.el" gitdir))) + (setq magit-version + (let ((default-directory topdir)) + (magit-git-string "rev-parse" "HEAD")))))))) (if (stringp magit-version) (when print-dest (princ (format "Magit %s, Git %s, Emacs %s, %s" diff --git a/elpa/magit-20200608.928/magit.info b/elpa/magit-20200608.928/magit.info new file mode 100644 index 00000000..34afd9e9 --- /dev/null +++ b/elpa/magit-20200608.928/magit.info @@ -0,0 +1,193 @@ +This is magit.info, produced by makeinfo version 6.5 from magit.texi. + + Copyright (C) 2015-2020 Jonas Bernoulli + + You can redistribute this document and/or modify it under the terms + of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) + any later version. + + This document is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + +INFO-DIR-SECTION Emacs +START-INFO-DIR-ENTRY +* Magit: (magit). Using Git from Emacs with Magit. +END-INFO-DIR-ENTRY + + +Indirect: +magit.info-1: 754 +magit.info-2: 301032 + +Tag Table: +(Indirect) +Node: Top754 +Node: Introduction6464 +Node: Installation11187 +Node: Installing from Melpa11517 +Node: Installing from the Git Repository12590 +Node: Post-Installation Tasks14938 +Node: Getting Started16223 +Node: Interface Concepts21672 +Node: Modes and Buffers22033 +Node: Switching Buffers23782 +Node: Naming Buffers28533 +Node: Quitting Windows31840 +Node: Automatic Refreshing of Magit Buffers33586 +Node: Automatic Saving of File-Visiting Buffers36438 +Node: Automatic Reverting of File-Visiting Buffers37623 +Node: Risk of Reverting Automatically42618 +Node: Sections45000 +Node: Section Movement45926 +Node: Section Visibility50836 +Node: Section Hooks56913 +Node: Section Types and Values59320 +Node: Section Options60623 +Node: Transient Commands61095 +Node: Transient Arguments and Buffer Variables62332 +Node: Completion Confirmation and the Selection69350 +Node: Action Confirmation69794 +Node: Completion and Confirmation77144 +Node: The Selection80330 +Node: The hunk-internal region83229 +Node: Support for Completion Frameworks84318 +Node: Additional Completion Options89225 +Node: Running Git89824 +Node: Viewing Git Output90097 +Node: Git Process Status91230 +Node: Running Git Manually92195 +Node: Git Executable94665 +Node: Global Git Arguments96947 +Node: Inspecting97753 +Node: Status Buffer98910 +Node: Status Sections102900 +Node: Status Header Sections108452 +Node: Status Module Sections111082 +Node: Status Options113587 +Node: Repository List115056 +Node: Logging118094 +Node: Refreshing Logs120657 +Node: Log Buffer122103 +Node: Log Margin125959 +Node: Select from Log129138 +Node: Reflog131363 +Node: Cherries133020 +Node: Diffing134868 +Node: Refreshing Diffs137949 +Node: Commands Available in Diffs141528 +Node: Diff Options144064 +Node: Revision Buffer149102 +Node: Ediffing152432 +Node: References Buffer156080 +Node: References Sections166600 +Node: Bisecting167461 +Node: Visiting Files and Blobs169274 +Node: General-Purpose Visit Commands169744 +Node: Visiting Files and Blobs from a Diff170700 +Node: Blaming174159 +Node: Manipulating180722 +Node: Creating Repository181064 +Node: Cloning Repository181619 +Node: Staging and Unstaging187024 +Node: Staging from File-Visiting Buffers191107 +Node: Applying192275 +Node: Committing194168 +Node: Initiating a Commit194751 +Node: Editing Commit Messages198136 +Node: Using the Revision Stack200939 +Node: Commit Pseudo Headers203990 +Node: Commit Mode and Hooks205326 +Node: Commit Message Conventions208264 +Node: Branching210392 +Node: The Two Remotes210618 +Node: Branch Commands213271 +Node: Branch Git Variables225652 +Node: Auxiliary Branch Commands231043 +Node: Merging232161 +Node: Resolving Conflicts236169 +Node: Rebasing241170 +Node: Editing Rebase Sequences246029 +Node: Information About In-Progress Rebase250357 +Ref: Information About In-Progress Rebase-Footnote-1259239 +Node: Cherry Picking259835 +Node: Reverting264166 +Node: Resetting265615 +Node: Stashing267481 +Node: Transferring272182 +Node: Remotes272404 +Node: Remote Commands272556 +Node: Remote Git Variables276637 +Node: Fetching277916 +Node: Pulling280403 +Node: Pushing281449 +Node: Plain Patches284919 +Node: Maildir Patches286410 +Node: Miscellaneous287924 +Node: Tagging288240 +Node: Notes290157 +Node: Submodules292529 +Node: Listing Submodules292747 +Node: Submodule Transient294675 +Node: Subtree297197 +Node: Worktree299173 +Node: Common Commands301032 +Node: Wip Modes303079 +Node: Wip Graph308012 +Node: Legacy Wip Modes310326 +Node: Minor Mode for Buffers Visiting Files313221 +Node: Minor Mode for Buffers Visiting Blobs320322 +Node: Customizing321135 +Node: Per-Repository Configuration322731 +Node: Essential Settings324986 +Node: Safety325310 +Node: Performance327071 +Node: Microsoft Windows Performance334214 +Node: MacOS Performance335405 +Ref: MacOS Performance-Footnote-1336420 +Node: Plumbing336502 +Node: Calling Git337331 +Node: Getting a Value from Git338856 +Node: Calling Git for Effect341942 +Node: Section Plumbing348464 +Node: Creating Sections348692 +Node: Section Selection352592 +Node: Matching Sections354391 +Node: Refreshing Buffers360364 +Node: Conventions363512 +Node: Theming Faces363704 +Node: FAQ371819 +Node: FAQ - How to ...?372261 +Node: How to show git's output?372646 +Node: How to install the gitman info manual?373400 +Node: How to show diffs for gpg-encrypted files?374370 +Node: How does branching and pushing work?374966 +Node: Can Magit be used as ediff-version-control-package?375329 +Node: Should I disable VC?377347 +Node: FAQ - Issues and Errors377965 +Node: Magit is slow378861 +Node: I changed several thousand files at once and now Magit is unusable379075 +Node: I am having problems committing379804 +Node: I am using MS Windows and cannot push with Magit380285 +Node: I am using OS X and SOMETHING works in shell but not in Magit380902 +Node: Expanding a file to show the diff causes it to disappear381733 +Node: Point is wrong in the COMMIT_EDITMSG buffer382314 +Node: The mode-line information isn't always up-to-date383360 +Node: A branch and tag sharing the same name breaks SOMETHING384423 +Node: My Git hooks work on the command-line but not inside Magit385309 +Node: git-commit-mode isn't used when committing from the command-line386155 +Node: Point ends up inside invisible text when jumping to a file-visiting buffer388422 +Node: Debugging Tools389220 +Node: Keystroke Index391399 +Node: Command Index425456 +Node: Function Index462554 +Node: Variable Index478906 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/elpa/magit-20200126.1750/magit.info-1 b/elpa/magit-20200608.928/magit.info-1 similarity index 99% rename from elpa/magit-20200126.1750/magit.info-1 rename to elpa/magit-20200608.928/magit.info-1 index f6f7de09..62443541 100644 --- a/elpa/magit-20200126.1750/magit.info-1 +++ b/elpa/magit-20200608.928/magit.info-1 @@ -31,7 +31,7 @@ to perform almost all of their daily version control tasks directly from within Emacs. While many fine Git clients exist, only Magit and Git itself deserve to be called porcelains. -This manual is for Magit version 2.90.1 (v2.90.1-900-g14c70a5ac+1). +This manual is for Magit version 2.90.1 (v2.90.1-996-g6b88fab39+1). Copyright (C) 2015-2020 Jonas Bernoulli @@ -300,6 +300,7 @@ FAQ - How to ...? * How to show diffs for gpg-encrypted files?:: * How does branching and pushing work?:: * Can Magit be used as ediff-version-control-package?:: +* Should I disable VC?:: FAQ - Issues and Errors @@ -309,7 +310,6 @@ FAQ - Issues and Errors * I am having problems committing:: * I am using MS Windows and cannot push with Magit:: * I am using OS X and SOMETHING works in shell, but not in Magit: I am using OS X and SOMETHING works in shell but not in Magit. -* Diffs contain control sequences:: * Expanding a file to show the diff causes it to disappear:: * Point is wrong in the COMMIT_EDITMSG buffer:: * The mode-line information isn't always up-to-date:: @@ -2902,15 +2902,6 @@ File: magit.info, Node: Status Options, Prev: Status Module Sections, Up: Sta author is shown, then this specifies how much space is used to do so. - -- User Option: magit-log-section-args - - Additional Git arguments used when creating log sections. Only - ‘--graph’, ‘--decorate’, and ‘--show-signature’ are supported. - This option is only a temporary kludge and will be removed. - - Note that due to an issue in Git the use of ‘--graph’ is very slow - with long histories, so you probably don’t want to add this here. - Also see the proceeding section for more options concerning status buffers. @@ -4792,11 +4783,11 @@ is used and on the value of ‘magit-clone-always-transient’. This option controls whether cloning causes the reference ‘refs/remotes//HEAD’ to be created in the clone. The - default is to do so. - - Actually ‘git clone’ itself does that and cannot be told to not do - it. Therefore setting this to ‘nil’ causes Magit to remove that - reference after cloning. + default is to delete the reference after running ‘git clone’, which + insists on creating it. This is because the reference has not been + found to be particularly useful as it is not automatically updated + when the ‘HEAD’ of the remote changes. Setting this option to ‘t’ + preserves Git’s default behavior of creating the reference. -- User Option: magit-clone-set-remote.pushDefault @@ -5682,8 +5673,8 @@ them. Those features are available from separate transient command. -- User Option: magit-branch-read-upstream-first When creating a branch, whether to read the upstream branch before - the name of the branch that is to be created. The default is - ‘nil’, and I recommend you leave it at that. + the name of the branch that is to be created. The default is ‘t’, + and I recommend you leave it at that. -- User Option: magit-branch-prefer-remote-upstream @@ -6807,6 +6798,12 @@ Also see *note (gitman)git-reset::. Reset the ‘HEAD’, index, and working tree to some commit read from the user and defaulting to the commit at point. +‘X k’ (‘magit-reset-keep’) + + Reset the ‘HEAD’, index, and working tree to some commit read from + the user and defaulting to the commit at point. Uncommitted + changes are kept as-is. + ‘X i’ (‘magit-reset-index’) Reset the index to some commit read from the user and defaulting to @@ -7454,24 +7451,23 @@ Also see *note (gitman)git-tag::. ‘t r’ (‘magit-tag-release’) - This commands creates an annotated release tag. It assumes that - release tags match ‘magit-release-tag-regexp’. + This commands creates a release tag. It assumes that release tags + match ‘magit-release-tag-regexp’. First it prompts for the name of the new tag using the highest existing tag as initial input and leaving it to the user to - increment the desired part of the version string. - - Then it prompts for the message of the new tag. The proposed tag - message is based on the message of the highest tag, provided that - that contains the corresponding version string and substituting the - new version string for that. Otherwise it proposes something like - "Foo-Bar 1.2.3", given, for example, a TAG "v1.2.3" and a - repository located at something like "/path/to/foo-bar". - - Then it calls "git tag –annotate –sign -m MSG TAG" to create the - tag, regardless of whether these arguments are enabled in the - transient. Finally it shows the refs buffer to let the user - quickly review the result. + increment the desired part of the version string. If you use + unconventional release tags or version numbers (e.g., + ‘v1.2.3-custom.1’), you can set the ‘magit-release-tag-regexp’ and + ‘magit-tag-version-regexp-alist’ variables. + + If ‘--annotate’ is enabled then it prompts for the message of the + new tag. The proposed tag message is based on the message of the + highest tag, provided that that contains the corresponding version + string and substituting the new version string for that. Otherwise + it proposes something like "Foo-Bar 1.2.3", given, for example, a + TAG "v1.2.3" and a repository located at something like + "/path/to/foo-bar". ‘t k’ (‘magit-tag-delete’) diff --git a/elpa/magit-20200126.1750/magit.info-2 b/elpa/magit-20200608.928/magit.info-2 similarity index 98% rename from elpa/magit-20200126.1750/magit.info-2 rename to elpa/magit-20200608.928/magit.info-2 index 326359e8..e0cafc4c 100644 --- a/elpa/magit-20200126.1750/magit.info-2 +++ b/elpa/magit-20200608.928/magit.info-2 @@ -27,7 +27,7 @@ These are some of the commands that can be used in all buffers whose major-modes derive from ‘magit-mode’. There are other common commands beside the ones below, but these didn’t fit well anywhere else. -‘M-w’ (‘magit-copy-section-value’) +‘C-w’ (‘magit-copy-section-value’) This command saves the value of the current section to the ‘kill-ring’, and, provided that the current section is a commit, @@ -44,7 +44,7 @@ beside the ones below, but these didn’t fit well anywhere else. within a hunk, it strips the outer diff marker column before saving the text. -‘C-w’ (‘magit-copy-buffer-revision’) +‘M-w’ (‘magit-copy-buffer-revision’) This command saves the revision being displayed in the current buffer to the ‘kill-ring’ and also pushes it to the @@ -770,6 +770,15 @@ using ‘magit-revision-mode’ takes considerably more time than looking at the same commit in ‘magit-diff-mode’, then consider setting ‘magit-revision-insert-related-refs’ to ‘nil’. + When you are often confronted with diffs that contain deleted files, +then you might want to enable the ‘--irreversible-delete’ argument. If +you do that then diffs still show that a file was deleted but without +also showing the complete deleted content of the file. This argument is +not available by default, see *note (transient)Enabling and Disabling +Suffixes::. Once you have done that you should enable it and save that +setting, see *note (transient)Saving Values::. You should do this in +both the diff (‘d’) and the diff refresh (‘D’) transient popups. + Refs Buffer Performance ....................... @@ -806,21 +815,6 @@ buffer, but doing it this way has the advantage that you usually get to see the diff, which is useful because it increases the odds that you spot potential issues. -The Built-In VC Package -....................... - -Emacs comes with a version control interface called "VC", see *note -(emacs)Version Control::. It is enabled be default, and if you don’t -use it in addition to Magit, then you should disable it to keep it from -performing unnecessary work: - - (setq vc-handled-backends nil) - - You can also disable its use for Git but keep using it when using -another version control system: - - (setq vc-handled-backends (delq 'Git vc-handled-backends)) -  File: magit.info, Node: Microsoft Windows Performance, Next: MacOS Performance, Up: Performance @@ -866,6 +860,12 @@ the faster ‘vfork’ will be used. (The creation of child processes still takes about twice as long on Darwin compared to Linux.) See (1) for more information. + On Catalina, and potentially other macOS releases, there may be a +performance problem where any action takes 20 times longer on Darwin +than on Linux. This can be fixed by setting ‘magit-git-executable’ to +the absolute path of the ‘git’ executable, instead of relying on +resolving the ‘$PATH’. + ---------- Footnotes ---------- (1) @@ -1059,7 +1059,7 @@ refresh because that also automatically moves to the next change. input. INPUT should be a buffer or the name of an existing buffer. The - content of that buffer is used as the process’ standard input. + content of that buffer is used as the process’s standard input. After the process returns a refresh is performed. As a special case, INPUT may also be nil. In that case the content @@ -1071,9 +1071,9 @@ refresh because that also automatically moves to the next change. -- Function: magit-run-git-with-logfile file &rest args - Calls git synchronously with ARGS. The process’ output is saved in - FILE. This is rarely useful and so this function might be removed - in the future. + Calls git synchronously with ARGS. The process’s output is saved + in FILE. This is rarely useful and so this function might be + removed in the future. This function actually runs git asynchronously. But then it waits for the process to return, so the function itself is synchronous. @@ -1702,6 +1702,7 @@ A.1 FAQ - How to ...? * How to show diffs for gpg-encrypted files?:: * How does branching and pushing work?:: * Can Magit be used as ediff-version-control-package?:: +* Should I disable VC?::  File: magit.info, Node: How to show git's output?, Next: How to install the gitman info manual?, Up: FAQ - How to ...? @@ -1764,7 +1765,7 @@ Please see *note Branching:: and  -File: magit.info, Node: Can Magit be used as ediff-version-control-package?, Prev: How does branching and pushing work?, Up: FAQ - How to ...? +File: magit.info, Node: Can Magit be used as ediff-version-control-package?, Next: Should I disable VC?, Prev: How does branching and pushing work?, Up: FAQ - How to ...? A.1.5 Can Magit be used as ‘ediff-version-control-package’? ----------------------------------------------------------- @@ -1797,6 +1798,23 @@ So we don’t actually have to implement ‘ediff-magit-merge-internal’. Instead we provide the more useful command ‘magit-ediff-resolve’ which only shows yet-to-be resolved conflicts. + +File: magit.info, Node: Should I disable VC?, Prev: Can Magit be used as ediff-version-control-package?, Up: FAQ - How to ...? + +A.1.6 Should I disable VC? +-------------------------- + +If you don’t use VC (the built-in version control interface) then you +might be tempted to disable it, not least because we used to recommend +that you do that. + + We no longer recommend that you disable VC. Doing so would break +useful third-party packages (such as ‘diff-hl’), which depend on VC +being enabled. + + If you choose to disable VC anyway, then you can do so by changing +the value of ‘vc-handled-backends’. +  File: magit.info, Node: FAQ - Issues and Errors, Prev: FAQ - How to ...?, Up: FAQ @@ -1810,7 +1828,6 @@ A.2 FAQ - Issues and Errors * I am having problems committing:: * I am using MS Windows and cannot push with Magit:: * I am using OS X and SOMETHING works in shell, but not in Magit: I am using OS X and SOMETHING works in shell but not in Magit. -* Diffs contain control sequences:: * Expanding a file to show the diff causes it to disappear:: * Point is wrong in the COMMIT_EDITMSG buffer:: * The mode-line information isn't always up-to-date:: @@ -1865,7 +1882,7 @@ push on the command line. .  -File: magit.info, Node: I am using OS X and SOMETHING works in shell but not in Magit, Next: Diffs contain control sequences, Prev: I am using MS Windows and cannot push with Magit, Up: FAQ - Issues and Errors +File: magit.info, Node: I am using OS X and SOMETHING works in shell but not in Magit, Next: Expanding a file to show the diff causes it to disappear, Prev: I am using MS Windows and cannot push with Magit, Up: FAQ - Issues and Errors A.2.5 I am using OS X and SOMETHING works in shell, but not in Magit -------------------------------------------------------------------- @@ -1880,31 +1897,9 @@ you are using on the shell. tag signing", then you’ll also need to synchronize ‘$GPG_AGENT_INFO’.  -File: magit.info, Node: Diffs contain control sequences, Next: Expanding a file to show the diff causes it to disappear, Prev: I am using OS X and SOMETHING works in shell but not in Magit, Up: FAQ - Issues and Errors - -A.2.6 Diffs contain control sequences -------------------------------------- - -This happens when you configure Git to always color diffs and/or all of -its output. The valid values for relevant Git variables ‘color.ui’ and -‘color.diff’ are ‘false’, ‘true’ and ‘always’, and the default is -‘true’. You should leave it that way because then you get colorful -output in terminals by default but when git’s output is consumed by -something else, then no color control sequences are used. - - If you actually use some other tool that requires setting ‘color.ui’ -and/or ‘color.diff’ to ‘always’ (which is highly unlikely), then you can -override these settings just for Magit by using: - - (setq magit-git-global-arguments - (nconc magit-git-global-arguments - '("-c" "color.ui=false" - "-c" "color.diff=false"))) - - -File: magit.info, Node: Expanding a file to show the diff causes it to disappear, Next: Point is wrong in the COMMIT_EDITMSG buffer, Prev: Diffs contain control sequences, Up: FAQ - Issues and Errors +File: magit.info, Node: Expanding a file to show the diff causes it to disappear, Next: Point is wrong in the COMMIT_EDITMSG buffer, Prev: I am using OS X and SOMETHING works in shell but not in Magit, Up: FAQ - Issues and Errors -A.2.7 Expanding a file to show the diff causes it to disappear +A.2.6 Expanding a file to show the diff causes it to disappear -------------------------------------------------------------- This is probably caused by a change of a ‘diff.*’ Git variable. You @@ -1914,7 +1909,7 @@ that setting in Magit by customizing ‘magit-git-global-arguments’.  File: magit.info, Node: Point is wrong in the COMMIT_EDITMSG buffer, Next: The mode-line information isn't always up-to-date, Prev: Expanding a file to show the diff causes it to disappear, Up: FAQ - Issues and Errors -A.2.8 Point is wrong in the ‘COMMIT_EDITMSG’ buffer +A.2.7 Point is wrong in the ‘COMMIT_EDITMSG’ buffer --------------------------------------------------- Neither Magit nor ‘git-commit‘ fiddle with point in the buffer used to @@ -1938,7 +1933,7 @@ help:  File: magit.info, Node: The mode-line information isn't always up-to-date, Next: A branch and tag sharing the same name breaks SOMETHING, Prev: Point is wrong in the COMMIT_EDITMSG buffer, Up: FAQ - Issues and Errors -A.2.9 The mode-line information isn’t always up-to-date +A.2.8 The mode-line information isn’t always up-to-date ------------------------------------------------------- Magit is not responsible for the version control information that is @@ -1951,21 +1946,18 @@ information, and can be told to do so more often: But doing so isn’t good for performance. For more (overly optimistic) information see *note (emacs)VC Mode Line::. - If you don’t really care about seeing that information in the + If you don’t really care about seeing this information in the mode-line, but just don’t want to see _incorrect_ information, then -consider disabling VC when using Git: +consider simply not displaying it in the mode-line: - (setq vc-handled-backends (delq 'Git vc-handled-backends)) - - Or to disable it completely: - - (setq vc-handled-backends nil) + (setq-default mode-line-format + (delete '(vc-mode vc-mode) mode-line-format))  File: magit.info, Node: A branch and tag sharing the same name breaks SOMETHING, Next: My Git hooks work on the command-line but not inside Magit, Prev: The mode-line information isn't always up-to-date, Up: FAQ - Issues and Errors -A.2.10 A branch and tag sharing the same name breaks SOMETHING --------------------------------------------------------------- +A.2.9 A branch and tag sharing the same name breaks SOMETHING +------------------------------------------------------------- Or more generally, ambiguous refnames break SOMETHING. @@ -1980,7 +1972,7 @@ that we can investigate whether there is a simple fix.  File: magit.info, Node: My Git hooks work on the command-line but not inside Magit, Next: git-commit-mode isn't used when committing from the command-line, Prev: A branch and tag sharing the same name breaks SOMETHING, Up: FAQ - Issues and Errors -A.2.11 My Git hooks work on the command-line but not inside Magit +A.2.10 My Git hooks work on the command-line but not inside Magit ----------------------------------------------------------------- When Magit calls ‘git’ it adds a few global arguments including @@ -1994,7 +1986,7 @@ GIT_LITERAL_PATHSPECS’.  File: magit.info, Node: git-commit-mode isn't used when committing from the command-line, Next: Point ends up inside invisible text when jumping to a file-visiting buffer, Prev: My Git hooks work on the command-line but not inside Magit, Up: FAQ - Issues and Errors -A.2.12 ‘git-commit-mode’ isn’t used when committing from the command-line +A.2.11 ‘git-commit-mode’ isn’t used when committing from the command-line ------------------------------------------------------------------------- The reason for this is that ‘git-commit.el’ has not been loaded yet @@ -2049,7 +2041,7 @@ that succeeds, do nothing else. Otherwise start ‘emacs &’ (and  File: magit.info, Node: Point ends up inside invisible text when jumping to a file-visiting buffer, Prev: git-commit-mode isn't used when committing from the command-line, Up: FAQ - Issues and Errors -A.2.13 Point ends up inside invisible text when jumping to a file-visiting buffer +A.2.12 Point ends up inside invisible text when jumping to a file-visiting buffer --------------------------------------------------------------------------------- This can happen when you type ‘RET’ on a hunk to visit the respective @@ -2290,7 +2282,7 @@ Appendix C Keystroke Index (line 42) * C-c M-s: Editing Commit Messages. (line 34) -* C-w: Common Commands. (line 27) +* C-w: Common Commands. (line 10) * C-x g: Status Buffer. (line 22) * C-x u: Editing Rebase Sequences. (line 94) @@ -2412,7 +2404,7 @@ Appendix C Keystroke Index * M-p <2>: Editing Rebase Sequences. (line 43) * M-w: Blaming. (line 130) -* M-w <1>: Common Commands. (line 10) +* M-w <1>: Common Commands. (line 27) * M-x magit-debug-git-executable: Git Executable. (line 45) * M-x magit-debug-git-executable <1>: Debugging Tools. (line 36) * M-x magit-describe-section-briefly: Section Types and Values. @@ -2526,9 +2518,9 @@ Appendix C Keystroke Index * T: Notes. (line 8) * T a: Notes. (line 52) * T c: Notes. (line 47) -* t k: Tagging. (line 40) +* t k: Tagging. (line 39) * T m: Notes. (line 38) -* t p: Tagging. (line 47) +* t p: Tagging. (line 46) * T p: Notes. (line 30) * t r: Tagging. (line 19) * T r: Notes. (line 22) @@ -2560,12 +2552,13 @@ Appendix C Keystroke Index * x: Editing Rebase Sequences. (line 76) * x <1>: Resetting. (line 8) -* X f: Resetting. (line 44) +* X f: Resetting. (line 50) * X h: Resetting. (line 26) -* X i: Resetting. (line 31) +* X i: Resetting. (line 37) +* X k: Resetting. (line 31) * X m: Resetting. (line 15) * X s: Resetting. (line 20) -* X w: Resetting. (line 38) +* X w: Resetting. (line 44) * X w <1>: Wip Modes. (line 66) * Y: Cherries. (line 17) * y: References Buffer. (line 6) @@ -2827,7 +2820,7 @@ Appendix D Command Index * magit-fetch-modules: Submodule Transient. (line 58) * magit-fetch-other: Fetching. (line 36) * magit-fetch-refspec: Fetching. (line 45) -* magit-file-checkout: Resetting. (line 44) +* magit-file-checkout: Resetting. (line 50) * magit-file-checkout <1>: Minor Mode for Buffers Visiting Files. (line 165) * magit-file-delete: Minor Mode for Buffers Visiting Files. @@ -2960,11 +2953,12 @@ Appendix D Command Index * magit-reset-hard: Resetting. (line 26) * magit-reset-index: Staging and Unstaging. (line 87) -* magit-reset-index <1>: Resetting. (line 31) +* magit-reset-index <1>: Resetting. (line 37) +* magit-reset-keep: Resetting. (line 31) * magit-reset-mixed: Resetting. (line 15) * magit-reset-quickly: Resetting. (line 8) * magit-reset-soft: Resetting. (line 20) -* magit-reset-worktree: Resetting. (line 38) +* magit-reset-worktree: Resetting. (line 44) * magit-reset-worktree <1>: Wip Modes. (line 66) * magit-reverse: Applying. (line 44) * magit-reverse-in-index: Staging and Unstaging. @@ -3067,8 +3061,8 @@ Appendix D Command Index * magit-subtree-split: Subtree. (line 59) * magit-tag: Tagging. (line 8) * magit-tag-create: Tagging. (line 14) -* magit-tag-delete: Tagging. (line 40) -* magit-tag-prune: Tagging. (line 47) +* magit-tag-delete: Tagging. (line 39) +* magit-tag-prune: Tagging. (line 46) * magit-tag-release: Tagging. (line 19) * magit-toggle-buffer-lock: Modes and Buffers. (line 17) * magit-toggle-margin: Refreshing Logs. (line 37) @@ -3479,7 +3473,6 @@ Appendix F Variable Index (line 118) * magit-log-margin: Log Margin. (line 12) * magit-log-margin-show-committer-date: Log Margin. (line 49) -* magit-log-section-args: Status Options. (line 38) * magit-log-section-commit-count: Status Sections. (line 136) * magit-log-select-margin: Select from Log. (line 30) * magit-log-show-refname-after-summary: Log Buffer. (line 75) diff --git a/elpa/magit-popup-20200102.1811/dir b/elpa/magit-popup-20200306.223/dir similarity index 100% rename from elpa/magit-popup-20200102.1811/dir rename to elpa/magit-popup-20200306.223/dir diff --git a/elpa/magit-popup-20200102.1811/magit-popup-autoloads.el b/elpa/magit-popup-20200306.223/magit-popup-autoloads.el similarity index 100% rename from elpa/magit-popup-20200102.1811/magit-popup-autoloads.el rename to elpa/magit-popup-20200306.223/magit-popup-autoloads.el diff --git a/elpa/magit-popup-20200102.1811/magit-popup-pkg.el b/elpa/magit-popup-20200306.223/magit-popup-pkg.el similarity index 63% rename from elpa/magit-popup-20200102.1811/magit-popup-pkg.el rename to elpa/magit-popup-20200306.223/magit-popup-pkg.el index 8c90b1aa..dd962cd0 100644 --- a/elpa/magit-popup-20200102.1811/magit-popup-pkg.el +++ b/elpa/magit-popup-20200306.223/magit-popup-pkg.el @@ -1,7 +1,7 @@ -(define-package "magit-popup" "20200102.1811" "Define prefix-infix-suffix command combos" +(define-package "magit-popup" "20200306.223" "Define prefix-infix-suffix command combos" '((emacs "24.4") (dash "2.13.0")) - :keywords + :commit "b8e886c4f2242d6c58f84d4549af712e86360db1" :keywords '("bindings") :authors '(("Jonas Bernoulli" . "jonas@bernoul.li")) diff --git a/elpa/magit-popup-20200102.1811/magit-popup.el b/elpa/magit-popup-20200306.223/magit-popup.el similarity index 99% rename from elpa/magit-popup-20200102.1811/magit-popup.el rename to elpa/magit-popup-20200306.223/magit-popup.el index 40b818a9..a130fc94 100644 --- a/elpa/magit-popup-20200102.1811/magit-popup.el +++ b/elpa/magit-popup-20200306.223/magit-popup.el @@ -37,7 +37,7 @@ ;; external process with the specified arguments. ;; This package has been superseded by Transient. No new features -;; will be added but bugs will be fixes. +;; will be added but bugs will be fixed. ;;; Code: diff --git a/elpa/magit-popup-20200102.1811/magit-popup.info b/elpa/magit-popup-20200306.223/magit-popup.info similarity index 98% rename from elpa/magit-popup-20200102.1811/magit-popup.info rename to elpa/magit-popup-20200306.223/magit-popup.info index fa4f64a1..cb8f6968 100644 --- a/elpa/magit-popup-20200102.1811/magit-popup.info +++ b/elpa/magit-popup-20200306.223/magit-popup.info @@ -31,9 +31,9 @@ with the specified arguments. This package has been superseded by Transient (*note (transient)Top::). No new features will be added but bugs will be -fixes. +fixed. -This manual is for Magit-Popup version 2.13.2. +This manual is for Magit-Popup version 2.13.2 (v2.13.2+1). Copyright (C) 2015-2020 Jonas Bernoulli @@ -133,7 +133,7 @@ This should illustrate the most basic differences: This package has been superseded by Transient (*note (transient)Top::). No new features will be added but bugs will be -fixes. +fixed.  File: magit-popup.info, Node: Usage, Next: Defining Prefix and Suffix Commands, Prev: Introduction, Up: Top @@ -560,7 +560,7 @@ commands have to be defined separately using plain ‘defun’. Members of VALUE may also be nil. This should only be used together with ‘:max-action-columns’ and allows having gaps in - the action grit, which can help arranging actions sensibly. + the action grid, which can help arranging actions sensibly. • ‘:default-action’ @@ -728,13 +728,13 @@ directly.  Tag Table: Node: Top770 -Node: Introduction2139 -Node: Usage4478 -Node: Customizing Existing Popups9175 -Node: Other Options15316 -Node: Defining Prefix and Suffix Commands16859 -Node: Defining Prefix Commands19011 -Node: Defining Suffix Commands27706 +Node: Introduction2151 +Node: Usage4490 +Node: Customizing Existing Popups9187 +Node: Other Options15328 +Node: Defining Prefix and Suffix Commands16871 +Node: Defining Prefix Commands19023 +Node: Defining Suffix Commands27718  End Tag Table diff --git a/elpa/magit-popup-readme.txt b/elpa/magit-popup-readme.txt index 0e0a56f6..45656590 100644 --- a/elpa/magit-popup-readme.txt +++ b/elpa/magit-popup-readme.txt @@ -4,4 +4,4 @@ something with these arguments. Usually the command calls an external process with the specified arguments. This package has been superseded by Transient. No new features -will be added but bugs will be fixes. +will be added but bugs will be fixed. diff --git a/elpa/magit-todos-20200310.28/magit-todos-autoloads.el b/elpa/magit-todos-20200310.28/magit-todos-autoloads.el new file mode 100644 index 00000000..ac45b3e8 --- /dev/null +++ b/elpa/magit-todos-20200310.28/magit-todos-autoloads.el @@ -0,0 +1,48 @@ +;;; magit-todos-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "magit-todos" "magit-todos.el" (0 0 0 0)) +;;; Generated autoloads from magit-todos.el + +(defvar magit-todos-mode nil "\ +Non-nil if Magit-Todos mode is enabled. +See the `magit-todos-mode' command +for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `magit-todos-mode'.") + +(custom-autoload 'magit-todos-mode "magit-todos" nil) + +(autoload 'magit-todos-mode "magit-todos" "\ +Show list of to-do items in Magit status buffer for tracked files in repo. + +\(fn &optional ARG)" t nil) + +(autoload 'magit-todos-list "magit-todos" "\ +Show to-do list of the current Git repository in a buffer. +With prefix, prompt for repository. + +\(fn &optional DIRECTORY)" t nil) + +(autoload 'magit-todos-list-internal "magit-todos" "\ +Open buffer showing to-do list of repository at DIRECTORY. + +\(fn DIRECTORY)" nil nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "magit-todos" '("magit-todos-"))) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; magit-todos-autoloads.el ends here diff --git a/elpa/magit-todos-20200310.28/magit-todos-pkg.el b/elpa/magit-todos-20200310.28/magit-todos-pkg.el new file mode 100644 index 00000000..9948bcc3 --- /dev/null +++ b/elpa/magit-todos-20200310.28/magit-todos-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "magit-todos" "20200310.28" "Show source file TODOs in Magit" '((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0")) :commit "a0e5d1f3c7dfcb4f18c1b0d57f1746a4872df5c6" :keywords '("magit" "vc") :authors '(("Adam Porter" . "adam@alphapapa.net")) :maintainer '("Adam Porter" . "adam@alphapapa.net") :url "http://github.com/alphapapa/magit-todos") diff --git a/elpa/magit-todos-20200310.28/magit-todos.el b/elpa/magit-todos-20200310.28/magit-todos.el new file mode 100644 index 00000000..96d95a2a --- /dev/null +++ b/elpa/magit-todos-20200310.28/magit-todos.el @@ -0,0 +1,1447 @@ +;;; magit-todos.el --- Show source file TODOs in Magit -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Adam Porter + +;; Author: Adam Porter +;; URL: http://github.com/alphapapa/magit-todos +;; Package-Version: 20200310.28 +;; Package-Commit: a0e5d1f3c7dfcb4f18c1b0d57f1746a4872df5c6 +;; Version: 1.5.2 +;; Package-Requires: ((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0")) +;; Keywords: magit, vc + +;;; Commentary: + +;; This package displays keyword entries from source code comments and Org files +;; in the Magit status buffer. Activating an item jumps to it in its file. By +;; default, it uses keywords from `hl-todo', minus a few (like "NOTE"). + +;;;; Usage: + +;; Run `magit-todos-mode', then open a Magit status buffer. + +;;;; Tips: + +;; + You can customize settings in the `magit-todos' group. + +;;; Installation: + +;;;; MELPA + +;; If you installed from MELPA, you're done. + +;;;; Manual + +;; Install these required packages: + +;; async +;; dash +;; f +;; hl-todo +;; magit +;; pcre2el +;; s + +;; Then put this file in your load-path, and put this in your init file: + +;; (require 'magit-todos) + +;;; License: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +;;;; Requirements + +(require 'cl-lib) +(require 'org) +(require 'grep) +(require 'seq) + +(require 'async) +(require 'dash) +(require 'f) +(require 'hl-todo) +(require 'magit) +(require 'pcre2el) +(require 's) + +;;;; Structs + +(cl-defstruct magit-todos-item + filename org-level line column position keyword suffix description) + +;;;; Variables + +(defvar magit-todos-keywords-list nil + "List of to-do keywords. +Set automatically by `magit-todos-keywords' customization.") + +(defvar magit-todos-grep-result-regexp nil + "Regular expression for grep results. +This should be set automatically by customizing +`magit-todos-keywords'.") + +(defvar magit-todos-ag-result-regexp nil + "Regular expression for ag results. +This should be set automatically by customizing +`magit-todos-keywords'.") + +(defvar magit-todos-rg-result-regexp nil + "Regular expression for rg results. +This should be set automatically by customizing +`magit-todos-keywords'.") + +(defvar magit-todos-git-grep-result-regexp nil + "Regular expression for git-grep results. +This should be set automatically by customizing +`magit-todos-keywords'.") + +(defvar magit-todos-search-regexp nil + "Regular expression to match keyword items with rg, ag, and git-grep. +This should be set automatically by customizing +`magit-todos-keywords'.") + +(defvar-local magit-todos-active-scan nil + "The current scan's process. +Used to avoid running multiple simultaneous scans for a +magit-status buffer.") + +;; FIXME: Jumping binds. In `magit-status-mode-map' now, "j" is bound +;; to `magit-status-jump', which is a Transient command; it's no +;; longer bound to a prefix map. There doesn't seem to be a way to +;; add binds to that Transient command's body. + +(defvar magit-todos-section-map + (let ((map (make-sparse-keymap))) + (define-key map "jT" #'magit-todos-jump-to-todos) + (define-key map "jl" #'magit-todos-list) + (define-key map "b" #'magit-todos-branch-list-toggle) + (define-key map "B" #'magit-todos-branch-list-set-commit) + (define-key map [remap magit-visit-thing] #'magit-todos-list) + map) + "Keymap for `magit-todos' top-level section.") + +(defvar magit-todos-item-section-map + (let ((map (copy-keymap magit-todos-section-map))) + (define-key map [remap magit-visit-thing] #'magit-todos-jump-to-item) + (define-key map [remap magit-diff-show-or-scroll-up] #'magit-todos-peek-at-item) + map) + "Keymap for `magit-todos' individual to-do item sections. +See https://magit.vc/manual/magit/Creating-Sections.html for more +details about how section maps work.") + +(defvar-local magit-todos-show-filenames nil + "Whether to show filenames next to to-do items. +Set automatically depending on grouping.") + +(defvar-local magit-todos-updating nil + "Whether items are being updated now.") + +(defvar-local magit-todos-last-update-time nil + "When the items were last updated. +A time value as returned by `current-time'.") + +(defvar-local magit-todos-item-cache nil + "Items found by most recent scan.") + +(defvar magit-todos-scanners nil + "Scanners defined by `magit-todos-defscanner'.") + +(defvar magit-todos-section-heading "TODOs" + "Allows overriding of section heading.") + +;;;; Customization + +(defgroup magit-todos nil + "Show TODO items in source code comments in repos' files." + :group 'magit) + +(defcustom magit-todos-scanner nil + "File scanning method. +\"Automatic\" will attempt to use rg, ag, git-grep, and +find-grep, in that order. " + :type '(choice (const :tag "Automatic" nil) + (function :tag "Custom function")) + :set (lambda (option value) + (when magit-todos-scanners + ;; Only try to set when scanners are defined. + (unless value + ;; Choosing automatically + (setq value (or (magit-todos--choose-scanner) + (progn + (display-warning 'magit-todos + "`magit-todos' was unable to find a suitable scanner. Please install \"rg\", or a PCRE-compatible version of \"git\" or \"grep\". Disabling `magit-todos-mode'." + :error) + (magit-todos-mode -1) + nil)))) + (set-default option value)))) + +(defcustom magit-todos-nice t + "Run scanner with \"nice\"." + :type 'boolean) + +(defcustom magit-todos-ignore-case nil + "Upcase keywords found in files. +If nil, a keyword like \"Todo:\" will not be shown. `upcase' can +be a relatively expensive function, so this can be disabled if +necessary." + :type 'boolean) + +(defcustom magit-todos-update t + "When or how often to scan for to-dos. +When set to manual updates, the list can be updated with the +command `magit-todos-update'. When caching is enabled, scan for +items whenever the Magit status buffer is refreshed and at least +N seconds have passed since the last scan; otherwise, use cached +items." + :type '(choice (const :tag "Automatically, when the Magit status buffer is refreshed" t) + (integer :tag "Automatically, but cache items for N seconds") + (const :tag "Manually" nil))) + +(defcustom magit-todos-fontify-keyword-headers t + "Apply keyword faces to group keyword headers." + :type 'boolean) + +(defcustom magit-todos-keyword-suffix (rx (optional "(" (1+ (not (any ")"))) ")") ":") + "Regular expression matching suffixes after keywords. +e.g. to match a keyword like \"TODO(user):\", use \"([^)]+):\". + +If the suffix should be optional, the entire regexp should be +made explicitly optional. However, it is not necessary to +account for optional whitespace after the suffix, as this is done +automatically. + +Note: the suffix applies only to non-Org files." + :type `(choice (const :tag "Optional username in parens, then required colon (matching e.g. \"TODO:\" or \"TODO(user):\")" + ,(rx (optional "(" (1+ (not (any ")"))) ")") ":")) + (const :tag "Required colon (matching e.g. \"TODO:\"" ":") + (string :tag "Custom regexp")) + :package-version '(magit-todos . "1.2")) + +(defcustom magit-todos-ignored-keywords '("NOTE" "DONE") + "Ignored keywords. Automatically removed from `magit-todos-keywords'." + :type '(repeat string) + :set (lambda (option value) + (set-default option value) + (when (boundp 'magit-todos-keywords) + ;; Avoid setting `magit-todos-keywords' before it's defined. + + ;; HACK: Testing with `fboundp' is the only way I have been able to find that fixes this + ;; problem. I tried using ":set-after '(magit-todos-ignored-keywords)" on + ;; `magit-todos-keywords', but it had no effect. I looked in the manual, which seems to + ;; suggest that using ":initialize 'custom-initialize-safe-set" might fix it--but that + ;; function is no longer to be found in the Emacs source tree. It was committed in 2005, + ;; and now it's gone, but the manual still mentions it. ??? + (custom-reevaluate-setting 'magit-todos-keywords)))) + +(defcustom magit-todos-keywords 'hl-todo-keyword-faces + "To-do keywords to display in Magit status buffer. +If set to a list variable, may be a plain list or an alist in +which the keys are the keywords. + +When set, sets `magit-todos-search-regexp' to the appropriate +regular expression." + :type '(choice (repeat :tag "Custom list" string) + (const :tag "Keywords from `hl-todo'" hl-todo-keyword-faces) + (variable :tag "List variable")) + :set (lambda (option value) + (set-default option value) + (let ((keywords (cl-typecase value + (null (user-error "Please add some keywords")) + (symbol (if (and (consp (symbol-value value)) + (consp (car (symbol-value value)))) + (mapcar #'car (symbol-value value)) + (symbol-value value))) + (list value)))) + (setq magit-todos-keywords-list (seq-difference keywords magit-todos-ignored-keywords))))) + +(defcustom magit-todos-max-items 10 + "Automatically collapse the section if there are more than this many items." + :type 'integer) + +(defcustom magit-todos-auto-group-items 20 + "Whether or when to automatically group items." + :type '(choice (integer :tag "When there are more than this many items") + (const :tag "Always" always) + (const :tag "Never" never))) + +(defcustom magit-todos-buffer-item-factor 10 + "Multiply `magit-todos-auto-group-items' and `magit-todos-max-items' by this factor in dedicated `magit-todos' buffers." + :type 'integer) + +(defcustom magit-todos-group-by '(magit-todos-item-keyword magit-todos-item-filename) + "How to group items. +One or more attributes may be chosen, and they will be grouped in +order." + :type '(repeat (choice (const :tag "By filename" magit-todos-item-filename) + (const :tag "By keyword" magit-todos-item-keyword) + (const :tag "By suffix" magit-todos-item-suffix) + (const :tag "By first path component" magit-todos-item-first-path-component)))) + +(defcustom magit-todos-fontify-org t + "Fontify items from Org files as Org headings." + :type 'boolean) + +(defcustom magit-todos-sort-order '(magit-todos--sort-by-keyword + magit-todos--sort-by-filename + magit-todos--sort-by-position) + "Order in which to sort items." + :type '(repeat (choice (const :tag "Keyword" magit-todos--sort-by-keyword) + (const :tag "Suffix" magit-todos--sort-by-suffix) + (const :tag "Filename" magit-todos--sort-by-filename) + (const :tag "Buffer position" magit-todos--sort-by-position) + (function :tag "Custom function")))) + +(defcustom magit-todos-depth nil + "Maximum depth of files in repo working tree to scan for to-dos. +A value of 0 means to search only the current directory, while a +value of 1 means to search directories one level deeper, etc. +Deeper scans can be slow in large projects. You may wish to set +this in a directory-local variable for certain projects." + :type '(choice (const :tag "Unlimited" nil) + (const :tag "Repo root directory only" 0) + (integer :tag "N levels below the repo root"))) + +(defcustom magit-todos-insert-at 'bottom + "Insert the to-dos section after this section in the Magit status buffer. +Specific sections may be chosen, using the first symbol returned +by evaluating \"(magit-section-ident (magit-current-section))\" +in the status buffer with point on the desired section, +e.g. `recent' for the \"Recent commits\" section. Note that this +may not work exactly as desired when the built-in scanner is +used." + :type '(choice (const :tag "Top" top) + (const :tag "Bottom" bottom) + (const :tag "After untracked files" untracked) + (const :tag "After unstaged files" unstaged) + (symbol :tag "After selected section"))) + +(defcustom magit-todos-exclude-globs nil + "Glob patterns to exclude from searches." + :type '(repeat string)) + +(defcustom magit-todos-branch-list 'branch + "Show branch diff to-do list. + +This can be toggled locally in Magit buffers with command +`magit-todos-branch-list-toggle'." + :type '(choice (const :tag "Never" nil) + (const :tag "In non-master branches" branch) + (const :tag "Always" t))) + +(defcustom magit-todos-branch-list-merge-base-ref "master" + "Commit ref passed to command \"git merge-base HEAD\". +Determines the ancestor commit from which the current branch's +todos should be searched for. May be overridden in the case that +a branch is branched off another branch rather than master. For +example, consider the following commit graph: + +---A1---A2---A3 (master) + \ + B1---B2---B3 (topic) + \ + C1---C2---C3 (topic2, HEAD) + +By default, the branch todo list would show todos from both the +\"topic\" branch and the \"topic2\" branch. To show only todos +from the \"topic2\" branch, this option could be set to +\"topic\"." + :type 'string) + +;;;; Commands + +;;;###autoload +(define-minor-mode magit-todos-mode + "Show list of to-do items in Magit status buffer for tracked files in repo." + :require 'magit-todos + :group 'magit-todos + :global t + (if magit-todos-mode + (progn + (pcase (lookup-key magit-status-mode-map "jT") + ('nil (define-key magit-status-mode-map "jT" #'magit-todos-jump-to-todos)) + ('magit-todos-jump-to-todos nil) + (_ (message "magit-todos: Not overriding bind of \"jT\" in `magit-status-mode-map'."))) + (magit-add-section-hook 'magit-status-sections-hook + #'magit-todos--insert-todos + nil + 'append) + (add-hook 'magit-status-mode-hook #'magit-todos--add-to-status-buffer-kill-hook 'append)) + ;; Disable mode + (when (equal (lookup-key magit-status-mode-map "jT") #'magit-todos-jump-to-todos) + (define-key magit-status-mode-map "jT" nil)) + (remove-hook 'magit-status-sections-hook #'magit-todos--insert-todos) + (remove-hook 'magit-status-mode-hook #'magit-todos--add-to-status-buffer-kill-hook))) + +(defun magit-todos-update () + "Update the to-do list manually. +Only necessary when option `magit-todos-update' is nil." + (interactive) + (unless magit-todos-mode + (user-error "Please activate `magit-todos-mode'")) + (let ((inhibit-read-only t)) + ;; Delete twice since there might also be the branch-local section. + (magit-todos--delete-section [* todos]) + (magit-todos--delete-section [* todos]) + ;; HACK: See other note on `magit-todos-updating'. + (setq magit-todos-updating t) + (magit-todos--insert-todos))) + +(defun magit-todos-branch-list-toggle () + "Toggle branch diff to-do list in current Magit buffer." + (interactive) + (setq-local magit-todos-branch-list (not magit-todos-branch-list)) + (magit-todos-update)) + +(defun magit-todos-branch-list-set-commit (ref) + "Set commit ref used in branch to-do list." + (interactive (list (completing-read "Refname: " (magit-list-refnames)))) + (setq-local magit-todos-branch-list-merge-base-ref ref) + (magit-todos-update)) + +(cl-defun magit-todos-jump-to-item (&key peek (item (oref (magit-current-section) value))) + "Show current item. +If PEEK is non-nil, keep focus in status buffer window." + (interactive) + (let* ((status-window (selected-window)) + (buffer (magit-todos--item-buffer item))) + (pop-to-buffer buffer) + (magit-todos--goto-item item) + (when (derived-mode-p 'org-mode) + (org-show-entry)) + (when peek + (select-window status-window)))) + +(defun magit-todos-peek-at-item () + "Peek at current item." + (interactive) + (magit-todos-jump-to-item :peek t)) + +;;;;; Jump to section + +(magit-define-section-jumper magit-jump-to-todos "TODOs" todos) + +(defun magit-todos-jump-to-todos () + "Jump to TODOs section, and update it if empty." + (interactive) + (let ((already-in-section-p (magit-section-match [* todos]))) + (magit-jump-to-todos) + (when (and (or (integerp magit-todos-update) + (not magit-todos-update)) + (or already-in-section-p + (= 0 (length (oref (magit-current-section) children))))) + (magit-todos-update)))) + +;;;; Dedicated buffer + +;;;###autoload +(defun magit-todos-list (&optional directory) + "Show to-do list of the current Git repository in a buffer. +With prefix, prompt for repository." + ;; Mostly copied from `magit-status' + (interactive + (let ((magit--refresh-cache (list (cons 0 0)))) + (list (and (or current-prefix-arg (not (magit-toplevel))) + (magit-read-repository))))) + (condition-case nil + (let ((magit--refresh-cache (list (cons 0 0)))) + (setq directory (if directory + (file-name-as-directory (expand-file-name directory)) + default-directory)) + (magit-todos-list-internal directory)) + ('magit-outside-git-repo (cl-letf (((symbol-function 'magit-toplevel) (lambda (&rest _) default-directory))) + (call-interactively #'magit-todos-list))))) + +(put 'magit-todos-list 'interactive-only 'magit-todos-list-internal) + +;;;###autoload +(defun magit-todos-list-internal (directory) + "Open buffer showing to-do list of repository at DIRECTORY." + (magit--tramp-asserts directory) + (let ((default-directory directory)) + (magit-setup-buffer #'magit-todos-list-mode))) + +(define-derived-mode magit-todos-list-mode magit-status-mode "Magit" + "Mode for looking at repository to-do list. + +\\\ +Type \\[magit-refresh] to refresh the list. +Type \\[magit-section-toggle] to expand or hide the section at point. +Type \\[magit-visit-thing] to visit the item at point. +Type \\[magit-diff-show-or-scroll-up] to peek at the item at point." + :group 'magit-todos) + +(defun magit-todos-list-refresh-buffer () + "Refresh the current `magit-todos-list-mode' buffer." + (setq-local magit-todos-max-items (* magit-todos-max-items magit-todos-buffer-item-factor)) + (when (numberp magit-todos-auto-group-items) + (setq-local magit-todos-auto-group-items (* magit-todos-auto-group-items magit-todos-buffer-item-factor))) + (magit-section-show (magit-insert-section (type magit-root-section) + (magit-insert-status-headers) + (magit-todos--insert-todos)))) + +;;;; Functions + +(defun magit-todos--coalesce-groups (groups) + "Return GROUPS, coalescing any groups with `equal' keys. +GROUPS should be an alist. Assumes that each group contains +unique items. Intended for post-processing the result of +`-group-by'." + (cl-loop with keys = (-uniq (-map #'car groups)) + for key in keys + for matching-groups = (--select (equal key (car it)) groups) + collect (cons key (apply #'append (-map #'cdr matching-groups))))) + +(defun magit-todos--add-to-status-buffer-kill-hook () + "Add `magit-todos--kill-active-scan' to `kill-buffer-hook' locally." + (add-hook 'kill-buffer-hook #'magit-todos--kill-active-scan 'append 'local)) + +(defun magit-todos--kill-active-scan () + "Kill `magit-todos-active-scan'. +To be called in status buffers' `kill-buffer-hook'." + (when (and magit-todos-active-scan + (process-live-p magit-todos-active-scan)) + (kill-process magit-todos-active-scan) + (when-let* ((buffer (process-buffer magit-todos-active-scan)) + (alive (buffer-live-p buffer))) + (kill-buffer buffer)))) + +(defun magit-todos--add-to-custom-type (symbol value) + "Add VALUE to the end of SYMBOL's `custom-type' property." + (declare (indent defun)) + (pcase-let* ((`(,type . ,choices) (get symbol 'custom-type)) + (choices (append (list value) choices))) + (put symbol 'custom-type + (append (list type) choices)))) + +(defun magit-todos--choose-scanner () + "Return function to call to scan for items with. +Chooses automatically in order defined in `magit-todos-scanners'." + (cl-loop for scanner in magit-todos-scanners + ;; I guess it would be better to avoid `eval', but it seems like the natural + ;; way to do this. + when (eval (alist-get 'test scanner)) + return (alist-get 'function scanner))) + +(cl-defun magit-todos--scan-callback (&key callback magit-status-buffer results-regexp process &allow-other-keys) + "Call CALLBACK with arguments MAGIT-STATUS-BUFFER and match items. +Match items are a list of `magit-todos-item' found in PROCESS's buffer for RESULTS-REGEXP." + (funcall callback magit-status-buffer + (with-current-buffer (process-buffer process) + (magit-todos--buffer-items results-regexp)))) + +(defun magit-todos--buffer-items (results-regexp) + "Return list of `magit-todos-item' found in current buffer for RESULTS-REGEXP." + (let ((items)) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (--when-let (condition-case err + (magit-todos--line-item results-regexp) + ;; Files with very, very long lines may cause Emacs's regexp matcher to overflow. + ;; Rather than abort the whole scan and raise an error, try to handle it gracefully. + ;; FIXME: This may raise multiple warnings per file. + (error (if (string= "Stack overflow in regexp matcher" (error-message-string err)) + (let ((filename (buffer-substring (point) (1- (re-search-forward ":"))))) + (display-warning 'magit-todos (concat "File has lines too long for Emacs to search. Consider excluding it from scans: " filename))) + (signal (car err) (cdr err))))) + (push it items)) + (forward-line 1))) + (nreverse items))) + +(cl-defun magit-todos--git-diff-callback (&key magit-status-buffer results-regexp search-regexp-elisp process heading + exclude-globs &allow-other-keys) + "Callback for git diff scanner output." + ;; NOTE: Doesn't handle newlines in filenames or diff.mnemonicPrefix. + (cl-macrolet ((next-diff () `(re-search-forward (rx bol "diff --git ") nil t)) + (next-filename () `(when (re-search-forward (rx bol "+++ b/" (group (1+ nonl))) nil t) + (match-string 1))) + (next-hunk-line-number () `(when (re-search-forward (rx bol "@@ -" + (1+ digit) (optional "," (1+ digit)) (1+ space) + "+" (group (1+ digit)) (optional "," (1+ digit))) + file-end t) + (string-to-number (match-string 1)))) + (file-end () `(or (save-excursion + (when (re-search-forward (rx bol "diff --git ") + nil t) + (match-beginning 0))) + (point-max))) + (hunk-end () `(or (save-excursion + (when (re-search-forward (rx (or (seq bol "diff --git ") + (seq bol "@@ "))) + nil t) + (match-beginning 0))) + (point-max)))) + (with-current-buffer (process-buffer process) + (goto-char (point-min)) + (let ((glob-regexps (mapcar #'wildcard-to-regexp exclude-globs)) + items filename file-end hunk-end line-number) + (while (next-diff) + (while (setf filename (next-filename)) + (unless (--some? (string-match it filename) glob-regexps) + (setf file-end (file-end)) + (while (setf line-number (next-hunk-line-number)) + (setf hunk-end (hunk-end)) + (while (re-search-forward (rx bol "+") hunk-end t) + ;; Since "git diff-index" doesn't accept PCREs to its "-G" option, we have to test the search regexp ourselves. + (when (re-search-forward search-regexp-elisp (line-end-position) t) + (when-let* ((line (buffer-substring (line-beginning-position) (line-end-position))) + (item (with-temp-buffer + ;; NOTE: We fake grep output by inserting the filename, line number, position, etc. + ;; This lets us use the same results regexp that's used for grep-like output. + (save-excursion + (insert filename ":" (number-to-string line-number) ":0: " line)) + (magit-todos--line-item results-regexp filename)))) + (push item items))) + (cl-incf line-number)))))) + (let ((magit-todos-section-heading heading)) + (magit-todos--insert-items magit-status-buffer items :branch-p t)))))) + +(defun magit-todos--delete-section (condition) + "Delete the section specified by CONDITION from the Magit status buffer. +See `magit-section-match'. Also delete it from root section's children." + (save-excursion + (goto-char (point-min)) + (when-let ((section (cl-loop until (magit-section-match condition) + ;; Use `forward-line' instead of `magit-section-forward' because + ;; sometimes it skips our section. + do (forward-line 1) + when (eobp) + return nil + finally return (magit-current-section)))) + ;; Delete the section from root section's children. This makes the section-jumper command + ;; work when a replacement section is inserted after deleting this section. + (object-remove-from-list magit-root-section 'children section) + (with-slots (start end) section + ;; NOTE: We delete 1 past the end because we insert a newline after the section. I'm not + ;; sure if this would generalize to all Magit sections. But if the end is the same as + ;; `point-max', which may be the case if todo items have not yet been inserted, we only + ;; delete up to `point-max'. + (delete-region start (if (= end (point-max)) + end + (1+ end))))))) + +(defun magit-todos--item-buffer (item) + "Return buffer visiting ITEM." + (or (find-buffer-visiting (magit-todos-item-filename item)) + (find-file-noselect (magit-todos-item-filename item)))) + +(defun magit-todos--goto-item (item) + "Move point to ITEM. +Assumes current buffer is ITEM's buffer." + (pcase-let* (((cl-struct magit-todos-item position line column keyword) item)) + (if position + (goto-char position) + (goto-char (point-min)) + (forward-line (1- line)) + (if column + (forward-char column) + (when (re-search-forward (regexp-quote keyword) (line-end-position) t) + (goto-char (match-beginning 0))))))) + +(defun magit-todos--insert-todos () + "Insert to-do items into current buffer. +This function should be called from inside a ‘magit-status’ buffer." + (declare (indent defun)) + (when magit-todos-active-scan + ;; Avoid running multiple scans for a single magit-status buffer. + (let ((buffer (process-buffer magit-todos-active-scan))) + (when (process-live-p magit-todos-active-scan) + (delete-process magit-todos-active-scan)) + (when (buffer-live-p buffer) + (kill-buffer buffer))) + (setq magit-todos-active-scan nil)) + (pcase magit-todos-update + ((or 't ; Automatic + ;; Manual and updating now + (and 'nil (guard magit-todos-updating)) + ;; Caching and cache expired + (and (pred integerp) (guard (or magit-todos-updating ; Forced update + (>= (float-time + (time-subtract (current-time) + magit-todos-last-update-time)) + magit-todos-update) + (null magit-todos-last-update-time))))) + ;; Scan and insert. + ;; HACK: I don't like setting a special var here, because it seems like lexically binding a + ;; special var should follow down the chain, but it isn't working, so we'll do this. + (setq magit-todos-updating t) + (setq magit-todos-active-scan (funcall magit-todos-scanner + :callback #'magit-todos--insert-items + :magit-status-buffer (current-buffer) + :directory default-directory + :depth magit-todos-depth))) + (_ ; Caching and cache not expired, or not automatic and not manually updating now + (magit-todos--insert-items (current-buffer) magit-todos-item-cache))) + (when (or (eq magit-todos-branch-list t) + (and (eq magit-todos-branch-list 'branch) + (not (string= "master" (magit-get-current-branch))))) + ;; Insert branch-local items. + (magit-todos--scan-with-git-diff :magit-status-buffer (current-buffer) + :directory default-directory + :depth magit-todos-depth + :heading (format "TODOs (branched from %s)" magit-todos-branch-list-merge-base-ref)))) + +(cl-defun magit-todos--insert-items (magit-status-buffer items &key branch-p) + "Insert to-do ITEMS into MAGIT-STATUS-BUFFER. +If BRANCH-P is non-nil, do not update `magit-todos-item-cache', +`magit-todos-last-update-time', and `magit-todos-updating'." + (declare (indent defun)) + ;; NOTE: This could be factored out into some kind of `magit-insert-section-async' macro if necessary. + ;; MAYBE: Use `magit-insert-section-body'. + (when (not (buffer-live-p magit-status-buffer)) + (message "`magit-todos--insert-items-callback': Callback called for deleted buffer")) + (let* ((items (magit-todos--sort items)) + (num-items (length items)) + (group-fns (pcase magit-todos-auto-group-items + ('never nil) + ('always magit-todos-group-by) + ((pred integerp) (when (> num-items magit-todos-auto-group-items) + magit-todos-group-by)) + (_ (error "Invalid value for magit-todos-auto-group-items")))) + (magit-todos-show-filenames (not (member 'magit-todos-item-filename group-fns))) + (magit-section-show-child-count t) + ;; HACK: "For internal use only." But this makes collapsing the new section work! + (magit-insert-section--parent magit-root-section) + (inhibit-read-only t)) + (when (buffer-live-p magit-status-buffer) + ;; Don't try to select a killed status buffer + (with-current-buffer magit-status-buffer + (unless branch-p + ;; Don't do any of this for the branch-diff scanner. + (when magit-todos-updating + (when (or (null magit-todos-update) ; Manual updates + (integerp magit-todos-update)) ; Caching + (setq magit-todos-item-cache items) + (setq magit-todos-last-update-time (current-time))) + ;; HACK: I don't like setting this special var, but it works. See other comment where + ;; it's set t. + (setq magit-todos-updating nil))) + (save-excursion + ;; Insert items + (goto-char (point-min)) + ;; Go to insertion position + (pcase magit-todos-insert-at + ('top (cl-loop for ((this-section . _) . _) = (magit-section-ident (magit-current-section)) + until (not (member this-section '(branch tags))) + do (magit-section-forward))) + ('bottom (goto-char (oref (-last-item (oref magit-root-section children)) end))) + (_ (magit-todos--skip-section (vector '* magit-todos-insert-at)))) + ;; Insert section + (let ((reminder (if magit-todos-update + "" ; Automatic updates: no reminder + ;; Manual updates: remind user + " (update manually)"))) + (if (not items) + (unless magit-todos-update + ;; Manual updates: Insert section to remind user + (let ((magit-insert-section--parent magit-root-section)) + (magit-insert-section (todos) + (magit-insert-heading (concat (propertize magit-todos-section-heading 'face 'magit-section-heading) + " (0)" reminder "\n"))))) + (let ((section (magit-todos--insert-groups :type 'todos + :heading (format "%s (%s)%s" + (propertize magit-todos-section-heading 'face 'magit-section-heading) + num-items reminder) + :group-fns group-fns + :items items + :depth 0))) + (insert "\n") + (magit-todos--set-visibility :section section :num-items num-items))))))))) + +(cl-defun magit-todos--insert-groups (&key depth group-fns heading type items) + "Insert ITEMS into grouped Magit section and return the section. + +DEPTH sets indentation and should be 0 for a top-level group. It +is automatically incremented when this function calls itself. + +GROUP-FNS may be a list of functions to which ITEMS are applied +with `-group-by' to group them. Items are grouped +hierarchically, i.e. when GROUP-FNS has more than one function, +items are first grouped by the first function, then subgroups are +created which group items by subsequent functions. + +HEADING is a string which is the group's heading. The count of +items in each group is automatically appended. + +TYPE is a symbol which is used by Magit internally to identify +sections." + ;; NOTE: `magit-insert-section' seems to bind `magit-section-visibility-cache' to nil, so setting + ;; visibility within calls to it probably won't work as intended. + (declare (indent defun)) + (let* ((indent (s-repeat (* 2 depth) " ")) + (heading (concat indent heading)) + (magit-insert-section--parent (if (= 0 depth) + magit-root-section + magit-insert-section--parent))) + (if (and (consp group-fns) + (> (length group-fns) 0)) + ;; Insert more groups + (let* ((groups (--> (-group-by (car group-fns) items) + (cl-loop for group in-ref it + ;; HACK: Set ":" keys to nil so they'll be grouped together. + do (pcase (car group) + (":" (setf (car group) nil))) + finally return it) + (magit-todos--coalesce-groups it))) + (section (magit-insert-section ((eval type)) + (magit-insert-heading heading) + (cl-loop for (group-type . items) in groups + for group-name = (pcase group-type + ;; Use "[Other]" instead of empty group name. + ;; HACK: ":" is hard-coded, even though the + ;; suffix regexp could differ. If users change + ;; the suffix so this doesn't apply, it + ;; shouldn't cause any problems, it just won't + ;; look as pretty. + ((or "" ":" 'nil) "[Other]") + (_ (s-chop-suffix ":" group-type))) + do (magit-todos--insert-groups + :depth (1+ depth) :group-fns (cdr group-fns) + :type (intern group-name) :items items + :heading (concat + (if (and magit-todos-fontify-keyword-headers + (member group-name magit-todos-keywords-list)) + (propertize group-name 'face (magit-todos--keyword-face group-name)) + group-name) + ;; Item count + (if (= 1 (length group-fns)) + ":" ; Let Magit add the count. + ;; Add count ourselves. + (concat " " (format "(%s)" (length items)))))))))) + (magit-todos--set-visibility :depth depth :num-items (length items) :section section) + ;; Add top-level section to root section's children + (when (= 0 depth) + (push section (oref magit-root-section children))) + ;; Don't forget to return the section! + section) + ;; Insert individual to-do items + (magit-todos--insert-group :depth (1+ depth) :type type :items items :heading heading)))) + +(cl-defun magit-todos--insert-group (&key depth heading type items) + "Insert ITEMS into Magit section and return the section. + +DEPTH sets indentation and should be 0 for a top-level group. + +HEADING is a string which is the group's heading. The count of +items in each group is automatically appended. + +TYPE is a symbol which is used by Magit internally to identify +sections." + ;; NOTE: `magit-insert-section' seems to bind `magit-section-visibility-cache' to nil, so setting + ;; visibility within calls to it probably won't work as intended. + (declare (indent defun)) + (let* ((indent (s-repeat (* 2 depth) " ")) + (magit-insert-section--parent (if (= 0 depth) + magit-root-section + magit-insert-section--parent)) + (width (- (window-text-width) depth)) + (section (magit-insert-section ((eval type)) + (magit-insert-heading heading) + (dolist (item items) + (let* ((filename (propertize (magit-todos-item-filename item) 'face 'magit-filename)) + (string (--> (concat indent + (when magit-todos-show-filenames + (concat filename " ")) + (funcall (if (s-suffix? ".org" filename) + #'magit-todos--format-org + #'magit-todos--format-plain) + item)) + (truncate-string-to-width it width)))) + (magit-insert-section (todos-item item) + (insert string "\n"))))))) + (magit-todos--set-visibility :depth depth :num-items (length items) :section section) + ;; Don't forget to return the section! + section)) + +(cl-defun magit-todos--set-visibility (&key section num-items depth) + "Set the visibility of SECTION. + +If the section's visibility is cached by Magit, the cached +setting is applied. Otherwise, visibility is set according to +whether NUM-ITEMS is greater than `magit-todos-max-items'. + +When DEPTH is greater than 0, NUM-ITEMS is compared to +`magit-todos-max-items' divided by DEPTH multiplied by 2, +i.e. the max number of items which cause sections to be +automatically hidden halves at each deeper level." + (declare (indent defun)) + (pcase (magit-section-cached-visibility section) + ('hide (magit-section-hide section)) + ('show (magit-section-show section)) + (_ (if (> num-items (pcase depth + (0 magit-todos-max-items) + (_ (/ magit-todos-max-items (* depth 2))))) + ;; HACK: We have to do this manually because the set-visibility-hook doesn't work. + (magit-section-hide section) + ;; Not hidden: show section manually (necessary for some reason) + (magit-section-show section))))) + +(defun magit-todos--skip-section (condition) + "Move past the section matching CONDITION. +See `magit-section-match'." + (goto-char (point-min)) + (cl-loop until (magit-section-match condition) + do (magit-section-forward)) + (cl-loop until (not (magit-section-match condition)) + do (condition-case nil + ;; `magit-section-forward' raises an error when there are no more sections. + (magit-section-forward) + (error (progn + (goto-char (1- (point-max))) + (cl-return)))))) + +(cl-defun magit-todos--line-item (regexp &optional filename) + "Return item on current line, parsing current buffer with REGEXP. +FILENAME is added to the item as its filename. Sets match data. +This should be called in a process's output buffer from one of +the async callback functions. The calling function should +advance to the next line." + (let ((case-fold-search magit-todos-ignore-case)) + (when (re-search-forward regexp (line-end-position) t) + (make-magit-todos-item :filename (or filename + (match-string 8)) + :line (--when-let (match-string 2) + (string-to-number it)) + :column (--when-let (match-string 3) + (string-to-number it)) + :position (--when-let (match-string 9) + (string-to-number it)) + :org-level (match-string 1) + :keyword (match-string 4) + :suffix (match-string 6) + :description (match-string 5))))) + +(defun magit-todos--keyword-face (keyword) + "Return face for KEYWORD." + ;; TODO(alphapapa): Instead of upcasing here, upcase in the lookup, so it can still be displayed + ;; non-uppercase. Preserving the distinction might be useful. + (when magit-todos-ignore-case + (setq keyword (upcase keyword))) + (let ((face (assoc-default keyword hl-todo-keyword-faces #'string=))) + (cl-typecase face + (string (list :inherit 'hl-todo :foreground face)) + (t face)))) + +(defun magit-todos--fontify-like-in-org-mode (s &optional odd-levels) + "Fontify string S like in Org-mode. + +`org-fontify-like-in-org-mode' is a very, very slow function +because it creates a new temporary buffer and runs `org-mode' for +every string it fontifies. This function reuses a single +invisible buffer and only runs `org-mode' when the buffer is +created." + (let ((buffer (get-buffer " *magit-todos--fontify-like-in-org-mode*"))) + (unless buffer + (setq buffer (get-buffer-create " *magit-todos--fontify-like-in-org-mode*")) + (with-current-buffer buffer + (buffer-disable-undo) + (org-mode))) + (with-current-buffer buffer + (erase-buffer) + (insert s) + (let ((org-odd-levels-only odd-levels)) + (font-lock-ensure) + (buffer-string))))) + +(defun magit-todos-item-first-path-component (item) + "Return ITEM's first directory. +This assumes that ITEM's filename is already set to a path +relative to the repo's directory (i.e. this would not be very +useful with absolute paths)." + (car (f-split (magit-todos-item-filename item)))) + +(cl-defun magit-todos--async-start-process (name &key command finish-func) + "Start the executable PROGRAM asynchronously. See `async-start'. +PROGRAM is passed PROGRAM-ARGS, calling FINISH-FUNC with the +process object when done. If FINISH-FUNC is nil, the future +object will return the process object when the program is +finished. Set DEFAULT-DIRECTORY to change PROGRAM's current +working directory. + +This is a copy of `async-start-process' that does not override +`process-connection-type'. It also uses keyword arguments." + (declare (indent defun)) + ;; TODO: Drop this function when possible. See + ;; . + (let* ((args (cdr command)) + (command (car command)) + (buf (generate-new-buffer (concat " *" name "*"))) + (proc (apply #'start-file-process name buf command args))) + (with-current-buffer buf + (set-process-query-on-exit-flag proc nil) + (set (make-local-variable 'async-callback) finish-func) + (set-process-sentinel proc #'magit-todos--async-when-done) + (unless (string= name "emacs") + (set (make-local-variable 'async-callback-for-process) t)) + proc))) + +(defun magit-todos--async-when-done (proc &optional _change) + "Process sentinel used to retrieve the value from the child process. + +This is a copy of `async-when-done' that does not raise an error +if the process's buffer has already been deleted." + ;; I wish it weren't necessary to copy this function here, but at the moment it seems like the + ;; only reasonable way to work around this problem of `async-when-done' trying to select deleted + ;; buffers. I already tried not deleting the buffers, but then I got bug reports about that and + ;; had to revert it. I don't know if I'm encountering a bug in my code, in `async', or in Emacs + ;; itself, because it seems that `async-when-done' is being called on the wrong buffers: When I'm + ;; connected with `matrix-client', and when I have a Magit status buffer opened with + ;; `magit-todos-mode' active, then when one of the `url' process buffers from Matrix gets its + ;; sentinel called, I get an error from `async-when-done' trying to select the already-deleted + ;; `rg' scanner buffer! It's as if Emacs is mixing up the process buffers. I really don't know + ;; what's going on. But maybe I can work around it by copying this function and checking whether + ;; the process's buffer is alive. + ;; NOTE: TRAMP processes seem to have the status `signal' instead of + ;; `exit'. I can't find documentation as to why. + (when (and (memq (process-status proc) '(exit signal)) + (buffer-live-p (process-buffer proc))) + (with-current-buffer (process-buffer proc) + (let ((async-current-process proc)) + ;; TRAMP processes seem to have the exit status 9 instead of + ;; 0. I can't find documentation or code about it. + (if (memq (process-exit-status proc) '(0 9)) + (if async-callback-for-process + (if async-callback + (prog1 + (funcall async-callback proc) + (unless async-debug + (kill-buffer (current-buffer)))) + (set (make-local-variable 'async-callback-value) proc) + (set (make-local-variable 'async-callback-value-set) t)) + (goto-char (point-max)) + (backward-sexp) + (async-handle-result async-callback (read (current-buffer)) + (current-buffer))) + (set (make-local-variable 'async-callback-value) + (list 'error + (format "Async process '%s' failed with exit code %d" + (process-name proc) (process-exit-status proc)))) + (set (make-local-variable 'async-callback-value-set) t)))))) + +;;;;; Formatters + +(defun magit-todos--format-plain (item) + "Return ITEM formatted as from a non-Org file." + (format "%s%s %s" + (propertize (magit-todos-item-keyword item) + 'face (magit-todos--keyword-face (magit-todos-item-keyword item))) + (or (magit-todos-item-suffix item) "") + (or (magit-todos-item-description item) ""))) + +(defun magit-todos--format-org (item) + "Return ITEM formatted as from an Org file." + (magit-todos--fontify-like-in-org-mode + (concat (magit-todos-item-org-level item) " " + (magit-todos-item-keyword item) " " + (magit-todos-item-description item)))) + +;;;;; Sorting + +(defun magit-todos--sort (items) + "Return ITEMS sorted according to `magit-todos-sort-order'." + (dolist (fn (reverse magit-todos-sort-order) items) + (setq items (sort items fn)))) + +(defun magit-todos--sort-by-keyword (a b) + "Return non-nil if A's keyword is before B's in `magit-todos-keywords-list'." + (cl-flet ((keyword-index (keyword) + (or (-elem-index keyword magit-todos-keywords-list) 0))) + (< (keyword-index (magit-todos-item-keyword a)) + (keyword-index (magit-todos-item-keyword b))))) + +(defun magit-todos--sort-by-position (a b) + "Return non-nil if A's position in its file is before B's." + (let ((a-position (or (magit-todos-item-position a) + (magit-todos-item-line a))) + (b-position (or (magit-todos-item-position b) + (magit-todos-item-line b)))) + (< a-position b-position))) + +(defun magit-todos--sort-by-filename (a b) + "Return non-nil if A's filename is `string<' B's." + (string< (magit-todos-item-filename a) + (magit-todos-item-filename b))) + +(defun magit-todos--sort-by-suffix (a b) + "Return non-nil if A's suffix is `string<' B's." + (string< (magit-todos-item-suffix a) + (magit-todos-item-suffix b))) + +;;;; Scanners + +(cl-defmacro magit-todos-defscanner (name &key test command results-regexp + (callback (function 'magit-todos--scan-callback))) + "Define a `magit-todos' scanner named NAME. + +NAME is a string, which may contain spaces. It is only used for +descriptive purposes. + +TEST is an unquoted sexp which is used to determine whether the +scanner is usable. In most cases, it should use +`executable-find' to look for the scanner command. + +COMMAND is a sexp which should evaluate to the scanner command, +i.e. a list of strings to be eventually passed to +`start-process'. Nil elements are removed, numbers are converted +to strings, and nested lists are flattened into a single list. +It is evaluated each time the scanner is run. + +Within the COMMAND list these variables are available: + +`depth': When non-nil, an integer, which is the depth that should +be passed to the scanner's max-depth option (i.e. `magit-todos-depth'). + +`directory': The directory in which the scan should be run. + +`extra-args': The value of the customization variable +\"magit-todos-NAME-extra-args\" (see below). + +`keywords': List of item keywords defined in +`magit-todos-keywords-list'. + +`search-regexp-pcre': PCRE-compatible regular expression to be passed +to the scanner process. + +`search-regexp-elisp': Emacs regular expression, which may be +used for scanners written as Emacs Lisp functions. + +RESULTS-REGEXP is an optional string or unquoted sexp which is +used to match results in the scanner process's output buffer. +Typically this will be a sexp which calls `rx-to-string'. It is +evaluated each time the scanner is run. If nil, the appropriate +default is used which matches results in the form: + + FILENAME:LINE:MATCH + +Where MATCH may also match Org outline heading stars when +appropriate. Custom regexps may also match column numbers or +byte offsets in the appropriate numbered groups; see +`make-magit-todos-item'. + +CALLBACK is called to process the process's output buffer. +Normally the default should be used, which inserts items into the +Magit status buffer which is passed as an argument to the scanner +function. + +The macro defines the following: + +\"magit-todos-NAME-extra-args\": A customization setting, a list +of strings to be passed to the scanner as extra arguments. + +\"magit-todos--scan-with-NAME\": The function which runs the +scanner command. + +It also adds the scanner to the customization variable +`magit-todos-scanner', and to the variable +`magit-todos-scanners' (which is used to set +`magit-todos-scanner' by calling `magit-todos--choose-scanner')." + ;; TODO: Try to obviate the -scanners variable, let --choose-scanner use the + ;; custom-type of -scanner directly. Maybe, anyway--I don't want to ugly up the UI + ;; for users. + (declare (indent defun) (debug (stringp [&rest &or [":test" def-form] + [":command" def-form] + [":results-regexp" [&or stringp def-form]]]))) + (let* ((name-without-spaces (s-replace " " "-" name)) + (scan-fn-name (concat "magit-todos--scan-with-" name-without-spaces)) + (scan-fn-symbol (intern scan-fn-name)) + (extra-args-var (intern (format "magit-todos-%s-extra-args" name-without-spaces)))) + `(progn + (defcustom ,extra-args-var nil + ,(format "Extra arguments passed to %s." name) + :type '(repeat string)) + + ;; NOTE: Both the macro and the macro-defined function have `callback' arguments. Pay attention to unquoting. + ;; FIXME: That is confusing. + + (cl-defun ,scan-fn-symbol (&key magit-status-buffer directory depth heading sync callback) + ,(format "Scan for to-dos with %s, then call `%s'. +MAGIT-STATUS-BUFFER is what it says. DIRECTORY is the directory in which to run the scan. DEPTH should be an integer, typically the value of `magit-todos-depth'. HEADING is passed to `%s'. + +When SYNC is nil, the scanner process is returned, and CALLBACK +is a function which is called by the process sentinel with one +argument, a list of match items. + +When SYNC is non-nil, match items are returned." + name callback callback) + (let* ((process-connection-type 'pipe) + (directory (f-relative directory default-directory)) + (extra-args (when ,extra-args-var + (--map (s-split (rx (1+ space)) it 'omit-nulls) + ,extra-args-var))) + (keywords magit-todos-keywords-list) + (search-regexp-elisp (rx-to-string + `(or + ;; Org item + (seq bol (group (1+ "*")) + (1+ blank) + (group (or ,@keywords)) + (1+ space) + (group (1+ not-newline))) + ;; Non-Org + (seq (or bol (1+ blank)) + (group (or ,@keywords)) + (regexp ,magit-todos-keyword-suffix) + (optional (1+ blank) + (group (1+ not-newline))))))) + (search-regexp-pcre (rxt-elisp-to-pcre search-regexp-elisp)) + (results-regexp (or ,results-regexp + (rx-to-string + `(seq bol + ;; Filename + (group-n 8 (1+ (not (any ":")))) ":" + ;; Line + (group-n 2 (1+ digit)) ":" + (or + ;; Org item + (seq (group-n 1 (1+ "*")) + (1+ blank) + (group-n 4 (or ,@keywords)) + (1+ blank) + (group-n 5 (1+ not-newline))) + ;; Non-Org + (seq (optional (1+ not-newline)) + (group-n 4 (or ,@keywords)) + (optional (group-n 6 (regexp ,magit-todos-keyword-suffix))) + (optional (1+ blank)) + (optional (group-n 5 (1+ not-newline))))))))) + (command (-flatten + (-non-nil + (list (when magit-todos-nice + (list "nice" "-n5")) + ,command))))) + ;; Convert any numbers in command to strings (e.g. depth). + (cl-loop for elt in-ref command + when (numberp elt) + do (setf elt (number-to-string elt))) + ;; Run command. + (if sync + ;; Synchronous: return matching items. + (with-temp-buffer + (unless (= 0 (apply #'call-process (car command) nil (current-buffer) nil + (cdr command))) + (user-error (concat (car command) " failed"))) + (magit-todos--buffer-items results-regexp)) + ;; Async: return process. + (magit-todos--async-start-process ,scan-fn-name + :command command + ;; NOTE: This callback chain. + :finish-func (apply-partially ,callback + :callback callback + :magit-status-buffer magit-status-buffer + :results-regexp results-regexp + :search-regexp-elisp search-regexp-elisp + :heading heading + :exclude-globs magit-todos-exclude-globs + :process))))) ; Process is appended to the list. + (magit-todos--add-to-custom-type 'magit-todos-scanner + (list 'const :tag ,name #',scan-fn-symbol)) + (add-to-list 'magit-todos-scanners + (list (cons 'name ,name) + (cons 'function #',scan-fn-symbol) + (cons 'test ',test)) + 'append)))) + +;; NOTE: These scanners handle the max-depth option differently. git-grep seems to handle it in the +;; most useful way, with a setting of 0 meaning to look no deeper than the current directory, and a +;; setting of 1 searching directories one level deeper. In comparison, rg and find effectively +;; subtract one from the value, as a setting of 0 returns no results, and a setting of 1 searches +;; only the current directory (which means that when the max-depth is set to 0, the whole command is +;; essentially a no-op, which is pointless). Since we want `magit-todos-depth' to behave +;; consistently with all scanners, we will treat it the way git-grep does, and for the other +;; scanners we'll add one to its value. + +(magit-todos-defscanner "rg" + :test (executable-find "rg") + :command (list "rg" "--no-heading" "--line-number" + (when depth + (list "--maxdepth" (1+ depth))) + (when magit-todos-ignore-case + "--ignore-case") + (when magit-todos-exclude-globs + (--map (list "--glob" (concat "!" it)) + magit-todos-exclude-globs)) + extra-args search-regexp-pcre directory)) + +(magit-todos-defscanner "git grep" + :test (string-match "--perl-regexp" (shell-command-to-string "git grep --magit-todos-testing-git-grep")) + :command (list "git" "--no-pager" "grep" + "--full-name" "--no-color" "-n" + (when depth + (list "--max-depth" depth)) + (when magit-todos-ignore-case + "--ignore-case") + "--perl-regexp" + "-e" search-regexp-pcre + extra-args "--" directory + (when magit-todos-exclude-globs + (--map (concat ":!" it) + magit-todos-exclude-globs)))) + +(magit-todos-defscanner "git diff" + ;; NOTE: This scanner implements the regexp *searching* in elisp rather than in the + ;; external process because, unlike "git grep", "git diff" does not support PCRE. + :test t + :command (progn + ;; Silence byte-compiler warnings about these vars we don't use in this scanner. + (ignore search-regexp-elisp search-regexp-pcre extra-args directory depth) + (list "git" "--no-pager" "diff" "--no-color" "-U0" + (-> "git merge-base HEAD " + (concat magit-todos-branch-list-merge-base-ref) + shell-command-to-string + string-trim))) + :callback 'magit-todos--git-diff-callback) + +(magit-todos-defscanner "find|grep" + ;; NOTE: The filenames output by find|grep have a leading "./". I don't expect this scanner to be + ;; used much, if at all, so I'm not going to go to the trouble to fix this now. + :test (string-match "--perl-regexp" (shell-command-to-string "grep --help")) + :command (let* ((grep-find-template (progn + (unless grep-find-template + (grep-compute-defaults)) + (->> grep-find-template + (s-replace " grep " " grep -b -E ") + (s-replace " -nH " " -H ")))) + (_ (when depth + (setq grep-find-template + (s-replace " " (concat " -maxdepth " (1+ depth) " ") + grep-find-template))))) + ;; Modified from `rgrep-default-command' + (list "find" directory + (list (when grep-find-ignored-directories + (list "-type" "d" + "(" "-path" + (-interpose (list "-o" "-path") + (-non-nil (--map (cond ((stringp it) + (concat "*/" it)) + ((consp it) + (and (funcall (car it) it) + (concat "*/" (cdr it))))) + grep-find-ignored-directories))) + ")" "-prune")) + (when grep-find-ignored-files + (list "-o" "-type" "f" + "(" "-name" + (-interpose (list "-o" "-name") + (--map (cond ((stringp it) it) + ((consp it) (and (funcall (car it) it) + (cdr it)))) + grep-find-ignored-files)) + ")" "-prune")) + (when magit-todos-exclude-globs + (list "-o" "(" + (--map (list "-iname" it) + magit-todos-exclude-globs) + ")" "-prune"))) + (list "-o" "-type" "f") + ;; NOTE: This uses "grep -P", i.e. "Interpret the pattern as a + ;; Perl-compatible regular expression (PCRE). This is highly + ;; experimental and grep -P may warn of unimplemented features." But it + ;; does seem to work properly, at least on GNU grep. Using "grep -E" + ;; with this PCRE regexp doesn't work quite right, as it doesn't match + ;; all the keywords, but pcre2el doesn't convert to "extended regular + ;; expressions", so this will have to do. Maybe we should test whether + ;; the version of grep installed supports "-P". + ;; NOTE: For some reason, when "-execdir" is used, the callback function is never + ;; called, even though the process terminates and its buffer has the correct + ;; output. It works correctly when "-exec" is used, so we use that. + (list "-exec" "grep" "-bPH" + (when magit-todos-ignore-case + "--ignore-case") + extra-args + search-regexp-pcre "{}" "+")))) + +;;;;; Set scanner default value + +;; Now that all the scanners have been defined, we can set the value. +(custom-reevaluate-setting 'magit-todos-scanner) + +;;;; Helm/Ivy + +;; These add optional support for Helm and Ivy. This code does not require +;; Helm or Ivy to be installed; it is only called after one of them is loaded. + +(declare-function helm-make-source "ext:helm-source") + +(with-eval-after-load 'helm + (defvar helm-magit-todos-source + ;; We use `helm-make-source' instead of `helm-make-sync-source', which is a + ;; macro, which won't be present if the user doesn't have Helm installed. + (helm-make-source "helm-magit-todos" 'helm-source-sync + :candidates #'magit-todos-candidates + :action (lambda (item) + (magit-todos-jump-to-item :item item)))) + + (defun helm-magit-todos () + "Display `magit-todos' items with Helm. +Note that this uses `magit-todos-items-cache' when a Magit status +buffer is available for the repository directory, in which case +the cache is not updated from this command." + (interactive) + (helm :sources '(helm-magit-todos-source)))) + +(declare-function ivy-read "ext:ivy") + +(with-eval-after-load 'ivy + (defvar ivy-magit-todos-history nil + "History for `ivy-magit-todos'.") + + (defun ivy-magit-todos () + "Display `magit-todos' items with Ivy. +Note that this uses `magit-todos-items-cache' when a Magit status +buffer is available for the repository directory, in which case +the cache is not updated from this command." + (interactive) + (ivy-read "TODOs: " (magit-todos-candidates) + :action (lambda (item) + (magit-todos-jump-to-item :item (cdr item))) + :history 'ivy-magit-todos-history + :caller 'ivy-magit-todos))) + +;;;;; Support + +;; These functions are used by both Helm and Ivy. + +(defsubst magit-todos-item-cons (item) + "Return ITEM as a (DISPLAY . ITEM) pair. +Used for e.g. Helm and Ivy." + (cons (concat (magit-todos-item-filename item) " " + (funcall (if (s-suffix? ".org" (magit-todos-item-filename item)) + #'magit-todos--format-org + #'magit-todos--format-plain) + item)) + item)) + +(defun magit-todos-candidates () + "Return list of (DISPLAY . ITEM) candidates for e.g. Helm and Ivy." + ;; MAYBE: Update the cache appropriately from here. + (if-let* ((magit-status-buffer (magit-get-mode-buffer 'magit-status-mode)) + (items (buffer-local-value 'magit-todos-item-cache magit-status-buffer))) + ;; Use cached items. + (cl-loop for item in items + collect (magit-todos-item-cons item)) + ;; No cached items: run scan. + (when-let* ((items (funcall magit-todos-scanner :sync t + :directory default-directory + :depth magit-todos-depth))) + (cl-loop for item in items + collect (magit-todos-item-cons item))))) + +;;;; Footer + +(provide 'magit-todos) + +;;; magit-todos.el ends here -- 2.47.3