emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 31deb8a: * lisp/vc/log-edit.el: Handle "(tiny chang


From: Glenn Morris
Subject: [Emacs-diffs] master 31deb8a: * lisp/vc/log-edit.el: Handle "(tiny change)". (Bug#20324)
Date: Fri, 08 May 2015 06:03:29 +0000

branch: master
commit 31deb8ad1146705079b98466c56f1c05b4af2638
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    * lisp/vc/log-edit.el: Handle "(tiny change)".  (Bug#20324)
    (log-edit-rewrite-tiny-change): New variable.
    (log-edit-insert-changelog): Maybe add "Copyright-paperwork-exempt".
    (log-edit-changelog-ours-p): Set log-edit-author to a cons.
    * etc/NEWS: Mention this.
---
 etc/NEWS            |    5 +++++
 lisp/vc/log-edit.el |   32 ++++++++++++++++++++++++--------
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index b346af5..844181c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -563,6 +563,11 @@ allows to customize this.
 *** Two new faces `compare-windows-removed' and `compare-windows-added'
 replace the obsolete face `compare-windows'.
 
+---
+*** `log-edit-insert-changelog' converts "(tiny change)" to
+"Copyright-paperwork-exempt: yes".  Set `log-edit-rewrite-tiny-change'
+nil to disable this.
+
 ** VHDL mode supports VHDL'08.
 
 ** Calculator: decimal display mode uses "," groups, so it's more
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index f82c7e9..08ae998 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -717,6 +717,9 @@ can thus take some time."
 
 (defvar log-edit-changelog-use-first nil)
 
+(defvar log-edit-rewrite-tiny-change t
+  "Non-nil means rewrite (tiny change).")
+
 (defvar log-edit-rewrite-fixes nil
   "Rule to rewrite bug numbers into Fixes: headers.
 The value should be of the form (REGEXP . REPLACEMENT)
@@ -761,7 +764,7 @@ regardless of user name or time."
             (log-edit-insert-changelog-entries (log-edit-files)))))
       (log-edit-set-common-indentation)
       ;; Add an Author: field if appropriate.
-      (when author (log-edit-add-field "Author" author))
+      (when author (log-edit-add-field "Author" (car author)))
       ;; Add a Fixes: field if applicable.
       (when (consp log-edit-rewrite-fixes)
        (rfc822-goto-eoh)
@@ -782,7 +785,13 @@ regardless of user name or time."
               (goto-char start)
               (skip-chars-forward "^():")
               (skip-chars-forward ": ")
-              (delete-region start (point))))))))
+              (delete-region start (point)))))
+      ;; FIXME also add "Co-authored-by" when appropriate.
+      ;; Bzr accepts multiple --author arguments, others (?) don't.
+      (and log-edit-rewrite-tiny-change
+           (eq 'tiny (cdr author))
+           (goto-char (point-max))
+           (insert "\nCopyright-paperwork-exempt: yes\n")))))
 
 ;;;;
 ;;;; functions for getting commit message from ChangeLog a file...
@@ -868,19 +877,26 @@ Return non-nil if it is."
     (if (null log-edit-changelog-use-first)
         (looking-at (regexp-quote (format "%s  %s  <%s>" time name mail)))
       ;; Check the author, to potentially add it as a "Author: " header.
+      ;; FIXME This accumulates multiple authors, but only when there
+      ;; are multiple ChangeLog files.  It should also check for
+      ;; multiple authors in each individual entry.
       (when (looking-at "[^ \t]")
         (when (and (boundp 'log-edit-author)
                    (not (looking-at (format ".+  .+  <%s>"
                                             (regexp-quote mail))))
-                   (looking-at ".+  \\(.+  <.+>\\)"))
+                   (looking-at ".+  \\(.+  <.+>\\) *\\((tiny change)\\)?"))
           (let ((author (replace-regexp-in-string "  " " "
                                                   (match-string 1))))
             (unless (and log-edit-author
-                         (string-match (regexp-quote author) log-edit-author))
-              (setq log-edit-author
-                    (if log-edit-author
-                        (concat log-edit-author ", " author)
-                      author)))))
+                         (string-match (regexp-quote author)
+                                       (car log-edit-author)))
+              (if (not log-edit-author)
+                  (setq log-edit-author
+                        (cons author (if (match-string 2) 'tiny)))
+                (setcar log-edit-author
+                        (concat (car log-edit-author) ", " author))
+                (and (match-string 2) (not (cdr log-edit-author))
+                     (setcdr log-edit-author 'tiny))))))
         t))))
 
 (defun log-edit-changelog-entries (file)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]