From unknown Wed Jun 18 23:03:32 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#35362 <35362@debbugs.gnu.org> To: bug#35362 <35362@debbugs.gnu.org> Subject: Status: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) Reply-To: bug#35362 <35362@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:03:32 +0000 retitle 35362 26.2; [debbugs.el] Automate commit -> debbugs flow (posting p= atches, closing bugs after pushing) reassign 35362 emacs submitter 35362 Noam Postavsky severity 35362 wishlist tag 35362 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 21 11:09:16 2019 Received: (at submit) by debbugs.gnu.org; 21 Apr 2019 15:09:16 +0000 Received: from localhost ([127.0.0.1]:48943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIE5k-0004ia-7Y for submit@debbugs.gnu.org; Sun, 21 Apr 2019 11:09:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56879) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIE5j-0004iK-2c for submit@debbugs.gnu.org; Sun, 21 Apr 2019 11:09:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:53041) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hIE5d-0001Oe-RX for submit@debbugs.gnu.org; Sun, 21 Apr 2019 11:09:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIE5c-00045N-Lf for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2019 11:09:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIDt8-0000xm-Tz for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2019 10:56:15 -0400 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]:36021) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIDt8-0000x0-N6 for bug-gnu-emacs@gnu.org; Sun, 21 Apr 2019 10:56:14 -0400 Received: by mail-qt1-x833.google.com with SMTP id s15so9863607qtn.3 for ; Sun, 21 Apr 2019 07:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=lgaYfW9iHVrPX0TsZalDJC/Crf8BlwFmwUZS9JV+XGQ=; b=DoJyCWXghl8nZZbgfRaKY+iTflTCdtSFVhozuJ2Qn8Ajch7XJjOmen6PikY3HehnBm lXOd5vKSAI8MPfJPoeYaxMMGLPT2hwif9On6gyKybGwkBRwYV4Z2pcUnd4ML6v1/dznd mMkjDLVMQDdqCRbTnWrhCtq3aW8lG5tCoXEF+K9IDB2SH5gBiEiA7NiDIq8obATuhN0P ipYN4o3X3EP0dLXlNumvw05tcj3ulKhGWbbxRX/EbNZgWoGWN8b0rjUVSrYMl61FNPHv eUWtVgj2Fj4QnUS0y7mWAS9+WwMnBYpmabMsbjoAt9DN/9KMrz8Y1JlM0IIwhpja9LrQ 4tUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=lgaYfW9iHVrPX0TsZalDJC/Crf8BlwFmwUZS9JV+XGQ=; b=Eg9vIaBlV9Mb4/M5bLDIWeVC9MwB2DDkZ2T1Kv9uusRNO8DRbAWxlagjOnXammDfYE eDjn7+bmpRAEWkLcQ/EqrO2WN+Ap5GDsW/Guoia/9Wzx4PT4zm8WsyGnYHjtGqQj4Id7 41VTcDQpfbYjQ0wDBh71Gk91u042T00v+f5+WwY7c2MWJG1JxtU8vmzYCAsl33Anb1jG G4k4woY/y78tlDmRWTc3NNePkD7MhDecA4sCVNKW7VY1dRt9vnD4KHJhhEWbOi7zwwtm 1SvUV/oKGh+tR5FaseyA5zM00U3Sl0i4Hh7XrcqMij50KHHiWBAdnL+Hjcly21rkBAYL gvOg== X-Gm-Message-State: APjAAAVVQEbql5tYK9qjVJ+ExIyp6Seo34Sz8iL5+QlHnjAsbjWxn/8b KHZf7TFF9R79PW0KO6VG2qyKex1Y X-Google-Smtp-Source: APXvYqwq+QJAQZHDdKoXyNk9o0NTRkrnGRb+ehlEdibXP/0hs8tTWSm25PECard3JdkVWwLNOE9Rag== X-Received: by 2002:ac8:2271:: with SMTP id p46mr12270581qtp.106.1555858572892; Sun, 21 Apr 2019 07:56:12 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id 25sm7302236qtw.70.2019.04.21.07.56.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Apr 2019 07:56:12 -0700 (PDT) From: Noam Postavsky To: bug-gnu-emacs@gnu.org Subject: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) Date: Sun, 21 Apr 2019 10:56:11 -0400 Message-ID: <874l6rtnjo.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::833 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Severity: wishlist As I said in Bug#33225 (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33225#35) I have in mind next to bring in my commands which produce control messages from git commits (both for attaching proposed patches from an unpushed commit, and closing from a pushed one). There was a bit more delay (as always) due to having more hardcoded things in my code than I had realized, but I think it's just about ready now for other people to play with. Patch to follow when I get a bug number (so that I can use the new code to post itself, of course). From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 21 11:24:08 2019 Received: (at 35362) by debbugs.gnu.org; 21 Apr 2019 15:24:08 +0000 Received: from localhost ([127.0.0.1]:48954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIEK7-000563-F3 for submit@debbugs.gnu.org; Sun, 21 Apr 2019 11:24:08 -0400 Received: from mail-qk1-f178.google.com ([209.85.222.178]:47062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIEK1-00055Q-N9; Sun, 21 Apr 2019 11:24:05 -0400 Received: by mail-qk1-f178.google.com with SMTP id w73so3070535qkb.13; Sun, 21 Apr 2019 08:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=yDs60fNJHgs8hGJfVHmJuFE8GOH7pP+D79pDN+6aJUE=; b=Rdxum/dikkHqmw6dMfmVTvPLuQ4mIShzfMEycPUffR355fSkFWR/X5YITAB6B6Gg/p GwHqTCHzGgkOraq1De7pi5aw5cH2NfveWYiKnlxwoM5st3yn5WkZ6VuFaiiQ3MIihanS ueK+LSKjWXZqikMFkOFJCwze08izAGXL4c7DET5hRyYac7/9t2dpu7RZLxp2c902mALx iuf/DaGwhPJixbily8Qo72Bo6Q4Gi97cl2UT7ypKCVc7lsqjN01XJcTi8TZ4mDRB9soN pEeyu5IuXF0iiVoyxCvN2KbbNB96lWVmwTQ58T754y6uZuU0cDk449Fik//LlrMVeKr+ jZsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=yDs60fNJHgs8hGJfVHmJuFE8GOH7pP+D79pDN+6aJUE=; b=fG/1qyVK2nSNfd03sbUeWXyZE4C7QslXGEfw1lpi55zyWtKt2bW9Mtb+zc2KIvVCaI eabw+cpKXp0cN57/ORmkW16Ot2+2Dj6qm8/i+2iBvluqkDnfwA9/fKhHfv/vol/ng/SV ACUHT/FB8e2ZRIMkNZCap3NmSzDC7FDrfDxd3Z6M2/9roS6RoYH3gmNMPmq/GzJTdXMc lMByB/8RN/bb8jpI6E7CZykpyR9/0/RZa6tj2PRs0FPiB7lenCeWGQVnxM6gFytvU/YV CDuaIvlXdu4cJARB/8U5ZBBtF7XXYETr4Zs3+YfJoc3pIUk99sNppJ5RKETrdsOiDhCA lSAQ== X-Gm-Message-State: APjAAAWkavoWtVLETtw8G2Rr1xmIepXOf8f6HbZoiRepXr9JxEHsp0D6 3uW+sYJSv3Lr34fbkXhpgBcgA9OF X-Google-Smtp-Source: APXvYqyL8QRJFxxVoj/pyUF7x+laBWv67yaqYuERNWU6FUhEnHtaAHONYgVO1kxW+UuFt2Om6VogVA== X-Received: by 2002:a05:620a:16c5:: with SMTP id a5mr11230657qkn.212.1555860235915; Sun, 21 Apr 2019 08:23:55 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id p27sm6203948qte.25.2019.04.21.08.23.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Apr 2019 08:23:55 -0700 (PDT) From: Noam Postavsky To: 35362@debbugs.gnu.org Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> Date: Sun, 21 Apr 2019 11:23:54 -0400 In-Reply-To: <874l6rtnjo.fsf@gmail.com> (Noam Postavsky's message of "Sun, 21 Apr 2019 10:56:11 -0400") Message-ID: <871s1vtm9h.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35362 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain tags 35362 + patch quit > Patch to follow when I get a bug number (so that I can use the new code > to post itself, of course). Here it is. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Automate-commit-debbugs-workflow-Bug-35362.patch Content-Description: patch >From 9b3b3b79d257850279bec2c35dd255f25765eb56 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 21 Apr 2019 11:11:30 -0400 Subject: [PATCH] Automate commit -> debbugs workflow (Bug#35362) * packages/debbugs/debbugs-gnu.el (debbugs-gnu-current-id): Return nil in buffers not in debbugs-gnu-mode. (debbugs-gnu-send-control-message): Don't remove bugs cache info here... (debbugs-gnu-make-control-message): ...do it here instead (using message-send-actions to wait for successful message send). (debbugs-gnus-jump-to-bug, debbugs-gnu-git-remote-info-alist) (debbugs-gnu-commit-description-format, debbugs-gnu--git-insert) (debbugs-gnu--git-remote-info, debbugs-gnu--git-get-pushed-to) (debbugs-gnu-announce-commit, debbugs-gnu-post-patch) (debbugs-gnu-read-commit-range-hook) (debbugs-gnu-read-commit-range-from-vc-log) (debbugs-gnu-picked-commits, debbugs-gnu-pick-commits) (debbugs-gnu-maybe-use-picked-commits) (debbugs-gnu--prepare-to-use-picked-commits): New commands, functions and variables. * packages/debbugs/debbugs-ug.texi (Posting Patches): New section. --- packages/debbugs/debbugs-gnu.el | 284 ++++++++++++++++++++++++++++++++++++++- packages/debbugs/debbugs-ug.texi | 26 ++++ 2 files changed, 304 insertions(+), 6 deletions(-) diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el index 997d367b0..8bdecd9fc 100644 --- a/packages/debbugs/debbugs-gnu.el +++ b/packages/debbugs/debbugs-gnu.el @@ -180,12 +180,16 @@ (autoload 'rmail-summary "rmailsum") (autoload 'vc-dir-hide-up-to-date "vc-dir") (autoload 'vc-dir-mark "vc-dir") +(declare-function log-view-current-entry "log-view" (&optional pos move)) +(declare-function log-view-current-tag "log-view" (&optional pos)) + (defvar compilation-in-progress) (defvar diff-file-header-re) (defvar gnus-article-buffer) (defvar gnus-posting-styles) (defvar gnus-save-duplicate-list) (defvar gnus-suppress-duplicates) +(defvar message-sent-message-via) (defvar rmail-current-message) (defvar rmail-mode-map) (defvar rmail-summary-mode-map) @@ -1282,7 +1286,8 @@ (defun debbugs-gnu-current-id (&optional noerror) (error "No bug on the current line")))) (defun debbugs-gnu-current-status () - (get-text-property (line-beginning-position) 'tabulated-list-id)) + (when (derived-mode-p 'debbugs-gnu-mode) + (get-text-property (line-beginning-position) 'tabulated-list-id))) (defun debbugs-gnu-display-status (query filter status) "Display the query, filter and status of the report on the current line." @@ -1357,8 +1362,10 @@ (defun debbugs-read-emacs-bug-with-gnus (id status merged) ;; Use Gnus. (gnus-read-ephemeral-emacs-bug-group (cons id (if (listp merged) merged (list merged))) - (cons (current-buffer) - (current-window-configuration))) + ;; This doesn't work, gives wrong-type-argument listp when quitting. + ;; (cons (current-buffer) + ;; (current-window-configuration)) + ) (with-current-buffer (window-buffer (selected-window)) (set (make-local-variable 'debbugs-gnu-bug-number) id) (set (make-local-variable 'debbugs-gnu-subject) @@ -1534,7 +1541,6 @@ (defun debbugs-gnu-send-control-message (message &optional reverse) (debbugs-gnu-make-control-message message id reverse (current-buffer)) (funcall (or debbugs-gnu-send-mail-function send-mail-function)) - (remhash id debbugs-cache-data) (message-goto-body) (message "Control message sent:\n%s" (buffer-substring-no-properties (point) (1- (point-max))))))) @@ -1720,8 +1726,274 @@ (defun debbugs-gnu-make-control-message (message bugid &optional reverse buffer) bugid (if reverse ?- ?+) message))))) (unless (looking-at-p debbugs-gnu-control-message-end-regexp) - (insert "quit\n\n")))) - + (insert "quit\n\n")) + (add-hook 'message-send-actions + (lambda () (remhash bugid debbugs-cache-data)) + nil t))) + +(defun debbugs-gnus-jump-to-bug (bugid) + "Display buffer associated with BUGID with `pop-to-buffer'. +Use `gnus-read-ephemeral-emacs-bug-group' instead if there is no such buffer." + (let ((bug-buf nil) + ;; By reverse order of preference. + (preferred-modes '(gnus-summary-mode gnus-article-mode message-mode))) + (save-current-buffer + (cl-loop + for buf in (buffer-list) + while preferred-modes do + (set-buffer buf) + (when-let (((memql bugid (debbugs-gnus-implicit-ids))) + (mode (cl-loop + for mode in preferred-modes + thereis (and (derived-mode-p mode) + ;; Don't choose sent message buffers. + (or (not (eq mode 'message-mode)) + (not message-sent-message-via)) + mode)))) + (setq preferred-modes (cdr (memq mode preferred-modes))) + (setq bug-buf buf)))) + (if bug-buf + (pop-to-buffer bug-buf '(display-buffer-reuse-window + . ((reusable-frames . visible)))) + (gnus-read-ephemeral-emacs-bug-group bugid (current-window-configuration))))) + +(defcustom debbugs-gnu-git-remote-info-alist + '(("git.sv.gnu.org\\(?::/srv/git\\)/emacs.git" . + ((commit-url + . "https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=%H") + (ref-globs . ("/emacs-*" "/master")))) + ("git.sv.gnu.org\\(?::/srv/git\\)/emacs/elpa" . + ((commit-url + . "https://git.savannah.gnu.org/cgit/emacs/elpa.git/commit/?id=%H")))) + "Nest alist for repository-specific information. +Each element has the form (REMOTE-REGEXP . INFO-ALIST), where +INFO-ALIST is an alist containing the repository attributes. + +Supported keys of INFO-ALIST are + +* `commit-url': Format of a URL for a given commit hash, using + format specifiers supported by `git show'. Used by + `debbugs-gnu-announce-commit' as a supplement to + `debbugs-gnu-commit-description-format'. + +* `ref-globs': List of glob patterns matching branches of + interest, used by `debbugs-gnu-announce-commit' to make the + \"Pushed to X\" message." + :type '(alist :key-type string :value-type (alist :key-type symbol))) + +(defcustom debbugs-gnu-commit-description-format + "%h %cI \"%s\"" + "Format used for describing commits in `debbugs-gnu-announce-commit'. +It is passed as --format argument to `git show', see its manual +page for formatting specifier meanings." + :type 'string) + +(defcustom debbugs-gnu-git-program (or (bound-and-true-p vc-git-program) "git") + "Name of the Git executable (excluding any arguments)." + :type 'string) + +(defun debbugs-gnu--git-insert (&rest args) + "Insert output of running git with ARGS. +Throws error if git returns non-zero. Uses `debbugs-gnu-git-program'." + (unless (eql 0 (apply #'process-file + debbugs-gnu-git-program nil '(t t) nil + args)) + (error "git %s failed: %s" (car args) (buffer-string)))) + +(defun debbugs-gnu--git-remote-info () + "Return (REMOTE . INFO-ALIST)." + (with-temp-buffer + (debbugs-gnu--git-insert "remote" "-v") + (catch 'found-remote + (dolist (remote-info debbugs-gnu-git-remote-info-alist) + (goto-char (point-min)) + (and (re-search-forward (car remote-info) nil t) + (progn (beginning-of-line) + (looking-at "[^ \t]+")) + (throw 'found-remote + (cons (match-string 0) (cdr remote-info)))))))) + +(defun debbugs-gnu--git-get-pushed-to (commit-range remote-info) + "Return the branch name which COMMIT-RANGE was pushed to. +REMOTE-INFO is return value of `debbugs-gnu--git-remote-info'." + (let* ((last-commit + (with-temp-buffer + (debbugs-gnu--git-insert + ;; %H: commit hash. + "log" "-1" "--format=%H" commit-range) + (goto-char (point-min)) + (buffer-substring (point-min) (line-end-position)))) + (remote (pop remote-info))) + (let ((ref-globs (cdr (assq 'ref-globs remote-info)))) + (with-temp-buffer + (apply + #'debbugs-gnu--git-insert + "branch" "--remote" "--contains" last-commit + (mapcar (lambda (glob) (concat remote glob)) + ref-globs)) + ;; First 2 characters are current branch indicator. + (goto-char (+ (point-min) 2)) + (and (looking-at (concat (regexp-quote remote) "/\\(.+\\)$")) + (match-string 1)))))) + +(defun debbugs-gnu-announce-commit (commit-range bugnum &optional _args) + "Insert info about COMMIT-RANGE into message. +Optionally call `debbugs-gnu-make-control-message' to close BUGNUM." + (let* ((status (car (debbugs-get-status bugnum))) + (packages (cdr (assq 'package status))) + (remote-info (debbugs-gnu--git-remote-info))) + (insert "\nPushed to " + (or (debbugs-gnu--git-get-pushed-to commit-range remote-info) "") + ".\n\n") + (debbugs-gnu--git-insert + "show" "--no-patch" + (concat "--format=" debbugs-gnu-commit-description-format + "\n" (cdr (assq 'commit-url remote-info)) "\n") + commit-range) + (when (y-or-n-p "Close bug? ") + (let ((emacs-version + (or (and (member "emacs" packages) + (file-exists-p "configure.ac") + (with-temp-buffer + (insert-file-contents "configure.ac") + (and (re-search-forward "\ +^ *AC_INIT(GNU Emacs, *\\([0-9.]+\\), *bug-gnu-emacs@gnu.org" + nil t) + (match-string 1)))) + ""))) + (debbugs-gnu-make-control-message + "done" bugnum nil (current-buffer)))))) + +(defun debbugs-gnu-post-patch (commit-range bugnum &optional format-patch-args) + "Attach COMMIT-RANGE as patches into current message. +Optionally call `debbugs-gnu-make-control-message'' to tag BUGNUM +with `patch'." + (letrec ((disposition (completing-read "disposition: " '("inline" "attachment"))) + ;; Make attachments text/plain for better compatibility + ;; (e.g., opening in browser instead of downloading). + (type (if (equal disposition "inline") "text/x-diff" "text/plain")) + (dir (make-temp-file (format "patches-for-bug%d-" bugnum) t)) + (deldir (lambda () + (delete-directory dir t) + (remove-hook 'message-exit-actions deldir t) + (remove-hook 'kill-buffer-hook deldir t)))) + (add-hook 'message-send-actions deldir nil t) + (add-hook 'kill-buffer-hook deldir nil t) + (with-temp-buffer + (apply #'debbugs-gnu--git-insert + "format-patch" (concat "--output-directory=" dir) + (append format-patch-args + (list commit-range)))) + (dolist (patch (directory-files dir t "\\`[^.]")) + (mml-attach-file patch type "patch" disposition)) + (when (and (not (member + "patch" (assq 'tags (car (debbugs-get-status + bugnum))))) + (y-or-n-p "Tag + patch? ")) + (debbugs-gnu-make-control-message + "patch" bugnum nil (current-buffer))))) + +(defvar debbugs-gnu-read-commit-range-hook nil + "Used by `debbugs-gnu-pick-commits'. +Each function receives no arguments, and should return an +argument compatible with `debbugs-gnu-pick-commits'. If the +function can't function in the current buffer, it should return +nil to let the next function try.") + +(defun debbugs-gnu-read-commit-range-from-vc-log () + "Read commit range from a VC log buffer. +Return commit at point, or commit range in region if it is +active. This function is suitable for use in +`debbugs-gnu-read-commit-range-hook'." + (when (derived-mode-p 'vc-git-log-view-mode) + (list (if (use-region-p) + (let ((beg (log-view-current-entry (region-beginning))) + (end (log-view-current-entry (region-end)))) + (if (= (car beg) (car end)) + ;; Region spans only a single entry. + (cadr beg) + ;; Later revs are at the top of buffer. + (format "%s~1..%s" (cadr end) (cadr beg)))) + (log-view-current-tag))))) +(add-hook 'debbugs-gnu-read-commit-range-hook + #'debbugs-gnu-read-commit-range-from-vc-log) + +(defvar debbugs-gnu-picked-commits nil + "List of commits selected in `debbugs-gnu-pick-commits'. +Format of each element is (BUGNUMBERS REPO-DIR COMMIT-RANGE).") + +(defun debbugs-gnu-pick-commits (commit-range) + "Select COMMIT-RANGE to post as patches or announce as pushed. +COMMIT-RANGE is read using `debbugs-gnu-read-commit-range-hook', +or `read-string' if none of its functions apply. Add entry to +`debbugs-gnu-pick-commits' and jump to read bug in prepration for +user to call `debbugs-gnu-maybe-use-picked-commits'." + (interactive + (or (run-hook-with-args-until-success + 'debbugs-gnu-read-commit-range-hook) + (list (read-string "Commit (or range): ")))) + (let ((bugnum nil) + (repo-dir default-directory)) + (with-temp-buffer + ;; %B = raw body (unwrapped subject and body) + (debbugs-gnu--git-insert + ;; %B: raw body (unwrapped subject and body). + "show" "--no-patch" "--format=%B" commit-range) + (goto-char (point-min)) + (while (re-search-forward "[bB]ug ?#\\([0-9]+\\)" nil t) + (push (match-string 1) bugnum))) + (let ((read-bugnum + (string-to-number + (completing-read + (if bugnum + (format "Bug # (default %s): " (car bugnum)) + "Bug #: ") + debbugs-gnu-completion-table nil t nil nil bugnum)))) + (debbugs-gnus-jump-to-bug read-bugnum) + (cl-callf2 mapcar #'string-to-number bugnum) + (unless (memql read-bugnum bugnum) + (push read-bugnum bugnum))) + (push (list bugnum repo-dir commit-range) + debbugs-gnu-picked-commits) + (if (derived-mode-p 'message-mode) + (debbugs-gnu-maybe-use-picked-commits) + (message "Reply to a message to continue")))) + +(defun debbugs-gnu-maybe-use-picked-commits () + "Add commit corresponding to current message's bug number. +Calls `debbugs-gnu-announce-commit' or `debbugs-gnu-post-patch' +on an entry with a matching bug number from +`debbugs-gnu-picked-commits'. Remove entry after message is +successfully sent." + (interactive) + (when (derived-mode-p 'message-mode) + (cl-loop with id = (car (debbugs-gnus-implicit-ids)) + for pcomm-entry in debbugs-gnu-picked-commits + for (bugnum repo-dir commit-range) = pcomm-entry + when (memql id bugnum) + do + (goto-char (point-max)) + (let ((default-directory repo-dir)) + (pcase (read-char-choice + (format "[a]nnounce commit, or [p]ost patch? (%s)" + commit-range) + '(?a ?p)) + (?a (debbugs-gnu-announce-commit commit-range id) ) + (?p (debbugs-gnu-post-patch commit-range id)))) + (add-hook 'message-send-actions + (lambda () + (cl-callf2 delq pcomm-entry + debbugs-gnu-picked-commits)) + nil t) + (remove-hook 'post-command-hook + #'debbugs-gnu-maybe-use-picked-commits) + (cl-return)))) + +;; We need to daisy chain the hooks because `message-setup-hook' runs +;; too early (before `message-yank-original'). +(defun debbugs-gnu--prepare-to-use-picked-commits () + (add-hook 'post-command-hook #'debbugs-gnu-maybe-use-picked-commits)) +(add-hook 'message-setup-hook #'debbugs-gnu--prepare-to-use-picked-commits) (defvar debbugs-gnu-usertags-mode-map (let ((map (make-sparse-keymap))) diff --git a/packages/debbugs/debbugs-ug.texi b/packages/debbugs/debbugs-ug.texi index 2bb01d2c2..0ea7ca521 100644 --- a/packages/debbugs/debbugs-ug.texi +++ b/packages/debbugs/debbugs-ug.texi @@ -313,6 +313,7 @@ in @code{org-mode}. * TODO Items:: TODO Items. * Control Messages:: Control Messages. * Applying Patches:: Applying Patches in the Emacs Repository. +* Posting Patches:: Posting Patches to Debbugs from the Emacs Repository. @end menu @@ -674,6 +675,31 @@ creates a ChangeLog entry with all needed information. A final @kbd{M-m} in the @samp{ChangeLog} buffer commits the patch via @samp{*vc-log*}. +@node Posting Patches +@section Posting Patches to Debbugs from the Emacs Repository + +Once you have committed a patch fixing a bug you usually want to post +it to the bug thread for review and testing. And when the patch is +deemed satisfactory and pushed to the official GNU Emacs repository, +the bug should be marked closed. + +@findex debbugs-gnu-pick-commits +The command @code{debbugs-gnu-pick-commits} helps automate both these +processes: it queries for a commit (or commit range), and a bug number +(defaulting to the bug number mentioned in the commit message). It +then jumps you to a buffer associated with the bug. When you reply to +a message in the bug thread, you are asked whether to post the commits +as patches (optionally tagging the bug with @code{"patch"}), or +announce that the bug has been fixed by the selected commits +(optionally closing the bug and marking as closed in the Emacs version +corresponding to the patch). + +@vindex debbugs-gnu-read-commit-range-hook +The query for commit (or commit range) to use is controlled by +@code{debbugs-gnu-read-commit-range-hook}. Initially it has an entry +which operates in @samp{*vc-change-log*} buffers: the default will be +the commit under point, or the commit range contained in the region if +it is active. @node Minor Mode @chapter Minor Mode -- 2.11.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 21 11:28:08 2019 Received: (at 35362) by debbugs.gnu.org; 21 Apr 2019 15:28:08 +0000 Received: from localhost ([127.0.0.1]:48960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIENz-0005CC-71 for submit@debbugs.gnu.org; Sun, 21 Apr 2019 11:28:07 -0400 Received: from mail-qt1-f171.google.com ([209.85.160.171]:38150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIENx-0005Bf-4L for 35362@debbugs.gnu.org; Sun, 21 Apr 2019 11:28:06 -0400 Received: by mail-qt1-f171.google.com with SMTP id d13so9885553qth.5 for <35362@debbugs.gnu.org>; Sun, 21 Apr 2019 08:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=MsB1A8rPCzC+Tl4Of0Xt79BoB1aSnr8/zP5opBiSZCQ=; b=t6kO4AJrGcTHc0q8RcuDgjzSImczlwpEi1A1ftMQwUz8sq1IzU8iz0juzk+wVhvO1E +LwHGpS6yQQrbnpZPxxcvR7J6eygVDUouml1LTO5uc2MteCOXIoMX1CcbjFxX/b3fugl hlCAqQmbGyLCjdi3xk0Lq0kXMdmQRyWoJp23JqjBXL8+oj7t3Goo9DrAeosN1r28zOJ/ KRp7dqhoY1BB1vauN+1Lrxs8Fn026EbHI2I5VjVJGzuXfm3pBMm5GzDGJMcfslP3oPua ELhC2dwiAbisYESc0rYv91hfcP33DVSbu7tYlcYnT23q6EJo/L60qkvurHBeqfquCWvV s6/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=MsB1A8rPCzC+Tl4Of0Xt79BoB1aSnr8/zP5opBiSZCQ=; b=j9T2qHrSaWMDpHy44w8zOIZOo03ntpQsicmFao3zJvGE2kyAlShF4huPz8GeaTU9fS MjxViXrt8WPDyl4TtmvSd+3tABPkJL4UXVJEyvTvOWtr7gU371Nuwl0zvqYoEushvjKh Q/Ckimlpi54zp9vLwHz9UKshDLsSfuHYg7gJ23+NL3kYiPnSIvAyevcUnjzO3+8tak4y GX/9w/qyJDmixDh/oqsj07FocR2x4E8isF+CwVKXOkwoesG7TtLUDYnbZL90yRWjNci1 tQevNRZwVCwz2zwQsrokLGkZpiGpVw8aS651915Z7Shbbwwl0U9E18szTMyC8vIwaGbE PI/w== X-Gm-Message-State: APjAAAUj3UoZK5bBmeXOnUuDx+es8HKKJpxBPlAliKH5lG2EFbwmCJnz Zl2DCbEgU/h4VjsXKX+keKeiqCp4 X-Google-Smtp-Source: APXvYqxN/or+v+lVP/dF6n7WAM33zdFMWaSdPV4rFqmZttJP/Yk3qM+Ddt5VXcHrhiVIxjEcLU3Xrg== X-Received: by 2002:a0c:ac0e:: with SMTP id l14mr12382681qvb.86.1555860479346; Sun, 21 Apr 2019 08:27:59 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id y5sm5224692qkl.73.2019.04.21.08.27.58 for <35362@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Apr 2019 08:27:58 -0700 (PDT) From: Noam Postavsky To: 35362@debbugs.gnu.org Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> Date: Sun, 21 Apr 2019 11:27:57 -0400 In-Reply-To: <871s1vtm9h.fsf@gmail.com> (Noam Postavsky's message of "Sun, 21 Apr 2019 11:23:54 -0400") Message-ID: <87wojns7ia.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 35362 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.2 (-) --=-=-= Content-Type: text/plain > - (cons (current-buffer) > - (current-window-configuration))) > + ;; This doesn't work, gives wrong-type-argument listp when quitting. > + ;; (cons (current-buffer) > + ;; (current-window-configuration)) > + ) Ooops, sorry, I was confused about this. This part is fine. > + (gnus-read-ephemeral-emacs-bug-group bugid (current-window-configuration))))) It's this one that is missing the cons. Patch updated. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Automate-commit-debbugs-workflow-Bug-35362.patch Content-Description: patch >From 2c8ea66bd8d55a29bdbdafbc1463c393804709b2 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 21 Apr 2019 11:11:30 -0400 Subject: [PATCH] Automate commit -> debbugs workflow (Bug#35362) * packages/debbugs/debbugs-gnu.el (debbugs-gnu-current-id): Return nil in buffers not in debbugs-gnu-mode. (debbugs-gnu-send-control-message): Don't remove bugs cache info here... (debbugs-gnu-make-control-message): ...do it here instead (using message-send-actions to wait for successful message send). (debbugs-gnus-jump-to-bug, debbugs-gnu-git-remote-info-alist) (debbugs-gnu-commit-description-format, debbugs-gnu--git-insert) (debbugs-gnu--git-remote-info, debbugs-gnu--git-get-pushed-to) (debbugs-gnu-announce-commit, debbugs-gnu-post-patch) (debbugs-gnu-read-commit-range-hook) (debbugs-gnu-read-commit-range-from-vc-log) (debbugs-gnu-picked-commits, debbugs-gnu-pick-commits) (debbugs-gnu-maybe-use-picked-commits) (debbugs-gnu--prepare-to-use-picked-commits): New commands, functions and variables. * packages/debbugs/debbugs-ug.texi (Posting Patches): New section. --- packages/debbugs/debbugs-gnu.el | 282 ++++++++++++++++++++++++++++++++++++++- packages/debbugs/debbugs-ug.texi | 26 ++++ 2 files changed, 303 insertions(+), 5 deletions(-) diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el index 997d367b0..d83e380e8 100644 --- a/packages/debbugs/debbugs-gnu.el +++ b/packages/debbugs/debbugs-gnu.el @@ -180,12 +180,16 @@ (autoload 'rmail-summary "rmailsum") (autoload 'vc-dir-hide-up-to-date "vc-dir") (autoload 'vc-dir-mark "vc-dir") +(declare-function log-view-current-entry "log-view" (&optional pos move)) +(declare-function log-view-current-tag "log-view" (&optional pos)) + (defvar compilation-in-progress) (defvar diff-file-header-re) (defvar gnus-article-buffer) (defvar gnus-posting-styles) (defvar gnus-save-duplicate-list) (defvar gnus-suppress-duplicates) +(defvar message-sent-message-via) (defvar rmail-current-message) (defvar rmail-mode-map) (defvar rmail-summary-mode-map) @@ -1282,7 +1286,8 @@ (defun debbugs-gnu-current-id (&optional noerror) (error "No bug on the current line")))) (defun debbugs-gnu-current-status () - (get-text-property (line-beginning-position) 'tabulated-list-id)) + (when (derived-mode-p 'debbugs-gnu-mode) + (get-text-property (line-beginning-position) 'tabulated-list-id))) (defun debbugs-gnu-display-status (query filter status) "Display the query, filter and status of the report on the current line." @@ -1357,8 +1362,9 @@ (defun debbugs-read-emacs-bug-with-gnus (id status merged) ;; Use Gnus. (gnus-read-ephemeral-emacs-bug-group (cons id (if (listp merged) merged (list merged))) + This doesn't work, gives wrong-type-argument listp when quitting. (cons (current-buffer) - (current-window-configuration))) + (current-window-configuration))) (with-current-buffer (window-buffer (selected-window)) (set (make-local-variable 'debbugs-gnu-bug-number) id) (set (make-local-variable 'debbugs-gnu-subject) @@ -1534,7 +1540,6 @@ (defun debbugs-gnu-send-control-message (message &optional reverse) (debbugs-gnu-make-control-message message id reverse (current-buffer)) (funcall (or debbugs-gnu-send-mail-function send-mail-function)) - (remhash id debbugs-cache-data) (message-goto-body) (message "Control message sent:\n%s" (buffer-substring-no-properties (point) (1- (point-max))))))) @@ -1720,8 +1725,275 @@ (defun debbugs-gnu-make-control-message (message bugid &optional reverse buffer) bugid (if reverse ?- ?+) message))))) (unless (looking-at-p debbugs-gnu-control-message-end-regexp) - (insert "quit\n\n")))) - + (insert "quit\n\n")) + (add-hook 'message-send-actions + (lambda () (remhash bugid debbugs-cache-data)) + nil t))) + +(defun debbugs-gnus-jump-to-bug (bugid) + "Display buffer associated with BUGID with `pop-to-buffer'. +Use `gnus-read-ephemeral-emacs-bug-group' instead if there is no such buffer." + (let ((bug-buf nil) + ;; By reverse order of preference. + (preferred-modes '(gnus-summary-mode gnus-article-mode message-mode))) + (save-current-buffer + (cl-loop + for buf in (buffer-list) + while preferred-modes do + (set-buffer buf) + (when-let (((memql bugid (debbugs-gnus-implicit-ids))) + (mode (cl-loop + for mode in preferred-modes + thereis (and (derived-mode-p mode) + ;; Don't choose sent message buffers. + (or (not (eq mode 'message-mode)) + (not message-sent-message-via)) + mode)))) + (setq preferred-modes (cdr (memq mode preferred-modes))) + (setq bug-buf buf)))) + (if bug-buf + (pop-to-buffer bug-buf '(display-buffer-reuse-window + . ((reusable-frames . visible)))) + (gnus-read-ephemeral-emacs-bug-group + bugid (cons (current-buffer) (current-window-configuration)))))) + +(defcustom debbugs-gnu-git-remote-info-alist + '(("git.sv.gnu.org\\(?::/srv/git\\)/emacs.git" . + ((commit-url + . "https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=%H") + (ref-globs . ("/emacs-*" "/master")))) + ("git.sv.gnu.org\\(?::/srv/git\\)/emacs/elpa" . + ((commit-url + . "https://git.savannah.gnu.org/cgit/emacs/elpa.git/commit/?id=%H")))) + "Nest alist for repository-specific information. +Each element has the form (REMOTE-REGEXP . INFO-ALIST), where +INFO-ALIST is an alist containing the repository attributes. + +Supported keys of INFO-ALIST are + +* `commit-url': Format of a URL for a given commit hash, using + format specifiers supported by `git show'. Used by + `debbugs-gnu-announce-commit' as a supplement to + `debbugs-gnu-commit-description-format'. + +* `ref-globs': List of glob patterns matching branches of + interest, used by `debbugs-gnu-announce-commit' to make the + \"Pushed to X\" message." + :type '(alist :key-type string :value-type (alist :key-type symbol))) + +(defcustom debbugs-gnu-commit-description-format + "%h %cI \"%s\"" + "Format used for describing commits in `debbugs-gnu-announce-commit'. +It is passed as --format argument to `git show', see its manual +page for formatting specifier meanings." + :type 'string) + +(defcustom debbugs-gnu-git-program (or (bound-and-true-p vc-git-program) "git") + "Name of the Git executable (excluding any arguments)." + :type 'string) + +(defun debbugs-gnu--git-insert (&rest args) + "Insert output of running git with ARGS. +Throws error if git returns non-zero. Uses `debbugs-gnu-git-program'." + (unless (eql 0 (apply #'process-file + debbugs-gnu-git-program nil '(t t) nil + args)) + (error "git %s failed: %s" (car args) (buffer-string)))) + +(defun debbugs-gnu--git-remote-info () + "Return (REMOTE . INFO-ALIST)." + (with-temp-buffer + (debbugs-gnu--git-insert "remote" "-v") + (catch 'found-remote + (dolist (remote-info debbugs-gnu-git-remote-info-alist) + (goto-char (point-min)) + (and (re-search-forward (car remote-info) nil t) + (progn (beginning-of-line) + (looking-at "[^ \t]+")) + (throw 'found-remote + (cons (match-string 0) (cdr remote-info)))))))) + +(defun debbugs-gnu--git-get-pushed-to (commit-range remote-info) + "Return the branch name which COMMIT-RANGE was pushed to. +REMOTE-INFO is return value of `debbugs-gnu--git-remote-info'." + (let* ((last-commit + (with-temp-buffer + (debbugs-gnu--git-insert + ;; %H: commit hash. + "log" "-1" "--format=%H" commit-range) + (goto-char (point-min)) + (buffer-substring (point-min) (line-end-position)))) + (remote (pop remote-info))) + (let ((ref-globs (cdr (assq 'ref-globs remote-info)))) + (with-temp-buffer + (apply + #'debbugs-gnu--git-insert + "branch" "--remote" "--contains" last-commit + (mapcar (lambda (glob) (concat remote glob)) + ref-globs)) + ;; First 2 characters are current branch indicator. + (goto-char (+ (point-min) 2)) + (and (looking-at (concat (regexp-quote remote) "/\\(.+\\)$")) + (match-string 1)))))) + +(defun debbugs-gnu-announce-commit (commit-range bugnum &optional _args) + "Insert info about COMMIT-RANGE into message. +Optionally call `debbugs-gnu-make-control-message' to close BUGNUM." + (let* ((status (car (debbugs-get-status bugnum))) + (packages (cdr (assq 'package status))) + (remote-info (debbugs-gnu--git-remote-info))) + (insert "\nPushed to " + (or (debbugs-gnu--git-get-pushed-to commit-range remote-info) "") + ".\n\n") + (debbugs-gnu--git-insert + "show" "--no-patch" + (concat "--format=" debbugs-gnu-commit-description-format + "\n" (cdr (assq 'commit-url remote-info)) "\n") + commit-range) + (when (y-or-n-p "Close bug? ") + (let ((emacs-version + (or (and (member "emacs" packages) + (file-exists-p "configure.ac") + (with-temp-buffer + (insert-file-contents "configure.ac") + (and (re-search-forward "\ +^ *AC_INIT(GNU Emacs, *\\([0-9.]+\\), *bug-gnu-emacs@gnu.org" + nil t) + (match-string 1)))) + ""))) + (debbugs-gnu-make-control-message + "done" bugnum nil (current-buffer)))))) + +(defun debbugs-gnu-post-patch (commit-range bugnum &optional format-patch-args) + "Attach COMMIT-RANGE as patches into current message. +Optionally call `debbugs-gnu-make-control-message'' to tag BUGNUM +with `patch'." + (letrec ((disposition (completing-read "disposition: " '("inline" "attachment"))) + ;; Make attachments text/plain for better compatibility + ;; (e.g., opening in browser instead of downloading). + (type (if (equal disposition "inline") "text/x-diff" "text/plain")) + (dir (make-temp-file (format "patches-for-bug%d-" bugnum) t)) + (deldir (lambda () + (delete-directory dir t) + (remove-hook 'message-exit-actions deldir t) + (remove-hook 'kill-buffer-hook deldir t)))) + (add-hook 'message-send-actions deldir nil t) + (add-hook 'kill-buffer-hook deldir nil t) + (with-temp-buffer + (apply #'debbugs-gnu--git-insert + "format-patch" (concat "--output-directory=" dir) + (append format-patch-args + (list commit-range)))) + (dolist (patch (directory-files dir t "\\`[^.]")) + (mml-attach-file patch type "patch" disposition)) + (when (and (not (member + "patch" (assq 'tags (car (debbugs-get-status + bugnum))))) + (y-or-n-p "Tag + patch? ")) + (debbugs-gnu-make-control-message + "patch" bugnum nil (current-buffer))))) + +(defvar debbugs-gnu-read-commit-range-hook nil + "Used by `debbugs-gnu-pick-commits'. +Each function receives no arguments, and should return an +argument compatible with `debbugs-gnu-pick-commits'. If the +function can't function in the current buffer, it should return +nil to let the next function try.") + +(defun debbugs-gnu-read-commit-range-from-vc-log () + "Read commit range from a VC log buffer. +Return commit at point, or commit range in region if it is +active. This function is suitable for use in +`debbugs-gnu-read-commit-range-hook'." + (when (derived-mode-p 'vc-git-log-view-mode) + (list (if (use-region-p) + (let ((beg (log-view-current-entry (region-beginning))) + (end (log-view-current-entry (region-end)))) + (if (= (car beg) (car end)) + ;; Region spans only a single entry. + (cadr beg) + ;; Later revs are at the top of buffer. + (format "%s~1..%s" (cadr end) (cadr beg)))) + (log-view-current-tag))))) +(add-hook 'debbugs-gnu-read-commit-range-hook + #'debbugs-gnu-read-commit-range-from-vc-log) + +(defvar debbugs-gnu-picked-commits nil + "List of commits selected in `debbugs-gnu-pick-commits'. +Format of each element is (BUGNUMBERS REPO-DIR COMMIT-RANGE).") + +(defun debbugs-gnu-pick-commits (commit-range) + "Select COMMIT-RANGE to post as patches or announce as pushed. +COMMIT-RANGE is read using `debbugs-gnu-read-commit-range-hook', +or `read-string' if none of its functions apply. Add entry to +`debbugs-gnu-pick-commits' and jump to read bug in prepration for +user to call `debbugs-gnu-maybe-use-picked-commits'." + (interactive + (or (run-hook-with-args-until-success + 'debbugs-gnu-read-commit-range-hook) + (list (read-string "Commit (or range): ")))) + (let ((bugnum nil) + (repo-dir default-directory)) + (with-temp-buffer + ;; %B = raw body (unwrapped subject and body) + (debbugs-gnu--git-insert + ;; %B: raw body (unwrapped subject and body). + "show" "--no-patch" "--format=%B" commit-range) + (goto-char (point-min)) + (while (re-search-forward "[bB]ug ?#\\([0-9]+\\)" nil t) + (push (match-string 1) bugnum))) + (let ((read-bugnum + (string-to-number + (completing-read + (if bugnum + (format "Bug # (default %s): " (car bugnum)) + "Bug #: ") + debbugs-gnu-completion-table nil t nil nil bugnum)))) + (debbugs-gnus-jump-to-bug read-bugnum) + (cl-callf2 mapcar #'string-to-number bugnum) + (unless (memql read-bugnum bugnum) + (push read-bugnum bugnum))) + (push (list bugnum repo-dir commit-range) + debbugs-gnu-picked-commits) + (if (derived-mode-p 'message-mode) + (debbugs-gnu-maybe-use-picked-commits) + (message "Reply to a message to continue")))) + +(defun debbugs-gnu-maybe-use-picked-commits () + "Add commit corresponding to current message's bug number. +Calls `debbugs-gnu-announce-commit' or `debbugs-gnu-post-patch' +on an entry with a matching bug number from +`debbugs-gnu-picked-commits'. Remove entry after message is +successfully sent." + (interactive) + (when (derived-mode-p 'message-mode) + (cl-loop with id = (car (debbugs-gnus-implicit-ids)) + for pcomm-entry in debbugs-gnu-picked-commits + for (bugnum repo-dir commit-range) = pcomm-entry + when (memql id bugnum) + do + (goto-char (point-max)) + (let ((default-directory repo-dir)) + (pcase (read-char-choice + (format "[a]nnounce commit, or [p]ost patch? (%s)" + commit-range) + '(?a ?p)) + (?a (debbugs-gnu-announce-commit commit-range id) ) + (?p (debbugs-gnu-post-patch commit-range id)))) + (add-hook 'message-send-actions + (lambda () + (cl-callf2 delq pcomm-entry + debbugs-gnu-picked-commits)) + nil t) + (remove-hook 'post-command-hook + #'debbugs-gnu-maybe-use-picked-commits) + (cl-return)))) + +;; We need to daisy chain the hooks because `message-setup-hook' runs +;; too early (before `message-yank-original'). +(defun debbugs-gnu--prepare-to-use-picked-commits () + (add-hook 'post-command-hook #'debbugs-gnu-maybe-use-picked-commits)) +(add-hook 'message-setup-hook #'debbugs-gnu--prepare-to-use-picked-commits) (defvar debbugs-gnu-usertags-mode-map (let ((map (make-sparse-keymap))) diff --git a/packages/debbugs/debbugs-ug.texi b/packages/debbugs/debbugs-ug.texi index 2bb01d2c2..0ea7ca521 100644 --- a/packages/debbugs/debbugs-ug.texi +++ b/packages/debbugs/debbugs-ug.texi @@ -313,6 +313,7 @@ in @code{org-mode}. * TODO Items:: TODO Items. * Control Messages:: Control Messages. * Applying Patches:: Applying Patches in the Emacs Repository. +* Posting Patches:: Posting Patches to Debbugs from the Emacs Repository. @end menu @@ -674,6 +675,31 @@ creates a ChangeLog entry with all needed information. A final @kbd{M-m} in the @samp{ChangeLog} buffer commits the patch via @samp{*vc-log*}. +@node Posting Patches +@section Posting Patches to Debbugs from the Emacs Repository + +Once you have committed a patch fixing a bug you usually want to post +it to the bug thread for review and testing. And when the patch is +deemed satisfactory and pushed to the official GNU Emacs repository, +the bug should be marked closed. + +@findex debbugs-gnu-pick-commits +The command @code{debbugs-gnu-pick-commits} helps automate both these +processes: it queries for a commit (or commit range), and a bug number +(defaulting to the bug number mentioned in the commit message). It +then jumps you to a buffer associated with the bug. When you reply to +a message in the bug thread, you are asked whether to post the commits +as patches (optionally tagging the bug with @code{"patch"}), or +announce that the bug has been fixed by the selected commits +(optionally closing the bug and marking as closed in the Emacs version +corresponding to the patch). + +@vindex debbugs-gnu-read-commit-range-hook +The query for commit (or commit range) to use is controlled by +@code{debbugs-gnu-read-commit-range-hook}. Initially it has an entry +which operates in @samp{*vc-change-log*} buffers: the default will be +the commit under point, or the commit range contained in the region if +it is active. @node Minor Mode @chapter Minor Mode -- 2.11.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 21 15:59:02 2019 Received: (at 35362) by debbugs.gnu.org; 21 Apr 2019 19:59:02 +0000 Received: from localhost ([127.0.0.1]:49112 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIIc9-0005cu-Uj for submit@debbugs.gnu.org; Sun, 21 Apr 2019 15:59:02 -0400 Received: from mout.gmx.net ([212.227.17.22]:46047) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIIc8-0005cP-3w for 35362@debbugs.gnu.org; Sun, 21 Apr 2019 15:59:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1555876732; bh=dgSty1Fs9SVT/JF5v65wPikyAz19WbV99Lgh2f+Mm5A=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=HO/vG1WQZ27QKjQAWVm0BtSYjwpcylbaTAopu9p1ntj17AXCb1+rOdoe1GVEJu5sc EBA+z7/bNQ6Ha51TdkKPqk7Cp1/cIVe9W7zFQKrGDSANIZ8QLP/5xNRBGdyCAEP94Z AFLabMJOx4mIm+TN0nzC3rre1SRKcP0AR2VIluAw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from detlef.gmx.de ([212.86.57.1]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MZfZi-1hX4ZW2Un8-00LT5E; Sun, 21 Apr 2019 21:58:52 +0200 From: Michael Albinus To: Noam Postavsky Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> <87wojns7ia.fsf@gmail.com> Date: Sun, 21 Apr 2019 21:58:51 +0200 In-Reply-To: <87wojns7ia.fsf@gmail.com> (Noam Postavsky's message of "Sun, 21 Apr 2019 11:27:57 -0400") Message-ID: <875zr7cepw.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:Zlm357Lcqr5+ag4vfKF+GitBBQtp4P0gZj6ShRcuIzh4ib/nYsA Gnad60UIjHym+AVQ57TJzgI+CVEp+ofg4F1fdRzlrmp9pC3lEM5BvpCmFneUmgJntsAM/FH c38SMDqOSItyLTPUgypd74ivWzmU6BVyTSoZorMufoNGfpPY/WqlYYIDXK8CbNuj2t+ZgPR mchPM9Ue1jWXarob83iZA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:1KlGmaqcfys=:H4R2/bqJeSFmDo8ovkSym4 +tsGW8seRuuKqaVfCCgcOicP/slFQ45GN6hRFX4UeIfRjIljwQOnf/RD2I57sNmdaEQI5vS3i JiUDCEovV2Ou/MR27IPuKFPZmmLBBmy21WqpFjF3iaypmRu7UdTik2YJXqSQ6Kej/czy+XWY9 d3loRO6lMQviIV8I6Ag2uR7MzOVTz/yHlW6VFEsbHhfzXDCdwcJQFtfVupSnbGXisFOtYPuqy DlV93zpAJLVqagrLmALsG+95LToRTVc5F7g8c4v0D5DD3XZ9w77wdhCXnRqBYa+HTOfkL3Kq0 NUPtV+MSOX8vpaCed3qyY9aJsQM3398ajfiXLzMxHKEF/ZcVneQ2gU/AVu4FB1/43NghbKuFC nMB4KqHBy+uI0jejiaFjR5dElmO6swn3TPgQvJC2dqM75J1y4/fewTArkAzfir5+7Dsx8WiZA wCTHsRjJzd5p9J+D098Aq0cFTE3zVgUvCD/JyNjvvQsNyxnhU3NIycnMzjwtOGreZa60141O1 iwpxe75mmQKJwSoZbPi03mLyjD38ih63Zg+tsTcMzP06lJNkr4ADogTcF0xDoHgbrnCC33new doK68nwxY8EIj5d4Kr/MXLVVCTRamCY6vkmrP7VVjcIuKKnin6ONqiXS4fCz/+DBjKEmLDaoi QmdAl95XbwWqtBtCwJ55OeBykacAwNcuhn6BjmzwDUhqR/pGM18gUshUM176vZenuE6wXB9Wy 7KVaUEAiHOdGMIGgHzt61YodK8dTr7kmEx1zbkUBBNHwCj+mPjVWKRV8pgCBenkFg6H8VHcjY erX0Y+N2XoliSbvrpP15LwN2HgU0G9IGu8Gr7RzW/338CxuZV7H2/HGcKEbvkqt4xjGRB/4IQ HUPmFB2H51jMKgwkKd/mt8X8yS35ME54AQtxxbQ6qTGBW4cr93vYRrGswnpfWoCNqIflPWEdj PWYDgbUiGRw== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 35362 Cc: 35362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Noam Postavsky writes: Hi Noam, I haven't tried your patch yet. Just some first comments while reading it: All your defcustoms miss a :version tag. I guess, "27.1" is proper. > ;; Use Gnus. > (gnus-read-ephemeral-emacs-bug-group > (cons id (if (listp merged) merged (list merged))) > + This doesn't work, gives wrong-type-argument listp when quitting. Comment chars are missing. Leftover from editing? > +(defun debbugs-gnus-jump-to-bug (bugid) > + "Display buffer associated with BUGID with `pop-to-buffer'. > +Use `gnus-read-ephemeral-emacs-bug-group' instead if there is no such buffer." debbugs-gnu.el supports both gnus and rmail. Do we miss something for rmail then? (I'm not an rmail user, but Eli is.) > +(defun debbugs-gnu--git-insert (&rest args) > + "Insert output of running git with ARGS. > +Throws error if git returns non-zero. Uses `debbugs-gnu-git-program'." > + (unless (eql 0 (apply #'process-file > + debbugs-gnu-git-program nil '(t t) nil > + args)) > + (error "git %s failed: %s" (car args) (buffer-string)))) Why not `vc-git--call'? > + (debbugs-gnu--git-insert "remote" "-v") > + (debbugs-gnu--git-insert > + ;; %H: commit hash. > + "log" "-1" "--format=%H" commit-range) > + (apply > + #'debbugs-gnu--git-insert > + "branch" "--remote" "--contains" last-commit > + (mapcar (lambda (glob) (concat remote glob)) > + ref-globs)) > + (debbugs-gnu--git-insert > + "show" "--no-patch" > + (concat "--format=" debbugs-gnu-commit-description-format > + "\n" (cdr (assq 'commit-url remote-info)) "\n") > + commit-range) > + (apply #'debbugs-gnu--git-insert > + "format-patch" (concat "--output-directory=" dir) > + (append format-patch-args > + (list commit-range)))) > + (debbugs-gnu--git-insert > + ;; %B: raw body (unwrapped subject and body). > + "show" "--no-patch" "--format=%B" commit-range) Aren't there respective vc-git functions we could reuse? > +@node Posting Patches > +@section Posting Patches to Debbugs from the Emacs Repository > + > +Once you have committed a patch fixing a bug you usually want to post > +it to the bug thread for review and testing. And when the patch is > +deemed satisfactory and pushed to the official GNU Emacs repository, > +the bug should be marked closed. Currently, you are supporting both Emacs and ELPA repositories, aren't you? Please sday so. > +@findex debbugs-gnu-pick-commits > +The command @code{debbugs-gnu-pick-commits} helps automate both these > +processes: it queries for a commit (or commit range), and a bug number > +(defaulting to the bug number mentioned in the commit message). It > +then jumps you to a buffer associated with the bug. When you reply to > +a message in the bug thread, you are asked whether to post the commits > +as patches (optionally tagging the bug with @code{"patch"}), or > +announce that the bug has been fixed by the selected commits > +(optionally closing the bug and marking as closed in the Emacs version > +corresponding to the patch). > + > +@vindex debbugs-gnu-read-commit-range-hook > +The query for commit (or commit range) to use is controlled by > +@code{debbugs-gnu-read-commit-range-hook}. Initially it has an entry > +which operates in @samp{*vc-change-log*} buffers: the default will be > +the commit under point, or the commit range contained in the region if > +it is active. Reading this doesn't give me a clear picture what happens. Could you add an example? Also, pls describe at least `debbugs-gnu-git-remote-info-alist'. Other projects but Emacs might profit from. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 22 15:42:43 2019 Received: (at 35362) by debbugs.gnu.org; 22 Apr 2019 19:42:43 +0000 Received: from localhost ([127.0.0.1]:51642 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIepu-0004Ex-45 for submit@debbugs.gnu.org; Mon, 22 Apr 2019 15:42:43 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:43200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIeps-0004Ek-7f for 35362@debbugs.gnu.org; Mon, 22 Apr 2019 15:42:40 -0400 Received: by mail-qk1-f196.google.com with SMTP id p19so4796482qkm.10 for <35362@debbugs.gnu.org>; Mon, 22 Apr 2019 12:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=NxDAqHAHwUelDNZP6jfQPkm7JbD9C59ADEiX5Anj6h4=; b=kXTIcnYN0CF/9rhYG8EIALe5pInHEsO8YRq1HrXDILTYhPF05vlv6ymeCWClzrdVHx XfUUF4FNHD8VPYG5yKWWS3HCwthL2a8ZNkBI7DlVlxKjZ10SfrHqiHeKpanLxv9B5SYC VgQV0oPJvYRUrdnbIWol2MmW4ghcXGCK0Ql+Vr8L4Y+TxgiW+9g2qLjxQ5oHXvx5Pmsw om0DclmsBdsVNfmrADt/wGETT76i4jiJ6tZEHPdOUVCUo/Cw4Nldy5FSXGg4DQYLA95U 70XvzlQJD56MyFPA+o0bPUwt0m/At2fmSno+27K5G8dn/LrQ6dcyLCZEa9l2IjwaHHgb nZKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=NxDAqHAHwUelDNZP6jfQPkm7JbD9C59ADEiX5Anj6h4=; b=mKdFi1m/gdUF+jg/P5GrCK9KedGymWRe6HkF0F1hf0xIXvlix/brZG3n8yCBWOqSbn E0zGyTPmZJexwFU6V3JOtaN2gi9TyNPM5fIC9VjGK4eSRKRl6/vWvVJ3nY5RO6rwZ4fF YFGqFkch0fFWCdjWP+afVydMaZGQR8iIKYkNS0Ne8gWuAoK4w5kumJZetHm6EDiq7W3S MLJEjArn3QTjsBFrG0fhJV8734BEmZf/FupxOwJ29TfoRdnoLr4gwc2xZ974ZofQM9uG +W3IYgmoGcltNdwTVx+UlRGCMUj/4Q8ItcX1/frpm5MPuAjFFLncA3ed+HWOUozaV1aL b2Ag== X-Gm-Message-State: APjAAAXqLrm4T6mi+OZ7voSoCa1BVwqzItRmZrImTZ/YcdbohuMqTwP6 feObAOF2481Dr3gkmCMg5nTz6V3w X-Google-Smtp-Source: APXvYqytRruTFcv640o9gQ/MVUzyI41WQpeAwnNzmTOI2MbzCYOUl613qunNY94ou4v0KooB6JX3Lg== X-Received: by 2002:a05:620a:1253:: with SMTP id a19mr16152279qkl.148.1555962154351; Mon, 22 Apr 2019 12:42:34 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id d21sm6579896qkl.58.2019.04.22.12.42.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 12:42:33 -0700 (PDT) From: Noam Postavsky To: Michael Albinus Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> <87wojns7ia.fsf@gmail.com> <875zr7cepw.fsf@gmx.de> Date: Mon, 22 Apr 2019 15:42:31 -0400 In-Reply-To: <875zr7cepw.fsf@gmx.de> (Michael Albinus's message of "Sun, 21 Apr 2019 21:58:51 +0200") Message-ID: <87d0ldsu6w.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 35362 Cc: 35362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.2 (-) Michael Albinus writes: > All your defcustoms miss a :version tag. I guess, "27.1" is proper. Oh, hmm. Shouldn't the version correspond to the debbugs.el package version, since it's not tied to the Emacs version as such? >> ;; Use Gnus. >> (gnus-read-ephemeral-emacs-bug-group >> (cons id (if (listp merged) merged (list merged))) >> + This doesn't work, gives wrong-type-argument listp when quitting. > > Comment chars are missing. Leftover from editing? Sorry, this hunk was supposed to be dropped completely. >> +(defun debbugs-gnus-jump-to-bug (bugid) >> + "Display buffer associated with BUGID with `pop-to-buffer'. >> +Use `gnus-read-ephemeral-emacs-bug-group' instead if there is no such buffer." > > debbugs-gnu.el supports both gnus and rmail. Do we miss something for > rmail then? > > (I'm not an rmail user, but Eli is.) Possibly yes, I haven't used rmail so I'm not sure how to test that out. >> +(defun debbugs-gnu--git-insert (&rest args) >> + "Insert output of running git with ARGS. >> +Throws error if git returns non-zero. Uses `debbugs-gnu-git-program'." >> + (unless (eql 0 (apply #'process-file >> + debbugs-gnu-git-program nil '(t t) nil >> + args)) >> + (error "git %s failed: %s" (car args) (buffer-string)))) > > Why not `vc-git--call'? I thought relying on a function marked as internal would not be a good idea for an ELPA package which should potentially work across multiple versions of Emacs. Otherwise vc-git--call should work fine too. >> + (debbugs-gnu--git-insert "remote" "-v") > >> + (debbugs-gnu--git-insert >> + ;; %H: commit hash. >> + "log" "-1" "--format=%H" commit-range) > >> + (apply >> + #'debbugs-gnu--git-insert >> + "branch" "--remote" "--contains" last-commit >> + (mapcar (lambda (glob) (concat remote glob)) >> + ref-globs)) > >> + (debbugs-gnu--git-insert >> + "show" "--no-patch" >> + (concat "--format=" debbugs-gnu-commit-description-format >> + "\n" (cdr (assq 'commit-url remote-info)) "\n") >> + commit-range) > > >> + (apply #'debbugs-gnu--git-insert >> + "format-patch" (concat "--output-directory=" dir) >> + (append format-patch-args >> + (list commit-range)))) > >> + (debbugs-gnu--git-insert >> + ;; %B: raw body (unwrapped subject and body). >> + "show" "--no-patch" "--format=%B" commit-range) > > Aren't there respective vc-git functions we could reuse? No, I don't see any. >> +@node Posting Patches >> +@section Posting Patches to Debbugs from the Emacs Repository >> + >> +Once you have committed a patch fixing a bug you usually want to post >> +it to the bug thread for review and testing. And when the patch is >> +deemed satisfactory and pushed to the official GNU Emacs repository, >> +the bug should be marked closed. > > Currently, you are supporting both Emacs and ELPA repositories, aren't > you? Please sday so. Yes. >> +@findex debbugs-gnu-pick-commits >> +The command @code{debbugs-gnu-pick-commits} helps automate both these [...] > Reading this doesn't give me a clear picture what happens. Could you add > an example? > > Also, pls describe at least `debbugs-gnu-git-remote-info-alist'. Other > projects but Emacs might profit from. Okay, I've expanded the manual section (inlined below) maybe it gives you a more clear picture (or maybe a less clear one :/). @node Posting Patches @section Posting Patches to Debbugs from the Emacs Repository Once you have committed a patch fixing a bug you usually want to post it to the bug thread for review and testing. And when the patch is deemed satisfactory and pushed to the official repository, the bug should be marked closed. @findex debbugs-gnu-pick-commits The command @code{debbugs-gnu-pick-commits} helps automate both these processes: it queries for a commit (or commit range), and a bug number (defaulting to the bug number mentioned in the commit message). It then jumps you to a buffer associated with the bug. When you reply to a message in the bug thread, you are asked whether to post the commits as patches (optionally tagging the bug with @code{"patch"}), or announce that the bug has been fixed by the selected commits (optionally closing the bug and marking as closed in the Emacs version corresponding to the patch). For example, suppose you are reading the message of ``Bug#1234: foo-mode fails to call frobnicate on startup'' in a message buffer. You decide to fix it, so you switch to the source code, add in the missing call and commit locally, with the commit message ``* lisp/foo-mode.el (foo-mode): Call frobnicate (Bug#1234).'' Use @kbd{C-x v l} to run @code{vc-print-log}, and navigate to the new commit. Invoke the command @code{debbugs-gnu-pick-commits} and press @kbd{RET} to accept the default bug number (which will be 1234 since it's in the commit message) in response to the prompt. You are then popped to the message buffer, and when you reply to the message, press @kbd{p} to post the git formatted patch as an attachment for review, and then answer @kbd{y} to tag the bug with @code{"patch"} when the message is sent. Assuming you get favorable reviews, you then push it, and again call @code{debbugs-gnu-pick-commits} but this time press @kbd{a} (for ``announce'') after replying to the relevant bug thread message. This will insert some text describing the commit and where it was pushed to, and answering @kbd{y} will arrange for the bug to be closed when the message is sent. @node Customizing debbugs-gnu-pick-commits @subsection Customizing debbugs-gnu-pick-commits @vindex debbugs-gnu-read-commit-range-hook The query for commit (or commit range) to use is controlled by @code{debbugs-gnu-read-commit-range-hook}. Initially it has an entry which operates in @samp{*vc-change-log*} buffers: the default will be the commit under point, or the commit range contained in the region if it is active. @vindex debbugs-gnu-commit-description-format @vindex debbugs-gnu-git-remote-info-alist The string inserted to describe an announced commit is controlled by the variable @code{debbugs-gnu-commit-description-format}, it is a format string passed to the @code{--format} argument of @code{git show}. Additionally, if the remote url matches an entry in @code{debbugs-gnu-git-remote-info-alist}, then its @code{commit-url} subitem is appended to the commit description. By default this variable is configured for the GNU Emacs and GNU ELPA repositories. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 23 04:03:49 2019 Received: (at 35362) by debbugs.gnu.org; 23 Apr 2019 08:03:49 +0000 Received: from localhost ([127.0.0.1]:52271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIqP7-0003hQ-8t for submit@debbugs.gnu.org; Tue, 23 Apr 2019 04:03:49 -0400 Received: from mout.gmx.net ([212.227.15.19]:40843) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIqP5-0003hB-Hx for 35362@debbugs.gnu.org; Tue, 23 Apr 2019 04:03:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1556006621; bh=gaz4Ds2lm8XJBXvYsPLEFTL/NaBdaQhYq0z89fFmIPM=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=hR9Rx4kT6FC+iQOZlT/FgL9e8Avzaj0KsT/HT7lC7iGaIGJ9XvEkzJwZzuO4tohee XJdockna2wJ7ui2uByQF6sqb20TnYdZJozC+AcwXUBNcjnC02othALXgvrgaXQgoLC FG2GFeSWCVWNOFEoBM7Iwj00hnQa5RSwpea6w/Ok= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from detlef.gmx.de ([212.86.38.216]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LwrwO-1glhQa3GFk-016L1Q; Tue, 23 Apr 2019 10:03:40 +0200 From: Michael Albinus To: Noam Postavsky Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> <87wojns7ia.fsf@gmail.com> <875zr7cepw.fsf@gmx.de> <87d0ldsu6w.fsf@gmail.com> Date: Tue, 23 Apr 2019 10:03:39 +0200 In-Reply-To: <87d0ldsu6w.fsf@gmail.com> (Noam Postavsky's message of "Mon, 22 Apr 2019 15:42:31 -0400") Message-ID: <87tvep87xg.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:9laCsk2Nfv2ouE3mDkoB+FuQSPR0gsR2H52E4gqK1m9YTM2CG/q Lnu8zPp84t7Io/TwLtIHMkB1DBzn0fsEiI1AVzYeCpUdnCMBjbuonLlPDmOaZUyifBVyBqa qCMQnddd6OGo8n8TeZBMBYisguiJ4qo0aHYzqPVm3HL8nLe48ysAA7y8PKfo8p0uGgR2GM3 EzyPlLuFNLVYo+WFt3LAA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:zXLW4/SxLiA=:JUW549hvj9iRUNl/kuzhhV iigU5jff22RyH1X6CDPp4pW9cEX7GpfyBCXYuk3/plEcSsWtjHXDSmLIAK+9GVt+76ik2IHyq Pa893wMqqpodGu8lQSyxIBN88cGVVJYowyHPU2mjLESuFxZIEMGVwIQfQ9X6QJ6Zn15wQsl+N 1CVmd5ChdKI4gtWa5UOOeZmDiQGIw/DkjxtcwRHSabfGVFYB75sSp/jp99JlT7jlu4hALkE2k w81jFxcqobSFqkLE4CfD9Jp9KPcjiwKgbZNs2lno6e8q3INl7FXyGsq+HF1hWjYmgqha+KOM+ ykDgQ54yUSVz9j+4it+luvYtUbuIQZrqDB/WajCMmTEPOSZakTP6u2wyq7oneY+OFOVApuC/j xD8L3tMM9qZkVg/D7aAoYfmXyGazuR06MSjRIfM52RuWJHvWMQLAQNVR8C4vr62Pqhafutzbl F6TCza1OibcrXG20trd6otjUr5Pl4u09/KiNvYi/wC96eqFR301um9P/vONWcjQxEFoiF0Tpm JFarXk/ziIb/4Va2NqumPsJVn8TfLSn9HHolxw5cLSZ2sMCKjIKrlhw28+Ojxj/WgDMEz8TkM PD2l/WNkklrw0tRvBquHWot418nxZqUJiXhTqge3ViLm7/t9ceGgo1JGNOJW8wePPGsnEsojc kvz/mjzd0IHCGB0ZBZaG06oP3qrlPqIeVZICoG9XtMBPrLgG1k4kGfDdQs7YVt7tA+PEuC+R5 1P30TQjxveiC8pAwUa81BAiSTOJwibt5ZTB0z+fU2oBe/Kj9k956Ttxn9QH+AY/o6QUvW99DT KfHBp73mhKFFYLfYAjsXAY2N6jqWAlOuhfNUi5I4g3tBApNMpOg7tmpY8iRvR/7VtK/A94hCo QVy1/Beup+PxZPrh6zASMGavIU0fidP4Ogksv7XjEfgoUs6ZzNOeRX5ZXz+aReDqPopLH7DJr P1+lOD9+Akw== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 35362 Cc: 35362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Noam Postavsky writes: Hi Noam, >> All your defcustoms miss a :version tag. I guess, "27.1" is proper. > > Oh, hmm. Shouldn't the version correspond to the debbugs.el package > version, since it's not tied to the Emacs version as such? I usually take the Emacs version for the :version attribute. Debbug's own version would be better tagged with :package-version; I haven't used this attribute, 'tho. >> debbugs-gnu.el supports both gnus and rmail. Do we miss something for >> rmail then? >> >> (I'm not an rmail user, but Eli is.) > > Possibly yes, I haven't used rmail so I'm not sure how to test that out. Me neither. Let's keep it as it is, waiting for protest ... or patches. >>> +(defun debbugs-gnu--git-insert (&rest args) >>> + "Insert output of running git with ARGS. >>> +Throws error if git returns non-zero. Uses `debbugs-gnu-git-program'." >>> + (unless (eql 0 (apply #'process-file >>> + debbugs-gnu-git-program nil '(t t) nil >>> + args)) >>> + (error "git %s failed: %s" (car args) (buffer-string)))) >> >> Why not `vc-git--call'? > > I thought relying on a function marked as internal would not be a good > idea for an ELPA package which should potentially work across multiple > versions of Emacs. Otherwise vc-git--call should work fine too. Right. However, this function is stable for years. And its implementation looks more robust than your version. > Once you have committed a patch fixing a bug you usually want to post > it to the bug thread for review and testing. And when the patch is > deemed satisfactory and pushed to the official repository, the bug > should be marked closed. Well, this is about local commits, which haven't been pushed yet. Or maybe pushed already, but in a branch. Could you pls say? > For example, suppose you are reading the message of ``Bug#1234: All other examples in this manual use 12345. Do we want to follow? > Invoke the command @code{debbugs-gnu-pick-commits} and press Should we give this command a key binding? > @kbd{RET} to accept the default bug number (which will be 1234 since This should be @kbd{@key{RET}}, like at other places in this manual. > @vindex debbugs-gnu-read-commit-range-hook > The query for commit (or commit range) to use is controlled by > @code{debbugs-gnu-read-commit-range-hook}. Initially it has an entry > which operates in @samp{*vc-change-log*} buffers: the default will be > the commit under point, or the commit range contained in the region if > it is active. I don't understand (yet), how the description of this variable helps. Is the user expected to change the value herself, somehow? Otherwise, we might to keep this description out. > Additionally, if the remote url matches an entry in > @code{debbugs-gnu-git-remote-info-alist}, then its @code{commit-url} > subitem is appended to the commit description. By default this > variable is configured for the GNU Emacs and GNU ELPA repositories. Maybe you add a short sentence, that it is expected that people adapt this user option if they run an own Emacs fork, located somewhere else, or if they host a repository for own packages. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 24 22:11:10 2019 Received: (at 35362) by debbugs.gnu.org; 25 Apr 2019 02:11:10 +0000 Received: from localhost ([127.0.0.1]:56993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hJTqs-0001dZ-Ip for submit@debbugs.gnu.org; Wed, 24 Apr 2019 22:11:10 -0400 Received: from mail-qt1-f179.google.com ([209.85.160.179]:42801) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hJTqn-0001cy-22 for 35362@debbugs.gnu.org; Wed, 24 Apr 2019 22:11:05 -0400 Received: by mail-qt1-f179.google.com with SMTP id p20so22735124qtc.9 for <35362@debbugs.gnu.org>; Wed, 24 Apr 2019 19:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=KCZWT/gQhkLKor9msgzfnv7V3ZKAJyn7xzXglDLZm+Y=; b=G018iWyO5J2UQPBcS7CHkhqM3KVM4BGbdlvKi5kGOKM4Mc7Q7RwfRlPhCJeiBcwtsc 9PnW2T5X/+T4iQIFBAK/tKZb1m0RDmN1wABtUT1Y6Y95op4UvZy61V6af0tHiW6EPGKR eS+hmriCqTPe/fqHxQ5rVKQe6QusYok6D7Us0ia8ab06pfn2V0/xfrs/a9++g3RnV4rk w5hVr7BcAiFo1nWQH8N9VYmXMn2DVMXhbSAKscVQ3YDVCy532SAnlN4yVxcFCrTIA2Pu xSQOim0o6p0IMCT9G8dhJPdtMx6hE2lwaoJ9qLW1DcMiDStD8lTh3w1jp6sXR40pm9ne goag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=KCZWT/gQhkLKor9msgzfnv7V3ZKAJyn7xzXglDLZm+Y=; b=C9NqSZVKutTsj2XD2FZpjiEfnuTH+xb/NZ4P8PcRBw45Lm2f6xioEqZQpTG03JEDcB 4iWIjxGkZOIhX7qoZ2+u0Rjj/HBWObDam1lZe9a8JewmdeNfK4nNMJxyxQqu8/gyEjea Rt7YTFygH7GcMMCJEMHaDv+QmIaP94vH+ue+bj9P7x8OfeezLSE0ScDsggY7wtMS7CAG Ychj+AxXyAi+Cal2wjnMN6sZhwXksA9WmZjavDI2wTfGSam/9kGHFeZNM5yDAU778FfW DeNkLpphpAmT6XzOFHxhYblrAMs4XTehZKp7IutTPLE+PdKi/lVS6/nTwhulOmlA0iIx UBaA== X-Gm-Message-State: APjAAAUmT4EbL0E1YM0l3zfIMyKy/OJHLpOkTK6DmPhIVTRZl2G9vTYV 5CvC4124Alq1saPM4PVd7zd/qjLF X-Google-Smtp-Source: APXvYqw2YASkFhyVX2JTjxT9HkDENMylQOsB7iAfGNGN4Qm9f8ucX+5/iqMCxoKZ3qjqyJe+xwm98A== X-Received: by 2002:ac8:2b0d:: with SMTP id 13mr28880256qtu.354.1556158255339; Wed, 24 Apr 2019 19:10:55 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id d34sm14624493qta.18.2019.04.24.19.10.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2019 19:10:53 -0700 (PDT) From: Noam Postavsky To: Michael Albinus Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> <87wojns7ia.fsf@gmail.com> <875zr7cepw.fsf@gmx.de> <87d0ldsu6w.fsf@gmail.com> <87tvep87xg.fsf@gmx.de> Date: Wed, 24 Apr 2019 22:10:52 -0400 In-Reply-To: <87tvep87xg.fsf@gmx.de> (Michael Albinus's message of "Tue, 23 Apr 2019 10:03:39 +0200") Message-ID: <87pnparg0j.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35362 Cc: 35362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Michael Albinus writes: > I usually take the Emacs version for the :version attribute. Debbug's > own version would be better tagged with :package-version; I haven't used > this attribute, 'tho. Alright. >>> debbugs-gnu.el supports both gnus and rmail. Do we miss something for >>> rmail then? >>> >>> (I'm not an rmail user, but Eli is.) >> >> Possibly yes, I haven't used rmail so I'm not sure how to test that out. > > Me neither. Let's keep it as it is, waiting for protest ... or patches. Right, maybe later. >>> Why not `vc-git--call'? >> >> I thought relying on a function marked as internal would not be a good >> idea for an ELPA package which should potentially work across multiple >> versions of Emacs. Otherwise vc-git--call should work fine too. > > Right. However, this function is stable for years. And its > implementation looks more robust than your version. Yes, that's true. Okay, switched to using it. >> Once you have committed a patch fixing a bug you usually want to post >> it to the bug thread for review and testing. And when the patch is >> deemed satisfactory and pushed to the official repository, the bug >> should be marked closed. > > Well, this is about local commits, which haven't been pushed yet. Or > maybe pushed already, but in a branch. Could you pls say? ok >> For example, suppose you are reading the message of ``Bug#1234: > > All other examples in this manual use 12345. Do we want to follow? Ah, I suppose we may as well stay consistent. >> Invoke the command @code{debbugs-gnu-pick-commits} and press > > Should we give this command a key binding? Maybe, but then the question is what map to bind it in. Is it okay to start adding things into vc-git-log-view-mode-map? >> @kbd{RET} to accept the default bug number (which will be 1234 since > > This should be @kbd{@key{RET}}, like at other places in this manual. ok. >> @vindex debbugs-gnu-read-commit-range-hook >> The query for commit (or commit range) to use is controlled by >> @code{debbugs-gnu-read-commit-range-hook}. Initially it has an entry >> which operates in @samp{*vc-change-log*} buffers: the default will be >> the commit under point, or the commit range contained in the region if >> it is active. > > I don't understand (yet), how the description of this variable helps. Is > the user expected to change the value herself, somehow? Otherwise, we > might to keep this description out. The idea is you can add entries that can work with other packages, e.g., magit. >> Additionally, if the remote url matches an entry in >> @code{debbugs-gnu-git-remote-info-alist}, then its @code{commit-url} >> subitem is appended to the commit description. By default this >> variable is configured for the GNU Emacs and GNU ELPA repositories. > > Maybe you add a short sentence, that it is expected that people adapt > this user option if they run an own Emacs fork, located somewhere else, > or if they host a repository for own packages. Ok. I didn't mention an Emacs fork as an expected variation, as that would mean a different debbugs server too, which I really just wouldn't expect to happen. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Automate-commit-debbugs-workflow-Bug-35362.patch Content-Description: patch >From 6385db091152bf64affceb5c388f3837bc7ccd9c Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 21 Apr 2019 11:11:30 -0400 Subject: [PATCH] Automate commit -> debbugs workflow (Bug#35362) * packages/debbugs/debbugs-gnu.el (debbugs-gnu-current-id): Return nil in buffers not in debbugs-gnu-mode. (debbugs-gnu-send-control-message): Don't remove bugs cache info here... (debbugs-gnu-make-control-message): ...do it here instead (using message-send-actions to wait for successful message send). (debbugs-gnus-jump-to-bug, debbugs-gnu-git-remote-info-alist) (debbugs-gnu-commit-description-format, debbugs-gnu--git-insert) (debbugs-gnu--git-remote-info, debbugs-gnu--git-get-pushed-to) (debbugs-gnu-announce-commit, debbugs-gnu-post-patch) (debbugs-gnu-read-commit-range-hook) (debbugs-gnu-read-commit-range-from-vc-log) (debbugs-gnu-picked-commits, debbugs-gnu-pick-commits) (debbugs-gnu-maybe-use-picked-commits) (debbugs-gnu--prepare-to-use-picked-commits): New commands, functions and variables. * packages/debbugs/debbugs-ug.texi (Posting Patches): New section. --- packages/debbugs/debbugs-gnu.el | 275 ++++++++++++++++++++++++++++++++++++++- packages/debbugs/debbugs-ug.texi | 61 +++++++++ 2 files changed, 332 insertions(+), 4 deletions(-) diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el index 997d367b0..3f3c5572b 100644 --- a/packages/debbugs/debbugs-gnu.el +++ b/packages/debbugs/debbugs-gnu.el @@ -180,12 +180,16 @@ (autoload 'rmail-summary "rmailsum") (autoload 'vc-dir-hide-up-to-date "vc-dir") (autoload 'vc-dir-mark "vc-dir") +(declare-function log-view-current-entry "log-view" (&optional pos move)) +(declare-function log-view-current-tag "log-view" (&optional pos)) + (defvar compilation-in-progress) (defvar diff-file-header-re) (defvar gnus-article-buffer) (defvar gnus-posting-styles) (defvar gnus-save-duplicate-list) (defvar gnus-suppress-duplicates) +(defvar message-sent-message-via) (defvar rmail-current-message) (defvar rmail-mode-map) (defvar rmail-summary-mode-map) @@ -1282,7 +1286,8 @@ (defun debbugs-gnu-current-id (&optional noerror) (error "No bug on the current line")))) (defun debbugs-gnu-current-status () - (get-text-property (line-beginning-position) 'tabulated-list-id)) + (when (derived-mode-p 'debbugs-gnu-mode) + (get-text-property (line-beginning-position) 'tabulated-list-id))) (defun debbugs-gnu-display-status (query filter status) "Display the query, filter and status of the report on the current line." @@ -1534,7 +1539,6 @@ (defun debbugs-gnu-send-control-message (message &optional reverse) (debbugs-gnu-make-control-message message id reverse (current-buffer)) (funcall (or debbugs-gnu-send-mail-function send-mail-function)) - (remhash id debbugs-cache-data) (message-goto-body) (message "Control message sent:\n%s" (buffer-substring-no-properties (point) (1- (point-max))))))) @@ -1720,8 +1724,271 @@ (defun debbugs-gnu-make-control-message (message bugid &optional reverse buffer) bugid (if reverse ?- ?+) message))))) (unless (looking-at-p debbugs-gnu-control-message-end-regexp) - (insert "quit\n\n")))) - + (insert "quit\n\n")) + (add-hook 'message-send-actions + (lambda () (remhash bugid debbugs-cache-data)) + nil t))) + +(defun debbugs-gnus-jump-to-bug (bugid) + "Display buffer associated with BUGID with `pop-to-buffer'. +Use `gnus-read-ephemeral-emacs-bug-group' instead if there is no such buffer." + (let ((bug-buf nil) + ;; By reverse order of preference. + (preferred-modes '(gnus-summary-mode gnus-article-mode message-mode))) + (save-current-buffer + (cl-loop + for buf in (buffer-list) + while preferred-modes do + (set-buffer buf) + (when-let (((memql bugid (debbugs-gnus-implicit-ids))) + (mode (cl-loop + for mode in preferred-modes + thereis (and (derived-mode-p mode) + ;; Don't choose sent message buffers. + (or (not (eq mode 'message-mode)) + (not message-sent-message-via)) + mode)))) + (setq preferred-modes (cdr (memq mode preferred-modes))) + (setq bug-buf buf)))) + (if bug-buf + (pop-to-buffer bug-buf '(display-buffer-reuse-window + . ((reusable-frames . visible)))) + (gnus-read-ephemeral-emacs-bug-group + bugid (cons (current-buffer) (current-window-configuration)))))) + +(defcustom debbugs-gnu-git-remote-info-alist + '(("git.sv.gnu.org\\(?::/srv/git\\)/emacs.git" . + ((commit-url + . "https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=%H") + (ref-globs . ("/emacs-*" "/master")))) + ("git.sv.gnu.org\\(?::/srv/git\\)/emacs/elpa" . + ((commit-url + . "https://git.savannah.gnu.org/cgit/emacs/elpa.git/commit/?id=%H")))) + "Nest alist for repository-specific information. +Each element has the form (REMOTE-REGEXP . INFO-ALIST), where +INFO-ALIST is an alist containing the repository attributes. + +Supported keys of INFO-ALIST are + +* `commit-url': Format of a URL for a given commit hash, using + format specifiers supported by `git show'. Used by + `debbugs-gnu-announce-commit' as a supplement to + `debbugs-gnu-commit-description-format'. + +* `ref-globs': List of glob patterns matching branches of + interest, used by `debbugs-gnu-announce-commit' to make the + \"Pushed to X\" message." + :version "27.1" + :type '(alist :key-type string :value-type (alist :key-type symbol))) + +(defcustom debbugs-gnu-commit-description-format + "%h %cI \"%s\"" + "Format used for describing commits in `debbugs-gnu-announce-commit'. +It is passed as --format argument to `git show', see its manual +page for formatting specifier meanings." + :version "27.1" + :type 'string) + +(defun debbugs-gnu--git-insert (&rest args) + "Insert output of running git with ARGS. +Throws error if git returns non-zero. Uses `vc-git-program'." + (unless (eql 0 (apply #'vc-git--call '(t t) args)) + (error "git %s failed: %s" (car args) (buffer-string)))) + +(defun debbugs-gnu--git-remote-info () + "Return (REMOTE . INFO-ALIST)." + (with-temp-buffer + (debbugs-gnu--git-insert "remote" "-v") + (catch 'found-remote + (dolist (remote-info debbugs-gnu-git-remote-info-alist) + (goto-char (point-min)) + (and (re-search-forward (car remote-info) nil t) + (progn (beginning-of-line) + (looking-at "[^ \t]+")) + (throw 'found-remote + (cons (match-string 0) (cdr remote-info)))))))) + +(defun debbugs-gnu--git-get-pushed-to (commit-range remote-info) + "Return the branch name which COMMIT-RANGE was pushed to. +REMOTE-INFO is return value of `debbugs-gnu--git-remote-info'." + (let* ((last-commit + (with-temp-buffer + (debbugs-gnu--git-insert + ;; %H: commit hash. + "log" "-1" "--format=%H" commit-range) + (goto-char (point-min)) + (buffer-substring (point-min) (line-end-position)))) + (remote (pop remote-info))) + (let ((ref-globs (cdr (assq 'ref-globs remote-info)))) + (with-temp-buffer + (apply + #'debbugs-gnu--git-insert + "branch" "--remote" "--contains" last-commit + (mapcar (lambda (glob) (concat remote glob)) + ref-globs)) + ;; First 2 characters are current branch indicator. + (goto-char (+ (point-min) 2)) + (and (looking-at (concat (regexp-quote remote) "/\\(.+\\)$")) + (match-string 1)))))) + +(defun debbugs-gnu-announce-commit (commit-range bugnum &optional _args) + "Insert info about COMMIT-RANGE into message. +Optionally call `debbugs-gnu-make-control-message' to close BUGNUM." + (let* ((status (car (debbugs-get-status bugnum))) + (packages (cdr (assq 'package status))) + (remote-info (debbugs-gnu--git-remote-info))) + (insert "\nPushed to " + (or (debbugs-gnu--git-get-pushed-to commit-range remote-info) "") + ".\n\n") + (debbugs-gnu--git-insert + "show" "--no-patch" + (concat "--format=" debbugs-gnu-commit-description-format + "\n" (cdr (assq 'commit-url remote-info)) "\n") + commit-range) + (when (y-or-n-p "Close bug? ") + (let ((emacs-version + (or (and (member "emacs" packages) + (file-exists-p "configure.ac") + (with-temp-buffer + (insert-file-contents "configure.ac") + (and (re-search-forward "\ +^ *AC_INIT(GNU Emacs, *\\([0-9.]+\\), *bug-gnu-emacs@gnu.org" + nil t) + (match-string 1)))) + ""))) + (debbugs-gnu-make-control-message + "done" bugnum nil (current-buffer)))))) + +(defun debbugs-gnu-post-patch (commit-range bugnum &optional format-patch-args) + "Attach COMMIT-RANGE as patches into current message. +Optionally call `debbugs-gnu-make-control-message'' to tag BUGNUM +with `patch'." + (letrec ((disposition (completing-read "disposition: " '("inline" "attachment"))) + ;; Make attachments text/plain for better compatibility + ;; (e.g., opening in browser instead of downloading). + (type (if (equal disposition "inline") "text/x-diff" "text/plain")) + (dir (make-temp-file (format "patches-for-bug%d-" bugnum) t)) + (deldir (lambda () + (delete-directory dir t) + (remove-hook 'message-exit-actions deldir t) + (remove-hook 'kill-buffer-hook deldir t)))) + (add-hook 'message-send-actions deldir nil t) + (add-hook 'kill-buffer-hook deldir nil t) + (with-temp-buffer + (apply #'debbugs-gnu--git-insert + "format-patch" (concat "--output-directory=" dir) + (append format-patch-args + (list commit-range)))) + (dolist (patch (directory-files dir t "\\`[^.]")) + (mml-attach-file patch type "patch" disposition)) + (when (and (not (member + "patch" (assq 'tags (car (debbugs-get-status + bugnum))))) + (y-or-n-p "Tag + patch? ")) + (debbugs-gnu-make-control-message + "patch" bugnum nil (current-buffer))))) + +(defvar debbugs-gnu-read-commit-range-hook nil + "Used by `debbugs-gnu-pick-commits'. +Each function receives no arguments, and should return an +argument compatible with `debbugs-gnu-pick-commits'. If the +function can't function in the current buffer, it should return +nil to let the next function try.") + +(defun debbugs-gnu-read-commit-range-from-vc-log () + "Read commit range from a VC log buffer. +Return commit at point, or commit range in region if it is +active. This function is suitable for use in +`debbugs-gnu-read-commit-range-hook'." + (when (derived-mode-p 'vc-git-log-view-mode) + (list (if (use-region-p) + (let ((beg (log-view-current-entry (region-beginning))) + (end (log-view-current-entry (region-end)))) + (if (= (car beg) (car end)) + ;; Region spans only a single entry. + (cadr beg) + ;; Later revs are at the top of buffer. + (format "%s~1..%s" (cadr end) (cadr beg)))) + (log-view-current-tag))))) +(add-hook 'debbugs-gnu-read-commit-range-hook + #'debbugs-gnu-read-commit-range-from-vc-log) + +(defvar debbugs-gnu-picked-commits nil + "List of commits selected in `debbugs-gnu-pick-commits'. +Format of each element is (BUGNUMBERS REPO-DIR COMMIT-RANGE).") + +(defun debbugs-gnu-pick-commits (commit-range) + "Select COMMIT-RANGE to post as patches or announce as pushed. +COMMIT-RANGE is read using `debbugs-gnu-read-commit-range-hook', +or `read-string' if none of its functions apply. Add entry to +`debbugs-gnu-pick-commits' and jump to read bug in prepration for +user to call `debbugs-gnu-maybe-use-picked-commits'." + (interactive + (or (run-hook-with-args-until-success + 'debbugs-gnu-read-commit-range-hook) + (list (read-string "Commit (or range): ")))) + (let ((bugnum nil) + (repo-dir default-directory)) + (with-temp-buffer + ;; %B = raw body (unwrapped subject and body) + (debbugs-gnu--git-insert + ;; %B: raw body (unwrapped subject and body). + "show" "--no-patch" "--format=%B" commit-range) + (goto-char (point-min)) + (while (re-search-forward "[bB]ug ?#\\([0-9]+\\)" nil t) + (push (match-string 1) bugnum))) + (let ((read-bugnum + (string-to-number + (completing-read + (if bugnum + (format "Bug # (default %s): " (car bugnum)) + "Bug #: ") + debbugs-gnu-completion-table nil t nil nil bugnum)))) + (debbugs-gnus-jump-to-bug read-bugnum) + (cl-callf2 mapcar #'string-to-number bugnum) + (unless (memql read-bugnum bugnum) + (push read-bugnum bugnum))) + (push (list bugnum repo-dir commit-range) + debbugs-gnu-picked-commits) + (if (derived-mode-p 'message-mode) + (debbugs-gnu-maybe-use-picked-commits) + (message "Reply to a message to continue")))) + +(defun debbugs-gnu-maybe-use-picked-commits () + "Add commit corresponding to current message's bug number. +Calls `debbugs-gnu-announce-commit' or `debbugs-gnu-post-patch' +on an entry with a matching bug number from +`debbugs-gnu-picked-commits'. Remove entry after message is +successfully sent." + (interactive) + (when (derived-mode-p 'message-mode) + (cl-loop with id = (car (debbugs-gnus-implicit-ids)) + for pcomm-entry in debbugs-gnu-picked-commits + for (bugnum repo-dir commit-range) = pcomm-entry + when (memql id bugnum) + do + (goto-char (point-max)) + (let ((default-directory repo-dir)) + (pcase (read-char-choice + (format "[a]nnounce commit, or [p]ost patch? (%s)" + commit-range) + '(?a ?p)) + (?a (debbugs-gnu-announce-commit commit-range id) ) + (?p (debbugs-gnu-post-patch commit-range id)))) + (add-hook 'message-send-actions + (lambda () + (cl-callf2 delq pcomm-entry + debbugs-gnu-picked-commits)) + nil t) + (remove-hook 'post-command-hook + #'debbugs-gnu-maybe-use-picked-commits) + (cl-return)))) + +;; We need to daisy chain the hooks because `message-setup-hook' runs +;; too early (before `message-yank-original'). +(defun debbugs-gnu--prepare-to-use-picked-commits () + (add-hook 'post-command-hook #'debbugs-gnu-maybe-use-picked-commits)) +(add-hook 'message-setup-hook #'debbugs-gnu--prepare-to-use-picked-commits) (defvar debbugs-gnu-usertags-mode-map (let ((map (make-sparse-keymap))) diff --git a/packages/debbugs/debbugs-ug.texi b/packages/debbugs/debbugs-ug.texi index 2bb01d2c2..9fa20b76c 100644 --- a/packages/debbugs/debbugs-ug.texi +++ b/packages/debbugs/debbugs-ug.texi @@ -313,6 +313,7 @@ in @code{org-mode}. * TODO Items:: TODO Items. * Control Messages:: Control Messages. * Applying Patches:: Applying Patches in the Emacs Repository. +* Posting Patches:: Posting Patches to Debbugs from the Emacs Repository. @end menu @@ -674,6 +675,66 @@ creates a ChangeLog entry with all needed information. A final @kbd{M-m} in the @samp{ChangeLog} buffer commits the patch via @samp{*vc-log*}. +@node Posting Patches +@section Posting Patches to Debbugs from the Emacs Repository + +Once you have committed a patch locally to fix a bug you usually want +to post it to the bug thread for review and testing. And when the +patch is deemed satisfactory and pushed to the official repository, +the bug should be marked closed. + +@vindex debbugs-gnu-read-commit-range-hook +The query for commit (or commit range) to use is controlled by +@code{debbugs-gnu-read-commit-range-hook}. Initially it has an entry +which operates in @samp{*vc-change-log*} buffers, but additional +entries may be added to give sensible results for other modes that +work with git. + +@findex debbugs-gnu-pick-commits +The command @code{debbugs-gnu-pick-commits} helps automate both these +processes: it queries for a commit (or commit range), and a bug number +(defaulting to the bug number mentioned in the commit message). It +then jumps you to a buffer associated with the bug. When you reply to +a message in the bug thread, you are asked whether to post the commits +as patches (optionally tagging the bug with @code{"patch"}), or +announce that the bug has been fixed by the selected commits +(optionally closing the bug and marking as closed in the Emacs version +corresponding to the patch). + +For example, suppose you are reading the message of ``Bug#12345: +foo-mode fails to call frobnicate on startup'' in a message buffer. +You decide to fix it, so you switch to the source code, add in the +missing call and commit locally, with the commit message ``* +lisp/foo-mode.el (foo-mode): Call frobnicate (Bug#12345).'' Use +@kbd{C-x v l} to run @code{vc-print-log}, and navigate to the new +commit. Invoke the command @code{debbugs-gnu-pick-commits} and press +@kbd{@key{RET}} to accept the default bug number (which will be 12345 +since it's in the commit message) in response to the prompt. You are +then popped to the message buffer, and when you reply to the message, +press @kbd{p} to post the git formatted patch as an attachment for +review, and then answer @kbd{y} to tag the bug with @code{"patch"} +when the message is sent. Assuming you get favorable reviews, you +then push it, and again call @code{debbugs-gnu-pick-commits} but this +time press @kbd{a} (for ``announce'') after replying to the relevant +bug thread message. This will insert some text describing the commit +and where it was pushed to, and answering @kbd{y} will arrange for the +bug to be closed when the message is sent. + +@node Customizing debbugs-gnu-pick-commits +@subsection Customizing debbugs-gnu-pick-commits + +@vindex debbugs-gnu-commit-description-format +@vindex debbugs-gnu-git-remote-info-alist +The string inserted to describe an announced commit is controlled by +the variable @code{debbugs-gnu-commit-description-format}, it is a +format string passed to the @code{--format} argument of @code{git +show}. Additionally, if the remote url matches an entry in +@code{debbugs-gnu-git-remote-info-alist}, then its @code{commit-url} +subitem is appended to the commit description. By default this +variable is configured for the GNU Emacs and GNU ELPA repositories, +more entries may be added to work with other repositories of other +packages. + @node Minor Mode @chapter Minor Mode -- 2.11.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 25 08:16:45 2019 Received: (at 35362) by debbugs.gnu.org; 25 Apr 2019 12:16:45 +0000 Received: from localhost ([127.0.0.1]:57686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hJdIz-0001NL-9r for submit@debbugs.gnu.org; Thu, 25 Apr 2019 08:16:45 -0400 Received: from mout.gmx.net ([212.227.15.18]:35345) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hJdIv-0001N4-U4 for 35362@debbugs.gnu.org; Thu, 25 Apr 2019 08:16:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1556194594; bh=g7QI878BIv5nJuxPBxWOUgJ5jKZnqvxPXn/GmX+3o6o=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=XYTusgmevIcCWjmRbq967NCoKw5hqNOqqZvGCpSMbdXrMbjz/OaVt+MYV8buSLNOl Oex33DzsFTsHEtB4ABGDj1zI6z2nSx4fsUdCYdTqFBOYs+ZU6rKBJJSaAuSP/Ye6tc HShxTDWaNd9rkluYiHvGc1xliqjlckA8EVnePGPs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from detlef.gmx.de ([212.86.57.174]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LgYuT-1gyIdz2mGb-00nzKy; Thu, 25 Apr 2019 14:16:34 +0200 From: Michael Albinus To: Noam Postavsky Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> <87wojns7ia.fsf@gmail.com> <875zr7cepw.fsf@gmx.de> <87d0ldsu6w.fsf@gmail.com> <87tvep87xg.fsf@gmx.de> <87pnparg0j.fsf@gmail.com> Date: Thu, 25 Apr 2019 14:16:33 +0200 In-Reply-To: <87pnparg0j.fsf@gmail.com> (Noam Postavsky's message of "Wed, 24 Apr 2019 22:10:52 -0400") Message-ID: <87lfzy8ela.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:n6BpwOXR9eV4adOy/FgF3Y5azmbGfGJcxYytSF6hXa4hu09Sj6M +PCfpokboqhL56IwM1FNZtY27DEnzYteQX544X03UkVBeHnVpcNiGcn2pNLWCbhcRBuSncq HT7abmLbyyoxGXVIHPfSm3dESIpnmM+8T06dwlwyC2kohgWf1dyG+XjYQ7t/KXAbZfk7DBG ADCYnrHMBK3CLk15OJqzQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:prd82jYIGVM=:q6b7cg86nxYTNBllTgya4Z Gt3ORLrRXxHNb1aqO2y1j8PsFxuElVIQQStSnZuvZ6vkx1+5WOa/VVxMVWm+M3+91Xw2nQrH2 re/EoniQWhdIt3Zk4APrx0APv5X3Eq4qGz+k46AYu1NzJizcsWkjHk3pvUItOfGX+QlVWw2n7 DcO+TLLIxNcu0Izjkf9uuuG1UQ4jPb93YPY4ddADOWEMNIFnXoeIh/7sr0GpmNJpdJXhK0nxh 35B5CPkgBUU7wWJuWEd2gmMaDbzizjDzZn0uNKqIm/1FQ5M8X6q3IGUyPs4T5MWu2j1+0Km0y /qHhCHZfXRXiYAxGHbuq68QMm6k0byoUFu+CPA87+xv064viVObTMV6b8d1RRPIakAvGB6mfp hIHhtVPAT+JBATpxFqvpnlC0YOBSiXB7DrkR+vqnSwQflS1EKeZgObSry4PK7xhSa+GyhQQ74 NR6htaxpJ55tpXVlCC1eK68YFu4E3cbBRnm3GKYICG0DaPZ4qaIhJpfqGnHk4IaTfWOstEIcE 5/ytUInVGUqz1sUuhvzojfELg2AQoLHiq/I1p7Zl5zDlgvhqRgQwV1ZMHqF8PKP/wI+wqlrTz Pipx67RoyBtZjU5GNKt32wTjTVva5ZBMjyQ0KvEvqAz0z8BvJunNW5iC7WgLf0etALpkQwWvk 25DKq80/SKF3Nh2ImIZStbEWOaRts991wLWSpk3In5Wb/8vhMcFyvD06T9e3MOw5TMnLb8z3+ JtxzwouKxBo2BySUYLKsqvHzQ1eXtNB5lfvyHvO/AVHy1Zi47u+oEYELN90nV5QXZ2IPLGtp/ zrtSzPmPFFkuPXF3zEZF/gMDWrorAFgrZbHmA7slC5QjlNxVceoryRlKl+/+vmUdoyVL5EeV7 MbB2hRSKZS6BczQTT93ivcwbvkU7Pj3RvrFTR48uZstIlo6sD3sB0yYbsA3KfGzyl7/k8+1yL jK6Kuvl67ZA== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 35362 Cc: 35362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Noam Postavsky writes: Hi Noam, I believe your patch is almost OK, so let's apply it. But of course, I still have some few remarks :-) >>> Invoke the command @code{debbugs-gnu-pick-commits} and press >> >> Should we give this command a key binding? > > Maybe, but then the question is what map to bind it in. Is it okay to > start adding things into vc-git-log-view-mode-map? Yep. Maybe we bind "c" for it, because other candidates (d/D/p/P) seem to be bound already. Furthermore, we might mention debbugs-gnu-pick-commits in the ;;; Commentary section of debbugs-gnu.el. >> I don't understand (yet), how the description of this variable helps. Is >> the user expected to change the value herself, somehow? Otherwise, we >> might to keep this description out. > > The idea is you can add entries that can work with other packages, e.g., > magit. OK, this part I don't understand yet (I'm not a magit user, for example). But I don't mind. > --- a/packages/debbugs/debbugs-gnu.el > +++ b/packages/debbugs/debbugs-gnu.el > + (add-hook 'message-send-actions > + (lambda () (remhash bugid debbugs-cache-data)) > + nil t))) Do we need to declare message-send-actions? > +(defun debbugs-gnus-jump-to-bug (bugid) > + "Display buffer associated with BUGID with `pop-to-buffer'. > +Use `gnus-read-ephemeral-emacs-bug-group' instead if there is no such buffer." Maybe you could add at least a FIXME for the lack of rmail support. > +(defun debbugs-gnu--git-insert (&rest args) > + "Insert output of running git with ARGS. > +Throws error if git returns non-zero. Uses `vc-git-program'." Don't mention vc-git-program. > + (unless (eql 0 (apply #'vc-git--call '(t t) args)) Declare vc-git--call. > +(defun debbugs-gnu--git-remote-info () > + "Return (REMOTE . INFO-ALIST)." Say, that REMOTE is a string, which must be matched by REMOTE-REGEXP of debbugs-gnu-git-remote-info-alist. Refer to the docstring of that user option. > + (dir (make-temp-file (format "patches-for-bug%d-" bugnum) t)) I'm curious: Why a trailing "-" in the buffer name? > + (deldir (lambda () > + (delete-directory dir t) > + (remove-hook 'message-exit-actions deldir t) Do we need to declare message-exit-actions? > + (dolist (patch (directory-files dir t "\\`[^.]")) > + (mml-attach-file patch type "patch" disposition)) Do we need to declare mml-attach-file? > +`debbugs-gnu-pick-commits' and jump to read bug in prepration for Typo. > --- a/packages/debbugs/debbugs-ug.texi > +++ b/packages/debbugs/debbugs-ug.texi > +The string inserted to describe an announced commit is controlled by > +the variable @code{debbugs-gnu-commit-description-format}, it is a It is a user option. > +subitem is appended to the commit description. By default this > +variable is configured for the GNU Emacs and GNU ELPA repositories, That's also a user option. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 27 09:44:36 2019 Received: (at 35362) by debbugs.gnu.org; 27 Apr 2019 13:44:36 +0000 Received: from localhost ([127.0.0.1]:34781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKNd5-0000qu-S4 for submit@debbugs.gnu.org; Sat, 27 Apr 2019 09:44:36 -0400 Received: from mail-qt1-f175.google.com ([209.85.160.175]:36401) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKNd3-0000qY-BP; Sat, 27 Apr 2019 09:44:34 -0400 Received: by mail-qt1-f175.google.com with SMTP id c35so7319624qtk.3; Sat, 27 Apr 2019 06:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=bxwueOgXY+p0toYpqm5tFjfih7ufyn+eWlII1bYV/ZQ=; b=PwqcExj/JaWs5Z3SQy/V6fsVWaGtuHflWL7G1DZTAd2N/UPJGnDbWDHALWOm3atAqd 7MetjX0ba1q/R0hvcPu1iRvVxtNbSfIKB9UH1/Onc4d44WTNVOtrK89UPXWM+VFQM++8 kNdZ6sUs4/FvhazHk7MytJEbql0z6KsBsAqJ+YrVc2ooK082lslIoZpQqnqsO43SvAln 8esJ6+zZKDjCbW2G3N8bt1t8zS27xle0EhSOfQUPDXUhZjJPzwRi3JBQ3R24K0mlDG5R gkVNBSxWFI7fw+7PgiRyGLeYowy6IgIeQsvlMmk38s5jJ8mC4zL6KRVErg4SG5KiGq6r 22LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=bxwueOgXY+p0toYpqm5tFjfih7ufyn+eWlII1bYV/ZQ=; b=MU2bdJmN1th9G+e3b1CkvP5UetgjmrYdhohF17+9dsiC1N4zAQTUGNvtHr2dassGaq 854dZPhrv5HoOw0Ctq1QpsK5MPimn/tAUFOBtbIhuySgfywbV0G2Fmq5t52uJf1hYd02 aiMSM4hJK9/br1LLICzEAQ2XJ8m6l3p8E2mjyntAlWTYZ7ljmIHOZXhF+oRhOURbgBFb oNznrIRn3ivTS1FVCAmmH1buTiFIsYe2qxin/pH2iDEcX4J/3hxlj6n9Ozm2x8kRZI2v rl+3LdsXaB5DTc65RvrPg6xlGBSvvtYOMp2sSKzDQfRyxms1ySxU944rHnH67b9PZzf3 4hYw== X-Gm-Message-State: APjAAAWB84rx4l6OCZ8chixZZBmkY5f6pCZm2THiNEy/lWnx9JMAK9Ol nOrj1mVASpbmTwdAo2zO/6Kal0kC X-Google-Smtp-Source: APXvYqyjIXw/uN7zZl4d7xHNPHlemGjy7oxwW8LT5LsClHa1swqOcASn4esfvavmCViP+vQ3sHdOZg== X-Received: by 2002:ac8:1417:: with SMTP id k23mr40760753qtj.288.1556372667443; Sat, 27 Apr 2019 06:44:27 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id n66sm10781873qkf.49.2019.04.27.06.44.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Apr 2019 06:44:25 -0700 (PDT) From: Noam Postavsky To: Michael Albinus Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> <87wojns7ia.fsf@gmail.com> <875zr7cepw.fsf@gmx.de> <87d0ldsu6w.fsf@gmail.com> <87tvep87xg.fsf@gmx.de> <87pnparg0j.fsf@gmail.com> <87lfzy8ela.fsf@gmx.de> Date: Sat, 27 Apr 2019 09:44:24 -0400 In-Reply-To: <87lfzy8ela.fsf@gmx.de> (Michael Albinus's message of "Thu, 25 Apr 2019 14:16:33 +0200") Message-ID: <877ebfr29z.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35362 Cc: 35362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 35362 fixed close 35362 quit Michael Albinus writes: > I believe your patch is almost OK, so let's apply it. But of course, I > still have some few remarks :-) Okay, pushed to master. 35f0db153 2019-04-27T09:28:21-04:00 "Automate commit -> debbugs workflow (Bug#35362)" https://git.savannah.gnu.org/cgit/emacs/elpa.git/commit/?id=35f0db1532612e8b6b4bcc5ecd2f7e479735110a >>>> Invoke the command @code{debbugs-gnu-pick-commits} and press >>> >>> Should we give this command a key binding? >> >> Maybe, but then the question is what map to bind it in. Is it okay to >> start adding things into vc-git-log-view-mode-map? > > Yep. Maybe we bind "c" for it, because other candidates (d/D/p/P) seem > to be bound already. Actually I noticed there are some minor modes that exist just to bind some dwim command in a few different modes, so I added a debbugs-gnu-pick-vc-log-commit-mode with the "c" binding (otherwise we would need eval-after-load to change vc-git-log-view-mode-map which package code isn't supposed to use). > Furthermore, we might mention debbugs-gnu-pick-commits in the > ;;; Commentary section of debbugs-gnu.el. > > >> --- a/packages/debbugs/debbugs-gnu.el >> +++ b/packages/debbugs/debbugs-gnu.el > >> + (add-hook 'message-send-actions >> + (lambda () (remhash bugid debbugs-cache-data)) >> + nil t))) > > Do we need to declare message-send-actions? No, add-hook operates on a symbol, not a variable. >> +(defun debbugs-gnus-jump-to-bug (bugid) >> + "Display buffer associated with BUGID with `pop-to-buffer'. >> +Use `gnus-read-ephemeral-emacs-bug-group' instead if there is no such buffer." > > Maybe you could add at least a FIXME for the lack of rmail support. Ok. Actually I see there is a debbugs-read-emacs-bug-with-rmail function, so I think it shouldn't be too hard to figure out rmail support, but I'll do it in a separate patch. >> +(defun debbugs-gnu--git-insert (&rest args) >> + "Insert output of running git with ARGS. >> +Throws error if git returns non-zero. Uses `vc-git-program'." > > Don't mention vc-git-program. ok >> + (unless (eql 0 (apply #'vc-git--call '(t t) args)) > > Declare vc-git--call. right. >> +(defun debbugs-gnu--git-remote-info () >> + "Return (REMOTE . INFO-ALIST)." > > Say, that REMOTE is a string, which must be matched by REMOTE-REGEXP of > debbugs-gnu-git-remote-info-alist. Refer to the docstring of that user option. right >> + (dir (make-temp-file (format "patches-for-bug%d-" bugnum) t)) > > I'm curious: Why a trailing "-" in the buffer name? That was a typo. >> + (deldir (lambda () >> + (delete-directory dir t) >> + (remove-hook 'message-exit-actions deldir t) > > Do we need to declare message-exit-actions? no (as for add-hook) >> + (dolist (patch (directory-files dir t "\\`[^.]")) >> + (mml-attach-file patch type "patch" disposition)) > > Do we need to declare mml-attach-file? It seems to already be autoloaded. >> +`debbugs-gnu-pick-commits' and jump to read bug in prepration for > > Typo. oops. >> --- a/packages/debbugs/debbugs-ug.texi >> +++ b/packages/debbugs/debbugs-ug.texi > >> +The string inserted to describe an announced commit is controlled by >> +the variable @code{debbugs-gnu-commit-description-format}, it is a > > It is a user option. > >> +subitem is appended to the commit description. By default this >> +variable is configured for the GNU Emacs and GNU ELPA repositories, > > That's also a user option. Right, I don't use customize much, so the distinction is lost on me. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 28 03:54:01 2019 Received: (at 35362) by debbugs.gnu.org; 28 Apr 2019 07:54:01 +0000 Received: from localhost ([127.0.0.1]:36652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKedM-0005V0-Qp for submit@debbugs.gnu.org; Sun, 28 Apr 2019 03:54:01 -0400 Received: from mout.gmx.net ([212.227.15.15]:60113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKedH-0005Uj-Lk for 35362@debbugs.gnu.org; Sun, 28 Apr 2019 03:53:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1556438029; bh=uE8Cu5hVQaF81wDu0B+v2qttZB6kiHXUUBrYkH1ol30=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=PRikCGn9h/WspTEJSSzJ+RxjG0WXsrzIsDkXz4iWpC+NgFyHC0JO0nS3yU8Ku4iB3 ryXCw6z0+mmWEUWaYTvntYUsJ6JUEFAEUrnYTp6K2oaKhKYZi9F1ZdQW1VajLbFDcg 0+JqJC3D3FcjNF6xPPl6ukKkJ2ddy+X1B6GSltzU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from detlef.gmx.de ([213.220.159.69]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MAONd-1hVxRO0FvX-00BrmM; Sun, 28 Apr 2019 09:53:49 +0200 From: Michael Albinus To: Noam Postavsky Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> <87wojns7ia.fsf@gmail.com> <875zr7cepw.fsf@gmx.de> <87d0ldsu6w.fsf@gmail.com> <87tvep87xg.fsf@gmx.de> <87pnparg0j.fsf@gmail.com> <87lfzy8ela.fsf@gmx.de> <877ebfr29z.fsf@gmail.com> Date: Sun, 28 Apr 2019 09:53:46 +0200 In-Reply-To: <877ebfr29z.fsf@gmail.com> (Noam Postavsky's message of "Sat, 27 Apr 2019 09:44:24 -0400") Message-ID: <87o94qr2et.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:22GSuftl8Fp3o3JE5rB+ncrASUAk22fmH9wJTKtoHhpltG1yzoB CikQSA52P4CK5FYefS9gbp+fi3ZbIGDKQy/5T2dRSipGBBJtUbeInE0VUvIb4ursrmk8LWE shA0F+ISKtDevRQPtnpVNsGQAJ5hLEcdGBMxRGCQ1TH+GhirmQx7ZBLixcE/eGTyYJVEwzt bvrvD+yq5idPf9GBWgEKQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:qLBTGHLDeAM=:2hC6UjswrEB2xSe4kDyzsm QR9zngWm/zV3Pl5YWzUXJVrO5E2V1zUp/iGHlmm8O/vY6ZGGQSA/XZFhq/8S9DZdwEYvBoOvm e+nfIBNT+mo26zzczCuXTSup7PnAbPJTGxEPNifGFlbOBUEeeCeR4rM9OjoMpbUOyuz1XKca2 G8O4J7r2WIPOUed6Q2SoOhZP3b0wEjnkmWZ9cbryvc4CICypMpJlaGrHrBQ87v64tGSWt9TCm Y8QZAR9u+C2yFWyNjYQmoy3rVFf53yJwrQnejc5WuZuiFYzFZiW2lJzEgIAz65m968SFlPg37 ROsF8xWeEgGo4/LSA2LUtOAN3zOCjQYw+k1Zs0a17cDIDZLxN3Y2hFj9THPLn/l+63Ynk+tqf D1HQdVfKM+wwDMtlMj9sw85Y/6i7R6fLfeoIe6y8aNaRZIG7kOw1XBZ0BrUL7Jm0cDhoyuvey 34sv4sEMqWyOEMHQM/QQ7vZQV20oRvQ9tc2DUto3idiKw/ZpHQjxwTaf2OkGoptNZPAQIeIb2 zM5bvBAltzTZ2kjrvTnxJ5I5Ae3JfFU6Xx2QhfFWvbmHnQT8RMqJuqX+eeAZlwxPzGWnwbmC6 pRtsHyBuAO07eht7jDtmHLBSmrNHasaYUroIKzZJ3B0QmfFJjU08e0YDp+E5SbxyV9jaOS47p s44MaC2yFXAavXAUue1VudhGu7UJYhz6KOIfaTbOOmnGVUoiFJSaRyvA6yErmFz+59KZt4pLf mE1/QYlH9jG0/MsaU0o5YfENQBMdGOxUWRVuhm1G+ClRCI1a+e75K5c77sEDuOmTN5FX1rPHC PlikBe2+Fri+xakrwvClbIyrX28vWRRmZLf91nZRUs2YXfkLlTOdKkigtIQXqrMHJ0Xz+pmRM xdv3n5m6y/NL+lFgItcvWPhJj7FnCU6gZ7nteYI5fnzYTmtVPGxzpjkZS+/lXgUGkS3voseZI EfBhmIpOdbA== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 35362 Cc: 35362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Noam Postavsky writes: > Okay, pushed to master. Thanks. I propose we'll wait for some few days, before releasing 0.18. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon May 06 08:17:52 2019 Received: (at 35362) by debbugs.gnu.org; 6 May 2019 12:17:52 +0000 Received: from localhost ([127.0.0.1]:55845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNcZ6-0004cW-6n for submit@debbugs.gnu.org; Mon, 06 May 2019 08:17:52 -0400 Received: from mout.gmx.net ([212.227.15.19]:33387) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNcZ4-0004cJ-QJ for 35362@debbugs.gnu.org; Mon, 06 May 2019 08:17:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1557145063; bh=Fp3DUTl2GGGHE2GMxauDUXKdUs3XiaLlxcc9xxCZ2hc=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=D2deWaZG5YQWShvk2sFg8zTw+RarrMQJJrfbcTkMMQ3AAuq0iAhJ2NWNoghPjeILp FTZhi85xGAIZMzutd4y79EVoB9k12MsU4oyrHug2VCqjweUPP26WO2WzJgk3f97I5w +zQpyCA38Ixf5C1ocdous0Gmy1vMWHdpIvdrF5vg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from detlef.gmx.de ([217.70.140.96]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MIe0O-1hPpUN2cpc-002KHE; Mon, 06 May 2019 14:17:43 +0200 From: Michael Albinus To: Noam Postavsky Subject: Re: bug#35362: 26.2; [debbugs.el] Automate commit -> debbugs flow (posting patches, closing bugs after pushing) References: <874l6rtnjo.fsf@gmail.com> <871s1vtm9h.fsf@gmail.com> <87wojns7ia.fsf@gmail.com> <875zr7cepw.fsf@gmx.de> <87d0ldsu6w.fsf@gmail.com> <87tvep87xg.fsf@gmx.de> <87pnparg0j.fsf@gmail.com> <87lfzy8ela.fsf@gmx.de> <877ebfr29z.fsf@gmail.com> <87o94qr2et.fsf@gmx.de> Date: Mon, 06 May 2019 14:17:42 +0200 In-Reply-To: <87o94qr2et.fsf@gmx.de> (Michael Albinus's message of "Sun, 28 Apr 2019 09:53:46 +0200") Message-ID: <87ftprkc9l.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:xR8hDsfizB4ZiToPMxKsHV13xH/fFTPpi06YX7tn0sxEWrq6l+r wOEjDj0ZBe04PJlSlw/Tsq1F8tDmVj19NrZQLYTETqcI5lA1gLlaxaf/gTnGlZ3F3romTuB YCxXuyC4lxVxyv0gi55M/9mMxFhNjbKzilJUQAh7uyqgQX7G3kTfU/puQes2k5O4u/uAgmk 9E5Tk6UMIQha/3Ub+ZcIg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:UAJXxph0eRg=:HwyWHA3F9GDWrUd+MN9NyH wfOtixNd5tQy5+sbfXz7AAnkjSEh7j61/Pp+QeMc2Y2oKpfZDaGRytztw279agNE5rZ+sqa0f GwPnjrflte7PwZcs9HoNf6DajcJfx/F7hI9Q7cajMmtE8hhQslaUjjzKe5Yw8M2FAd/SMypXO vJjozK0/DOOW/AbrbltLy6JcQ7n+wVHPMhX5KCSFkrR7ue78pGfpufApf7ViMJQvFqv2ZILJW sAcxLG9jbTdIZjatf5D8KVSZ2am8xmYX5hquTEXAkEwcv/6nn8Xv7f490rCP3ANECPW5Xs/bl IJio2CgqPrbognPNZD1fC/VD/rdbmixaa7uJ7A5iD8hBNJKxilL0BNcAx0crqibSsmsYjipVu q11H7yFhOFuqznNTNkvw8fudRFc5e7CeG8QrTrxhAiM7n21UWlFQsXRy8R60HFMUW1aaVTpFC GbpU70g7YI/ou56DZklOY6sKnj7slWAekr9aG38Xrjp2ZoUv5KVYaUwkYCrOknxwShu4//aYr gVt2pFEDaBYAaWVzlt9HFI9ULuzkObMfXEElsKRpYjI254iXFVRn1HaC9YxsN35YynorvYSwE KXnFdJtc1qfEu46MsZNqJEMNmbIB9RZusaTR60a92e8FKxijYaohDAI9pH/RkXL+b0BDImxfd ADfiR+ZMP4cEIFjWa0j8R0He3J/SPSChgViv61Cngp7VEJ4LK36rSI5ajFVvrf+Viac/F+qQZ 9lKS8NopLARxa6gqlddoJGVAiEcbTB9WU7ooFbbw95gw5jjKXzaIuRDGceMe/mtmQCpq3593D RCBL5dBtn7cvd35w6SRfROGN7u7LExXrWIM5c0mt5Fe6wJgfnc2EaEgPkRkiBdSTa+rt01aE4 +6EYAkKAVbiOFGU9zsEUt3ljMO0W1OkfkDUYSwFnoaDwC47hka/jqYy3gn3PxcDSTeuagG0T4 86XZxv07LVg== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 35362 Cc: 35362@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Michael Albinus writes: >> Okay, pushed to master. > > Thanks. I propose we'll wait for some few days, before releasing 0.18. Done. Best regards, Michael. From unknown Wed Jun 18 23:03:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 04 Jun 2019 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator