From: Eshel Yaron Date: Fri, 22 Dec 2023 18:14:40 +0000 (+0100) Subject: ; * admin/cherry.el (cherry-pick-new-commits): Improve. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b598ce9cefa56f13b9d7f3c5ccab78f20bd045a6;p=emacs.git ; * admin/cherry.el (cherry-pick-new-commits): Improve. --- diff --git a/admin/cherry.el b/admin/cherry.el index ffcdcd70ada..2911defeb84 100644 --- a/admin/cherry.el +++ b/admin/cherry.el @@ -64,8 +64,10 @@ (defun cherry-pick-new-commits () "Pick or skip new commits in the upstream branch." (interactive) + (message "Fetching from upstream...") (call-process "git" nil nil nil "-C" source-directory "fetch" cherry-upstream-remote) + (message "Checking for new commits...") (let* ((merge-base (cherry-merge-base)) (new-commits (seq-remove @@ -73,40 +75,41 @@ (or (cherry-picked-p commit merge-base) (cherry-skipped-p commit))) (cherry-upstream-commits)))) - (if new-commits - (dolist (commit new-commits) - (with-current-buffer (get-buffer-create "*cherry*") - (delete-region (point-min) (point-max)) - (fundamental-mode)) - (call-process "git" nil "*cherry*" t "-C" source-directory - "format-patch" "-1" commit "--stdout") - (pop-to-buffer "*cherry*") - (diff-mode) - (goto-char (point-min)) - (let ((choice (read-multiple-choice - "Pick?" - '((?p "pick") - (?s "skip") - (?q "quit") - ;; (?a "amend") - )))) - (pcase (car choice) - (?s - (message "Skipping...") - (shell-command (concat "echo " commit - (read-string "Reason: " "") - ">>" cherry-skip-list-file)) - (message "Skipped.")) - (?p - (message "Picking...") - (if (= 0 (call-process "git" nil nil nil - "-C" source-directory - "cherry-pick" "-x" commit)) - (message "Picked.") - (user-error "Cherry picking failed"))) - (?q (bury-buffer "*cherry*") - (user-error "Quit cherry picking"))))) - (message "No new commits.")))) + (if (null new-commits) + (message "No new commits.") + (dolist (commit new-commits) + (with-current-buffer (get-buffer-create "*cherry*") + (delete-region (point-min) (point-max)) + (fundamental-mode)) + (call-process "git" nil "*cherry*" t "-C" source-directory + "format-patch" "-1" commit "--stdout") + (pop-to-buffer "*cherry*") + (diff-mode) + (goto-char (point-min)) + (let ((choice (read-multiple-choice + "Pick?" + '((?p "pick") + (?s "skip") + (?q "quit") + ;; (?a "amend") + )))) + (pcase (car choice) + (?s + (message "Skipping...") + (shell-command (concat "echo " commit + (read-string "Reason: " "") + ">>" cherry-skip-list-file)) + (message "Skipped.")) + (?p + (message "Picking...") + (if (= 0 (call-process "git" nil nil nil + "-C" source-directory + "cherry-pick" "-x" commit)) + (message "Picked.") + (user-error "Cherry picking failed"))) + (?q (bury-buffer "*cherry*") + (user-error "Quit cherry picking"))))) + (message "Done.")))) (provide 'cherry) ;;; cherry.el ends here