X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/257210319f10abebbfd7c12784cf3a8e112c3562..ce92397425d29ec27fc701c36c589a5e1f894898:/admin/bzrmerge.el diff --git a/admin/bzrmerge.el b/admin/bzrmerge.el index 977e95860e..1de7bc445e 100644 --- a/admin/bzrmerge.el +++ b/admin/bzrmerge.el @@ -1,6 +1,6 @@ ;;; bzrmerge.el --- help merge one Emacs bzr branch to another -;; Copyright (C) 2010-2012 Free Software Foundation, Inc. +;; Copyright (C) 2010-2016 Free Software Foundation, Inc. ;; Author: Stefan Monnier ;; Keywords: maint @@ -45,17 +45,24 @@ The list returned is sorted by oldest-first." (erase-buffer) ;; We generally want to make sure we start with a clean tree, but we also ;; want to allow restarts (i.e. with some part of FROM already merged but - ;; not yet committed). + ;; not yet committed). Unversioned (unknown) files in the tree + ;; are also ok. (call-process "bzr" nil t nil "status" "-v") (goto-char (point-min)) (when (re-search-forward "^conflicts:\n" nil t) - (error "You still have unresolved conflicts")) - (let ((merges ())) + (user-error "You still have unresolved conflicts")) + (let ((merges ()) + found) (if (not (re-search-forward "^pending merges:\n" nil t)) (when (save-excursion (goto-char (point-min)) - (re-search-forward "^[a-z ]*:\n" nil t)) - (error "You still have uncommitted changes")) + (while (and + (re-search-forward "^\\([a-z ]*\\):\n" nil t) + (not + (setq found + (not (equal "unknown" (match-string 1))))))) + found) + (user-error "You still have uncommitted changes")) ;; This is really stupid, but it seems there's no easy way to figure ;; out which revisions have been merged already. The only info I can ;; find is the "pending merges" from "bzr status -v", which is not @@ -133,11 +140,11 @@ 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)))) - (let ((help-form "\ + (let ((help-form (substitute-command-keys "\ 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.")) +`q' to quit merging."))) (pcase (save-excursion (read-char-choice (format "%s: Skip (y/n/N/q/%s)? " str @@ -160,10 +167,11 @@ Type `y' to skip this revision, (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 (let ((enable-local-variables :safe)) + (with-current-buffer (let ((enable-local-variables :safe) + (enable-local-eval nil)) (find-file-noselect file)) (if (buffer-modified-p) - (error "Unsaved changes in %s" (current-buffer))) + (user-error "Unsaved changes in %s" (current-buffer))) (save-excursion (cond ((derived-mode-p 'change-log-mode) @@ -312,10 +320,10 @@ Does not make other difference." ;; bzrmerge-add-metadata does not work when there ;; are conflicts. (display-warning 'bzrmerge "Resolve conflicts manually. -¡BEWARE! Important metadata is kept in this Emacs session! +BEWARE! Important metadata is kept in this Emacs session! Do not commit without re-running `M-x bzrmerge' first!" :warning bzrmerge-warning-buffer)) - (error "Resolve conflicts manually"))))) + (user-error "Resolve conflicts manually"))))) (cons merge skip))))) (defun bzrmerge (from)