* admin/bzrmerge.el (bzrmerge-skip-regexp): Add "from trunk".
[bpt/emacs.git] / admin / bzrmerge.el
index 77e64a8..0c72c8b 100644 (file)
@@ -1,9 +1,9 @@
 ;;; bzrmerge.el --- help merge one Emacs bzr branch to another
 
-;; Copyright (C) 2010-201 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: 
+;; Keywords: maint
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
   (require 'cl))                        ; assert
 
 (defvar bzrmerge-skip-regexp
-  "back[- ]?port\\|merge\\|sync\\|re-?generate\\|bump version"
+  "back[- ]?port\\|merge\\|sync\\|re-?generate\\|bump version\\|from trunk"
   "Regexp matching logs of revisions that might be skipped.
 `bzrmerge-missing' will ask you if it should skip any matches.")
 
@@ -133,9 +133,23 @@ are both lists of revnos, in oldest-first order."
                     (setq str (substring str (match-end 0))))
                   (when (string-match "[.!;, ]+\\'" str)
                     (setq str (substring str 0 (match-beginning 0))))
-                  (if (save-excursion (y-or-n-p (concat str ": Skip? ")))
-                      (setq skip t))))
-              (if skip
+                  (let ((help-form "\
+Type `y' to skip this revision,
+`N' to include it and go on to the next revision,
+`n' to not skip, but continue to search this log entry for skip regexps,
+`q' to quit merging."))
+                    (case (save-excursion
+                            (read-char-choice
+                             (format "%s: Skip (y/n/N/q/%s)? " str
+                                     (key-description (vector help-char)))
+                             '(?y ?n ?N ?q)))
+                      (?y (setq skip t))
+                      (?q (keyboard-quit))
+                      ;; A single log entry can match skip-regexp multiple
+                      ;; times.  If you are sure you don't want to skip it,
+                      ;; you don't want to be asked multiple times.
+                      (?N (setq skip 'no))))))
+              (if (eq skip t)
                   (push revno skipped)
                 (push revno revnos)))))
         (delete-region (point) (point-max)))
@@ -146,7 +160,8 @@ are both lists of revnos, in oldest-first order."
   (unless (file-exists-p file) (error "Bzrmerge-resolve: Can't find %s" file))
   (with-demoted-errors
     (let ((exists (find-buffer-visiting file)))
-      (with-current-buffer (find-file-noselect file)
+      (with-current-buffer (let ((enable-local-variables :safe))
+                             (find-file-noselect file))
         (if (buffer-modified-p)
             (error "Unsaved changes in %s" (current-buffer)))
         (save-excursion
@@ -270,6 +285,9 @@ Does not make other difference."
           (sit-for 1)
           ;; (debug 'after-merge)
           ;; Check the conflicts.
+          ;; FIXME if using the helpful bzr changelog_merge plugin,
+          ;; there are normally no conflicts in ChangeLogs.
+          ;; But we still want the dates fixing, like bzrmerge-resolve does.
           (let ((conflicted nil)
                 (files ()))
             (goto-char (point-min))