From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: Re: Please don't use revision numbers on commit messages (and elsewhere). Date: Fri, 01 Apr 2011 10:38:26 +0200 Message-ID: <874o6iicxp.fsf@ambire.localdomain> References: <877hbfvwyo.fsf@wanadoo.es> <87sju2hoee.fsf@ambire.localdomain> <87pqp6vn3p.fsf@wanadoo.es> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1301647159 20625 80.91.229.12 (1 Apr 2011 08:39:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 1 Apr 2011 08:39:19 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?utf-8?Q?=C3=93scar?= Fuentes Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 01 10:39:15 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5Zsw-0004nV-5H for ged-emacs-devel@m.gmane.org; Fri, 01 Apr 2011 10:39:14 +0200 Original-Received: from localhost ([127.0.0.1]:37038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5Zsu-0002Fg-SY for ged-emacs-devel@m.gmane.org; Fri, 01 Apr 2011 04:39:12 -0400 Original-Received: from [140.186.70.92] (port=33621 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5ZsY-00024C-Tg for emacs-devel@gnu.org; Fri, 01 Apr 2011 04:38:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q5ZsW-0004Tg-Om for emacs-devel@gnu.org; Fri, 01 Apr 2011 04:38:49 -0400 Original-Received: from smtp204.alice.it ([82.57.200.100]:46234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q5ZsW-0004Sq-Fz for emacs-devel@gnu.org; Fri, 01 Apr 2011 04:38:48 -0400 Original-Received: from ambire.localdomain (95.244.66.223) by smtp204.alice.it (8.5.124.08) id 4D7E0F64018D5CE0; Fri, 1 Apr 2011 10:38:46 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.69) (envelope-from ) id 1Q5ZsB-00011j-8e; Fri, 01 Apr 2011 10:38:27 +0200 In-Reply-To: <87pqp6vn3p.fsf@wanadoo.es> (=?utf-8?Q?=22=C3=93scar?= Fuentes"'s message of "Fri, 01 Apr 2011 02:20:26 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.100 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:137976 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable () =C3=93scar Fuentes () Fri, 01 Apr 2011 02:20:26 +0200 It is actually informative, although it makes difficult to pinpoint the mentioned revision or to answer the question "is the mentioned revision = on branch X?" which is automatic when you have a revision id. To dereference a DATE-TITLE pair to a VCS commit the VCS needs to be able to grep for DATE or TITLE or both in its (internal) commit log representation. It's an extra step, true, and might be difficult if the VCS is lame. Likew= ise for localizing the commit to a branch. A different issue is to convince people to write proper commit messages, with the first line acting as the commit title. But that is another battle. All it takes is for the Emacs maintainers to promote the practice from IWBN= to required. I think concurrent to such a move should be to publish tools to = make the ChangeLog(s) -> VCS commit message flow less balky. FWIW, i attach some sketches (that i find useful) here. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=changelog-to-vcs-commit-message-flow.el Content-Transfer-Encoding: quoted-printable ;;; ;;; Step 1 -- Write the entries in each ChangeLog. ;;; (defun add-titled-change-log-entry (title) "Add a ChangeLog entry to the current buffer, with title." (interactive "sTitle: ") (add-change-log-entry nil buffer-file-name) (save-excursion (goto-char (point-min)) (forward-line 1) (insert "\n\t" title "\n")) ;; Mnemonic for =E2=80=98h=E2=80=99 is "head". (copy-to-register ?h (point-min) (point))) (eval-after-load "add-log" '(define-key change-log-mode-map "\C-c\C-a" 'add-titled-change-log-entry)) ;;; ;;; Step 2 -- Merge them into the VCS commit log buffer. ;;; (require 'log-edit) (defun compute-commit-log-text (relative-file-names) (let ((changelogs (or (remove-if-not (lambda (s) (string-match "ChangeLog$" s)) relative-file-names) (error "No ChangeLog files"))) head body) (dolist (fn changelogs) (with-temp-buffer (insert-file-contents fn) (search-forward "\n\n" nil nil 2) (push (buffer-substring (point-min) (point)) head) (unless (or (null (cdr head)) (string=3D (car head) (cadr head))) (error "head mismatch for %s" fn)) (push (buffer-substring (point) (progn (re-search-forward change-log-start-entry-re) (match-beginning 0))) body))) (setq head (car head) head (and (string-match "\n\n\t" head) (substring head (match-end 0))) body (map 'list (lambda (fn bod) (let ((pre (and (string-match "ChangeLog$" fn) (substring fn 0 (match-beginning 0)))= )) (with-temp-buffer (insert bod) (goto-char (point-min)) (while (search-forward "\t* " nil 1) (insert pre)) (while (re-search-backward "^\t" nil t) (delete-char 1)) (buffer-string)))) (nreverse changelogs) body)) (cons head body))) ;; Not actually Git-specific, although untested with any other VCS. ;; The "scan" is for an emacsclient-based workflow from 2008, now defunct. (defun git-scan-log-buffer-and-insert-commit-log () (interactive) (apply 'insert (compute-commit-log-text log-edit-initial-files))) (define-key log-edit-mode-map "\C-c\C-d" 'git-scan-log-buffer-and-insert-commit-log) ;;; ;;; Step 3 -- Resynchronize Emacs. ;;; ;;;###autoload (defun revert-some-buffers (&optional skip-read-only) "Revert each file-related buffer. Preifx arg means don't bother with read-only buffers." (interactive "P") (save-some-buffers) (let ((ready (remove-if-not (lambda (buf) (with-current-buffer buf (and buffer-file-name (or (not skip-read-only) (not buffer-read-only))))) (buffer-list)))) (save-excursion (dolist (buf ready) (set-buffer buf) (revert-buffer t t))) (message "Buffers reverted: %d %s" (length ready) ready))) (global-set-key [(control c) (control meta r)] 'revert-some-buffers) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Example flow: (0) Munge source in file src/foo.c, related docs in file doc/foo.texi. (1) C-x C-f src/ChangeLog RET C-c C-a TITLE RET foo.c (func): Change. RET RET C-x C-s C-x C-k RET (2) C-x C-f doc/ChangeLog RET C-c C-a M-p RET foo.texi (functionality): Change. RET RET C-x C-s C-x C-k RET (3) initiate commit sequence, specifying files: src/ChangeLog src/foo.c doc/ChangeLog doc/foo.texi =3D> end up in buffer in Log Edit mode (4) C-c C-d ; git-scan-log-buffer-and-insert-commit-log tweak aesthetics (paragraph order, primarily) C-c C-c ; log-edit-done C-c C-M-r ; revert-some-buffers This example assumes the details of each change fits in my head, which often is not the case. More typically, there is a series of =E2=80=98vc-diff=E2= =80=99 invocations prior to (1) and (2). I sometimes (very rarely) interleave (0) and (1)/(2). Anyway, the point is that (3) and (4) take little thought/effort to perform. --=-=-=--