diff options
| author | Stefan Monnier | 2013-01-11 22:15:14 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-01-11 22:15:14 -0500 |
| commit | a07846093f1d91ab7d6c0e86a29aee357685292f (patch) | |
| tree | 104d4f4f03e23e9aae01b63403b53ca8153a7b2f | |
| parent | fbc9ce11fa593f2fb87a8a0ea5f1b7a78bd13425 (diff) | |
| download | emacs-a07846093f1d91ab7d6c0e86a29aee357685292f.tar.gz emacs-a07846093f1d91ab7d6c0e86a29aee357685292f.zip | |
* 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.
Fixes: debbugs:13307
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/vc/log-edit.el | 15 | ||||
| -rw-r--r-- | lisp/vc/vc-bzr.el | 19 |
3 files changed, 29 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c600e37570f..b90a5ecd11e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-01-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * vc/vc-bzr.el (vc-bzr--sanitize-header): New function (bug#13307). | ||
| 4 | (vc-bzr-checkin): Use it. | ||
| 5 | * vc/log-edit.el (log-edit-extract-headers): Don't presume FUNCTION | ||
| 6 | will preserve match-data. | ||
| 7 | |||
| 1 | 2013-01-11 Felix H. Dahlke <fhd@ubercode.de> | 8 | 2013-01-11 Felix H. Dahlke <fhd@ubercode.de> |
| 2 | 9 | ||
| 3 | * progmodes/js.el: Fix multiline declarations's indentation (bug#8576). | 10 | * 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 f8e753772e4..dfc7eee81a6 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el | |||
| @@ -953,13 +953,14 @@ line of MSG." | |||
| 953 | (while (re-search-forward (concat "^" (car header) | 953 | (while (re-search-forward (concat "^" (car header) |
| 954 | ":" log-edit-header-contents-regexp) | 954 | ":" log-edit-header-contents-regexp) |
| 955 | nil t) | 955 | nil t) |
| 956 | (if (eq t (cdr header)) | 956 | (let ((txt (match-string 1))) |
| 957 | (setq summary (match-string 1)) | 957 | (replace-match "" t t) |
| 958 | (if (functionp (cdr header)) | 958 | (if (eq t (cdr header)) |
| 959 | (setq res (nconc res (funcall (cdr header) (match-string 1)))) | 959 | (setq summary txt) |
| 960 | (push (match-string 1) res) | 960 | (if (functionp (cdr header)) |
| 961 | (push (or (cdr header) (car header)) res))) | 961 | (setq res (nconc res (funcall (cdr header) txt))) |
| 962 | (replace-match "" t t))) | 962 | (push txt res) |
| 963 | (push (or (cdr header) (car header)) res)))))) | ||
| 963 | ;; Remove header separator if the header is empty. | 964 | ;; Remove header separator if the header is empty. |
| 964 | (widen) | 965 | (widen) |
| 965 | (goto-char (point-min)) | 966 | (goto-char (point-min)) |
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index f436d300089..0968c83ae5f 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el | |||
| @@ -620,15 +620,24 @@ or a superior directory.") | |||
| 620 | 620 | ||
| 621 | (declare-function log-edit-extract-headers "log-edit" (headers string)) | 621 | (declare-function log-edit-extract-headers "log-edit" (headers string)) |
| 622 | 622 | ||
| 623 | (defun vc-bzr--sanitize-header (arg) | ||
| 624 | ;; Newlines in --fixes (and probably other fields as well) trigger a nasty | ||
| 625 | ;; Bazaar bug; see https://bugs.launchpad.net/bzr/+bug/1094180. | ||
| 626 | (lambda (str) (list arg | ||
| 627 | (replace-regexp-in-string "\\`[ \t]+\\|[ \t]+\\'" | ||
| 628 | "" (replace-regexp-in-string | ||
| 629 | "\n[ \t]?" " " str))))) | ||
| 630 | |||
| 623 | (defun vc-bzr-checkin (files rev comment) | 631 | (defun vc-bzr-checkin (files rev comment) |
| 624 | "Check FILES in to bzr with log message COMMENT. | 632 | "Check FILES in to bzr with log message COMMENT. |
| 625 | REV non-nil gets an error." | 633 | REV non-nil gets an error." |
| 626 | (if rev (error "Can't check in a specific revision with bzr")) | 634 | (if rev (error "Can't check in a specific revision with bzr")) |
| 627 | (apply 'vc-bzr-command "commit" nil 0 | 635 | (apply 'vc-bzr-command "commit" nil 0 files |
| 628 | files (cons "-m" (log-edit-extract-headers '(("Author" . "--author") | 636 | (cons "-m" (log-edit-extract-headers |
| 629 | ("Date" . "--commit-time") | 637 | `(("Author" . ,(vc-bzr--sanitize-header "--author")) |
| 630 | ("Fixes" . "--fixes")) | 638 | ("Date" . ,(vc-bzr--sanitize-header "--commit-time")) |
| 631 | comment)))) | 639 | ("Fixes" . ,(vc-bzr--sanitize-header "--fixes"))) |
| 640 | comment)))) | ||
| 632 | 641 | ||
| 633 | (defun vc-bzr-find-revision (file rev buffer) | 642 | (defun vc-bzr-find-revision (file rev buffer) |
| 634 | "Fetch revision REV of file FILE and put it into BUFFER." | 643 | "Fetch revision REV of file FILE and put it into BUFFER." |