aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/vc/log-edit.el15
-rw-r--r--lisp/vc/vc-bzr.el19
3 files changed, 29 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c600e37570..b90a5ecd11 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-12 Stefan Monnier <[email protected]>
+
+ * 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 <[email protected]>
* progmodes/js.el: Fix multiline declarations's indentation (bug#8576).
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index f8e753772e..dfc7eee81a 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -953,13 +953,14 @@ line of MSG."
(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))
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index f436d30008..0968c83ae5 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -620,15 +620,24 @@ or a superior directory.")
(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."