diff options
| author | Stefan Monnier | 2002-10-07 16:24:42 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-10-07 16:24:42 +0000 |
| commit | edc37d121445a203270a64da3ab2203bf2f0cb91 (patch) | |
| tree | 85830ea885d1823c41adcf78b8493355cf877d55 | |
| parent | 8748595969efc939ff0645323717d0e0279c54d4 (diff) | |
| download | emacs-edc37d121445a203270a64da3ab2203bf2f0cb91.tar.gz emacs-edc37d121445a203270a64da3ab2203bf2f0cb91.zip | |
(vc-maybe-resolve-conflicts): Always call vc-resolve-conflicts
in case some other package redefined it.
(vc-resolve-conflicts): Make it into an alias for smerge-ediff.
| -rw-r--r-- | lisp/vc.el | 93 |
1 files changed, 3 insertions, 90 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index 5b288d7c7f1..740aabae4dd 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
| 7 | ;; Keywords: tools | 7 | ;; Keywords: tools |
| 8 | 8 | ||
| 9 | ;; $Id: vc.el,v 1.338 2002/10/05 03:00:47 rost Exp $ | 9 | ;; $Id: vc.el,v 1.339 2002/10/05 16:35:28 monnier Exp $ |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| 12 | 12 | ||
| @@ -2036,98 +2036,11 @@ See Info node `Merging'." | |||
| 2036 | (if (zerop status) (message "Merge successful") | 2036 | (if (zerop status) (message "Merge successful") |
| 2037 | (smerge-mode 1) | 2037 | (smerge-mode 1) |
| 2038 | (if (y-or-n-p "Conflicts detected. Resolve them now? ") | 2038 | (if (y-or-n-p "Conflicts detected. Resolve them now? ") |
| 2039 | (smerge-ediff name-A name-B) | 2039 | (vc-resolve-conflicts name-A name-B) |
| 2040 | (message "File contains conflict markers")))) | 2040 | (message "File contains conflict markers")))) |
| 2041 | 2041 | ||
| 2042 | (defvar vc-ediff-windows) | ||
| 2043 | (defvar vc-ediff-result) | ||
| 2044 | (eval-when-compile | ||
| 2045 | (defvar ediff-buffer-A) | ||
| 2046 | (defvar ediff-buffer-B) | ||
| 2047 | (defvar ediff-buffer-C) | ||
| 2048 | (require 'ediff-util)) | ||
| 2049 | ;;;###autoload | 2042 | ;;;###autoload |
| 2050 | (defun vc-resolve-conflicts (&optional name-A name-B) | 2043 | (defalias 'vc-resolve-conflicts smerge-ediff) |
| 2051 | "Invoke ediff to resolve conflicts in the current buffer. | ||
| 2052 | The conflicts must be marked with rcsmerge conflict markers." | ||
| 2053 | (interactive) | ||
| 2054 | (vc-ensure-vc-buffer) | ||
| 2055 | (let* ((found nil) | ||
| 2056 | (file-name (file-name-nondirectory buffer-file-name)) | ||
| 2057 | (your-buffer (generate-new-buffer | ||
| 2058 | (concat "*" file-name | ||
| 2059 | " " (or name-A "WORKFILE") "*"))) | ||
| 2060 | (other-buffer (generate-new-buffer | ||
| 2061 | (concat "*" file-name | ||
| 2062 | " " (or name-B "CHECKED-IN") "*"))) | ||
| 2063 | (result-buffer (current-buffer))) | ||
| 2064 | (save-excursion | ||
| 2065 | (set-buffer your-buffer) | ||
| 2066 | (erase-buffer) | ||
| 2067 | (insert-buffer result-buffer) | ||
| 2068 | (goto-char (point-min)) | ||
| 2069 | (while (re-search-forward (concat "^<<<<<<< " | ||
| 2070 | (regexp-quote file-name) "\n") nil t) | ||
| 2071 | (setq found t) | ||
| 2072 | (replace-match "") | ||
| 2073 | (if (not (re-search-forward "^=======\n" nil t)) | ||
| 2074 | (error "Malformed conflict marker")) | ||
| 2075 | (replace-match "") | ||
| 2076 | (let ((start (point))) | ||
| 2077 | (if (not (re-search-forward "^>>>>>>> [0-9.]+\n" nil t)) | ||
| 2078 | (error "Malformed conflict marker")) | ||
| 2079 | (delete-region start (point)))) | ||
| 2080 | (if (not found) | ||
| 2081 | (progn | ||
| 2082 | (kill-buffer your-buffer) | ||
| 2083 | (kill-buffer other-buffer) | ||
| 2084 | (error "No conflict markers found"))) | ||
| 2085 | (set-buffer other-buffer) | ||
| 2086 | (erase-buffer) | ||
| 2087 | (insert-buffer result-buffer) | ||
| 2088 | (goto-char (point-min)) | ||
| 2089 | (while (re-search-forward (concat "^<<<<<<< " | ||
| 2090 | (regexp-quote file-name) "\n") nil t) | ||
| 2091 | (let ((start (match-beginning 0))) | ||
| 2092 | (if (not (re-search-forward "^=======\n" nil t)) | ||
| 2093 | (error "Malformed conflict marker")) | ||
| 2094 | (delete-region start (point)) | ||
| 2095 | (if (not (re-search-forward "^>>>>>>> [0-9.]+\n" nil t)) | ||
| 2096 | (error "Malformed conflict marker")) | ||
| 2097 | (replace-match ""))) | ||
| 2098 | (let ((config (current-window-configuration)) | ||
| 2099 | (ediff-default-variant 'default-B)) | ||
| 2100 | |||
| 2101 | ;; Fire up ediff. | ||
| 2102 | |||
| 2103 | (set-buffer (ediff-merge-buffers your-buffer other-buffer)) | ||
| 2104 | |||
| 2105 | ;; Ediff is now set up, and we are in the control buffer. | ||
| 2106 | ;; Do a few further adjustments and take precautions for exit. | ||
| 2107 | |||
| 2108 | (make-local-variable 'vc-ediff-windows) | ||
| 2109 | (setq vc-ediff-windows config) | ||
| 2110 | (make-local-variable 'vc-ediff-result) | ||
| 2111 | (setq vc-ediff-result result-buffer) | ||
| 2112 | (make-local-variable 'ediff-quit-hook) | ||
| 2113 | (setq ediff-quit-hook | ||
| 2114 | (lambda () | ||
| 2115 | (let ((buffer-A ediff-buffer-A) | ||
| 2116 | (buffer-B ediff-buffer-B) | ||
| 2117 | (buffer-C ediff-buffer-C) | ||
| 2118 | (result vc-ediff-result) | ||
| 2119 | (windows vc-ediff-windows)) | ||
| 2120 | (ediff-cleanup-mess) | ||
| 2121 | (set-buffer result) | ||
| 2122 | (erase-buffer) | ||
| 2123 | (insert-buffer buffer-C) | ||
| 2124 | (kill-buffer buffer-A) | ||
| 2125 | (kill-buffer buffer-B) | ||
| 2126 | (kill-buffer buffer-C) | ||
| 2127 | (set-window-configuration windows) | ||
| 2128 | (message "Conflict resolution finished; you may save the buffer")))) | ||
| 2129 | (message "Please resolve conflicts now; exit ediff when done") | ||
| 2130 | nil)))) | ||
| 2131 | 2044 | ||
| 2132 | ;; The VC directory major mode. Coopt Dired for this. | 2045 | ;; The VC directory major mode. Coopt Dired for this. |
| 2133 | ;; All VC commands get mapped into logical equivalents. | 2046 | ;; All VC commands get mapped into logical equivalents. |