1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-04-24 08:49:30 +08:00
commit 85a9757b3c
6 changed files with 145 additions and 38 deletions

View file

@ -33,7 +33,7 @@
function get_commit_changes(commit_sha, changes, cmd, i, j, len, \ function get_commit_changes(commit_sha, changes, cmd, i, j, len, \
bits, filename) { bits, filename) {
# Collect all the files touched in the specified commit. # Collect all the files touched in the specified commit.
cmd = ("git log -1 --name-status --format= " commit_sha) cmd = ("git show --name-status --first-parent --format= " commit_sha)
while ((cmd | getline) > 0) { while ((cmd | getline) > 0) {
for (i = 2; i <= NF; i++) { for (i = 2; i <= NF; i++) {
len = split($i, bits, "/") len = split($i, bits, "/")
@ -59,15 +59,28 @@ function check_commit_msg_files(commit_sha, verbose, changes, good, \
if (verbose && ! msg) if (verbose && ! msg)
msg = $0 msg = $0
# Find lines that reference files. We look at any line starting # Find file entries in the commit message. We look at any line
# with "*" (possibly prefixed by "; ") where the file part starts # starting with "*" (possibly prefixed by "; ") followed by a ":",
# with an alphanumeric character. The file part ends if we # possibly on a different line. If we encounter a blank line
# encounter any of the following characters: [ ( < { : # without seeing a ":", then we don't treat that as a file entry.
if (/^(; )?\*[ \t]+[[:alnum:]]/ && match($0, /[[:alnum:]][^[(<{:]*/)) {
# There might be multiple files listed on this line, separated
# by spaces (and possibly a comma). Iterate over each of them.
split(substr($0, RSTART, RLENGTH), filenames, ",?([[:blank:]]+|$)")
# Accumulate the contents of a (possible) file entry.
if (/^[ \t]*$/)
filenames_str = ""
else if (/^(; )?\*[ \t]+[[:alnum:]]/)
filenames_str = $0
else if (filenames_str)
filenames_str = (filenames_str $0)
# We have a file entry; analyze it.
if (filenames_str && /:/) {
# Delete the leading "*" and any trailing information.
sub(/^(; )?\*[ \t]+/, "", filenames_str)
sub(/[ \t]*[[(<:].*$/, "", filenames_str)
# There might be multiple files listed in this entry, separated
# by spaces (and possibly a comma). Iterate over each of them.
split(filenames_str, filenames, ",[ \t]+")
for (i in filenames) { for (i in filenames) {
# Remove trailing slashes from any directory entries. # Remove trailing slashes from any directory entries.
sub(/\/$/, "", filenames[i]) sub(/\/$/, "", filenames[i])
@ -83,6 +96,8 @@ function check_commit_msg_files(commit_sha, verbose, changes, good, \
good = 0 good = 0
} }
} }
filenames_str = ""
} }
} }
close(cmd) close(cmd)

View file

@ -39,29 +39,32 @@ else
fi fi
# Standard input receives lines of the form: # Standard input receives lines of the form:
# <local ref> SP <local name> SP <remote ref> SP <remote name> LF # <local ref> SP <local sha> SP <remote ref> SP <remote sha> LF
$awk -v origin_name="$1" ' $awk -v origin_name="$1" '
# If the local SHA is all zeroes, ignore it. # If the local SHA is all zeroes, ignore it.
$2 ~ /^0{40}$/ { $2 ~ /^0{40}$/ {
next next
} }
$2 ~ /^[a-z0-9]{40}$/ { # Check any lines with a valid local SHA and whose remote ref is
# master or an emacs-NN release branch. (We want to avoid checking
# feature or scratch branches here.)
$2 ~ /^[a-z0-9]{40}$/ && $3 ~ /^refs\/heads\/(master|emacs-[0-9]+)$/ {
newref = $2 newref = $2
# If the remote SHA is all zeroes, this is a new object to be # If the remote SHA is all zeroes, this is a new object to be
# pushed (likely a branch). Go backwards until we find a SHA on # pushed (likely a branch)...
# an origin branch.
if ($4 ~ /^0{40}$/) { if ($4 ~ /^0{40}$/) {
back = 0 back = 0
cmd = ("git branch -r -l '\''" origin_name "/*'\'' --contains " \ # ... Go backwards until we find a SHA on an origin branch.
newref "~" back) # Stop trying after 1000 commits, just in case...
while ((cmd | getline) == 0) { for (back = 0; back < 1000; back++) {
cmd = ("git branch -r -l '\''" origin_name "/*'\''" \
# Only look back at most 1000 commits, just in case... " --contains " newref "~" back)
if (back++ > 1000) rv = (cmd | getline)
close(cmd)
if (rv > 0)
break; break;
} }
close(cmd)
cmd = ("git rev-parse " newref "~" back) cmd = ("git rev-parse " newref "~" back)
cmd | getline oldref cmd | getline oldref
@ -78,6 +81,6 @@ $awk -v origin_name="$1" '
} }
# Print every SHA after oldref, up to (and including) newref. # Print every SHA after oldref, up to (and including) newref.
system("git rev-list --reverse " oldref ".." newref) system("git rev-list --first-parent --reverse " oldref ".." newref)
} }
' | $awk -v reason=pre-push -f .git/hooks/commit-msg-files.awk ' | $awk -v reason=pre-push -f .git/hooks/commit-msg-files.awk

View file

@ -938,6 +938,16 @@ be used.
This method does not support user names. This method does not support user names.
@item @option{flatpak}
@cindex method @option{flatpak}
@cindex @option{flatpak} method
Integration of Flatpak sandboxes. The host name may be either an
application ID, a sandbox instance ID, or a PID, as returned by
@samp{flatpak ps}.
This method does not support user names.
@end table @end table

View file

@ -79,9 +79,10 @@ This is used for displaying the time and date components of
'display-time-mode'. 'display-time-mode'.
--- ---
** New icon images for general use ** New icon images for general use.
Several symbolic icons are added to etc/images/symbols, including Several symbolic icons are added to "etc/images/symbols", including
plus, minus, check-mark, start, etc. plus, minus, check-mark, start, etc.
* Editing Changes in Emacs 30.1 * Editing Changes in Emacs 30.1
@ -122,7 +123,7 @@ If you want to get back the old behavior, set the user option to the value
(setopt gdb-locals-table-row-config (setopt gdb-locals-table-row-config
`((type . 0) (name . 0) (value . ,gdb-locals-value-limit))) `((type . 0) (name . 0) (value . ,gdb-locals-value-limit)))
** Compile ** Grep
*** New user option 'grep-use-headings'. *** New user option 'grep-use-headings'.
When non-nil, the output of Grep is split into sections, one for each When non-nil, the output of Grep is split into sections, one for each
@ -221,16 +222,18 @@ point is not in a comment or a string. It is by default bound to
** Tramp ** Tramp
+++ +++
*** New connection method "toolbox". *** New connection methods "toolbox" and "flatpak".
This allows accessing system containers provided by Toolbox. They allow accessing system containers provided by Toolbox or
sandboxes provided by Flatpak.
+++ +++
*** Rename 'tramp-use-ssh-controlmaster-options' to 'tramp-use-connection-share. *** Rename 'tramp-use-ssh-controlmaster-options' to 'tramp-use-connection-share'.
The old name still exists as defvaralias. This user option controls The old name still exists as obsolete variable alias. This user
now connection sharing for both ssh-based and plink-based methods. It option controls now connection sharing for both ssh-based and
allows the values t, nil, and 'suppress'. The latter suppresses plink-based methods. It allows the values t, nil, and 'suppress'.
also "ControlMaster" settings in the user's "~/.ssh/config" file, The latter suppresses also "ControlMaster" settings in the user's
or connection share configuration in PuTTY sessions, respectively. "~/.ssh/config" file, or connection share configuration in PuTTY
sessions, respectively.
** EWW ** EWW
@ -298,7 +301,7 @@ distracting and easily confused with actual code, or a significant
early aid that relieves you from moving the buffer or reaching for the early aid that relieves you from moving the buffer or reaching for the
mouse to consult an error message. mouse to consult an error message.
** Python mode ** Python Mode
--- ---
*** New user option 'python-indent-block-paren-deeper'. *** New user option 'python-indent-block-paren-deeper'.

View file

@ -1311,6 +1311,7 @@ connection if a previous connection has died for some reason."
(tramp-set-connection-property p "connected" t))))))) (tramp-set-connection-property p "connected" t)))))))
;;; Default connection-local variables for Tramp. ;;; Default connection-local variables for Tramp.
(defconst tramp-adb-connection-local-default-shell-variables (defconst tramp-adb-connection-local-default-shell-variables
'((shell-file-name . "/system/bin/sh") '((shell-file-name . "/system/bin/sh")
(shell-command-switch . "-c")) (shell-command-switch . "-c"))

View file

@ -47,9 +47,9 @@
;; C-x C-f /kubernetes:POD:/path/to/file ;; C-x C-f /kubernetes:POD:/path/to/file
;; ;;
;; Where: ;; Where:
;; POD is the pod to connect to. ;; POD is the pod to connect to.
;; By default, the first container in that pod will be ;; By default, the first container in that pod will be
;; used. ;; used.
;; ;;
;; Completion for POD and accessing it operate in the current ;; Completion for POD and accessing it operate in the current
;; namespace, use this command to change it: ;; namespace, use this command to change it:
@ -58,7 +58,7 @@
;; ;;
;; ;;
;; ;;
;; Open a file on an existing toolbox container via Toolbox: ;; Open a file on an existing Toolbox container:
;; ;;
;; C-x C-f /toolbox:CONTAINER:/path/to/file ;; C-x C-f /toolbox:CONTAINER:/path/to/file
;; ;;
@ -67,6 +67,16 @@
;; ;;
;; If the container is not running, it is started. If no container is ;; If the container is not running, it is started. If no container is
;; specified, the default Toolbox container is used. ;; specified, the default Toolbox container is used.
;;
;;
;;
;; Open a file on a running Flatpak sandbox:
;;
;; C-x C-f /flatpak:SANDBOX:/path/to/file
;;
;; Where:
;; SANDBOX is the running sandbox to connect to.
;; It could be an application ID, an instance ID, or a PID.
;;; Code: ;;; Code:
@ -104,6 +114,14 @@
:type '(choice (const "toolbox") :type '(choice (const "toolbox")
(string))) (string)))
;;;###tramp-autoload
(defcustom tramp-flatpak-program "flatpak"
"Name of the Flatpak client program."
:group 'tramp
:version "30.1"
:type '(choice (const "flatpak")
(string)))
;;;###tramp-autoload ;;;###tramp-autoload
(defconst tramp-docker-method "docker" (defconst tramp-docker-method "docker"
"Tramp method name to use to connect to Docker containers.") "Tramp method name to use to connect to Docker containers.")
@ -120,6 +138,10 @@
(defconst tramp-toolbox-method "toolbox" (defconst tramp-toolbox-method "toolbox"
"Tramp method name to use to connect to Toolbox containers.") "Tramp method name to use to connect to Toolbox containers.")
;;;###tramp-autoload
(defconst tramp-flatpak-method "flatpak"
"Tramp method name to use to connect to Flatpak sandboxes.")
;;;###tramp-autoload ;;;###tramp-autoload
(defun tramp-container--completion-function (program) (defun tramp-container--completion-function (program)
"List running containers available for connection. "List running containers available for connection.
@ -195,6 +217,30 @@ see its function help for a description of the format."
lines))) lines)))
(mapcar (lambda (name) (list nil name)) (delq nil names)))) (mapcar (lambda (name) (list nil name)) (delq nil names))))
;;;###tramp-autoload
(defun tramp-flatpak--completion-function (&rest _args)
"List Flatpak sandboxes available for connection.
It returns application IDs or, in case there is no application
ID, instance IDs.
This function is used by `tramp-set-completion-function', please
see its function help for a description of the format."
(when-let ((default-directory tramp-compat-temporary-file-directory)
(raw-list
(shell-command-to-string
(concat tramp-flatpak-program
" ps --columns=instance,application")))
(lines (split-string raw-list "\n" 'omit))
(names (mapcar
(lambda (line)
(when (string-match
(rx bol (* space) (group (+ (not space)))
(? (+ space) (group (+ (not space)))) eol)
line)
(or (match-string 2 line) (match-string 1 line))))
lines)))
(mapcar (lambda (name) (list nil name)) (delq nil names))))
;;;###tramp-autoload ;;;###tramp-autoload
(defvar tramp-default-remote-shell) ;; Silence byte compiler. (defvar tramp-default-remote-shell) ;; Silence byte compiler.
@ -253,6 +299,17 @@ see its function help for a description of the format."
(add-to-list 'tramp-default-host-alist `(,tramp-toolbox-method nil "")) (add-to-list 'tramp-default-host-alist `(,tramp-toolbox-method nil ""))
(add-to-list 'tramp-methods
`(,tramp-flatpak-method
(tramp-login-program ,tramp-flatpak-program)
(tramp-login-args (("enter")
("%h")
("%l")))
(tramp-direct-async (,tramp-default-remote-shell "-c"))
(tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(tramp-set-completion-function (tramp-set-completion-function
tramp-docker-method tramp-docker-method
`((tramp-container--completion-function `((tramp-container--completion-function
@ -269,7 +326,25 @@ see its function help for a description of the format."
(tramp-set-completion-function (tramp-set-completion-function
tramp-toolbox-method tramp-toolbox-method
'((tramp-toolbox--completion-function "")))) '((tramp-toolbox--completion-function "")))
(tramp-set-completion-function
tramp-flatpak-method
'((tramp-flatpak--completion-function "")))
;; Default connection-local variables for Tramp.
(defconst tramp-container-connection-local-default-flatpak-variables
`((tramp-remote-path . ,(cons "/app/bin" tramp-remote-path)))
"Default connection-local variables for remote flatpak connections.")
(connection-local-set-profile-variables
'tramp-container-connection-local-default-flatpak-profile
tramp-container-connection-local-default-flatpak-variables)
(connection-local-set-profiles
`(:application tramp :protocol ,tramp-flatpak-method)
'tramp-container-connection-local-default-flatpak-profile))
(add-hook 'tramp-unload-hook (add-hook 'tramp-unload-hook
(lambda () (lambda ()