emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111494: * lisp/vc/vc-bzr.el (vc-bzr-


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111494: * lisp/vc/vc-bzr.el (vc-bzr--sanitize-header): New function.
Date: Fri, 11 Jan 2013 22:15:14 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111494
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13307
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2013-01-11 22:15:14 -0500
message:
  * lisp/vc/vc-bzr.el (vc-bzr--sanitize-header): New function.
  (vc-bzr-checkin): Use it.
  * lisp/vc/log-edit.el (log-edit-extract-headers): Don't presume FUNCTION
  will preserve match-data.
modified:
  lisp/ChangeLog
  lisp/vc/log-edit.el
  lisp/vc/vc-bzr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-11 23:24:52 +0000
+++ b/lisp/ChangeLog    2013-01-12 03:15:14 +0000
@@ -1,3 +1,10 @@
+2013-01-12  Stefan Monnier  <address@hidden>
+
+       * vc/vc-bzr.el (vc-bzr--sanitize-header): New function (bug#13307).
+       (vc-bzr-checkin): Use it.
+       * vc/log-edit.el (log-edit-extract-headers): Don't presume FUNCTION
+       will preserve match-data.
+
 2013-01-11  Felix H. Dahlke  <address@hidden>
 
        * progmodes/js.el: Fix multiline declarations's indentation (bug#8576).

=== modified file 'lisp/vc/log-edit.el'
--- a/lisp/vc/log-edit.el       2013-01-01 09:11:05 +0000
+++ b/lisp/vc/log-edit.el       2013-01-12 03:15:14 +0000
@@ -953,13 +953,14 @@
         (while (re-search-forward (concat "^" (car header)
                                           ":" log-edit-header-contents-regexp)
                                   nil t)
-          (if (eq t (cdr header))
-              (setq summary (match-string 1))
-            (if (functionp (cdr header))
-                (setq res (nconc res (funcall (cdr header) (match-string 1))))
-              (push (match-string 1) res)
-              (push (or (cdr header) (car header)) res)))
-          (replace-match "" t t)))
+          (let ((txt (match-string 1)))
+            (replace-match "" t t)
+            (if (eq t (cdr header))
+                (setq summary txt)
+              (if (functionp (cdr header))
+                  (setq res (nconc res (funcall (cdr header) txt)))
+                (push txt res)
+                (push (or (cdr header) (car header)) res))))))
       ;; Remove header separator if the header is empty.
       (widen)
       (goto-char (point-min))

=== modified file 'lisp/vc/vc-bzr.el'
--- a/lisp/vc/vc-bzr.el 2013-01-01 09:11:05 +0000
+++ b/lisp/vc/vc-bzr.el 2013-01-12 03:15:14 +0000
@@ -620,15 +620,24 @@
 
 (declare-function log-edit-extract-headers "log-edit" (headers string))
 
+(defun vc-bzr--sanitize-header (arg)
+  ;; Newlines in --fixes (and probably other fields as well) trigger a nasty
+  ;; Bazaar bug; see https://bugs.launchpad.net/bzr/+bug/1094180.
+  (lambda (str) (list arg
+                 (replace-regexp-in-string "\\`[ \t]+\\|[ \t]+\\'"
+                                           "" (replace-regexp-in-string
+                                               "\n[ \t]?" " " str)))))
+
 (defun vc-bzr-checkin (files rev comment)
   "Check FILES in to bzr with log message COMMENT.
 REV non-nil gets an error."
   (if rev (error "Can't check in a specific revision with bzr"))
-  (apply 'vc-bzr-command "commit" nil 0
-         files (cons "-m" (log-edit-extract-headers '(("Author" . "--author")
-                                                     ("Date" . "--commit-time")
-                                                      ("Fixes" . "--fixes"))
-                                                    comment))))
+  (apply 'vc-bzr-command "commit" nil 0 files
+         (cons "-m" (log-edit-extract-headers
+                     `(("Author" . ,(vc-bzr--sanitize-header "--author"))
+                       ("Date" . ,(vc-bzr--sanitize-header "--commit-time"))
+                       ("Fixes" . ,(vc-bzr--sanitize-header "--fixes")))
+                     comment))))
 
 (defun vc-bzr-find-revision (file rev buffer)
   "Fetch revision REV of file FILE and put it into BUFFER."


reply via email to

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