diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-03-06 22:08:21 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-03-06 22:08:21 +0000 |
commit | b0a08954d512d8e70fdf3b49b7db281a98221c0a (patch) | |
tree | 8b7261ae47e7980b27c2a79396a9814462abce78 /lisp/vc-bzr.el | |
parent | d530654e688b202fc326a9d0a8d9264731a25cae (diff) | |
download | emacs-b0a08954d512d8e70fdf3b49b7db281a98221c0a.tar.gz emacs-b0a08954d512d8e70fdf3b49b7db281a98221c0a.tar.bz2 emacs-b0a08954d512d8e70fdf3b49b7db281a98221c0a.zip |
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Diffstat (limited to 'lisp/vc-bzr.el')
-rw-r--r-- | lisp/vc-bzr.el | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index e0ce72dd31f..e126296d779 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el @@ -232,6 +232,33 @@ If any error occurred in running `bzr status', then return nil." (unknown . nil) (unchanged . up-to-date))))))) +(defun vc-bzr-resolve-when-done () + "Call \"bzr resolve\" if the conflict markers have been removed." + (save-excursion + (goto-char (point-min)) + (unless (re-search-forward "^<<<<<<< " nil t) + (vc-bzr-command "resolve" nil 0 buffer-file-name) + ;; Remove the hook so that it is not called multiple times. + (remove-hook 'after-save-hook 'vc-bzr-resolve-when-done t)))) + +(defun vc-bzr-find-file-hook () + (when (and buffer-file-name + ;; FIXME: We should check that "bzr status" says "conflict". + (file-exists-p (concat buffer-file-name ".BASE")) + (file-exists-p (concat buffer-file-name ".OTHER")) + (file-exists-p (concat buffer-file-name ".THIS")) + ;; If "bzr status" says there's a conflict but there are no + ;; conflict markers, it's not clear what we should do. + (save-excursion + (goto-char (point-min)) + (re-search-forward "^<<<<<<< " nil t))) + ;; TODO: the merge algorithm used in `bzr merge' is nicely configurable, + ;; but the one in `bzr pull' isn't, so it would be good to provide an + ;; elisp function to remerge from the .BASE/OTHER/THIS files. + (smerge-start-session) + (add-hook 'after-save-hook 'vc-bzr-resolve-when-done nil t) + (message "There are unresolved conflicts in this file"))) + (defun vc-bzr-workfile-unchanged-p (file) (eq 'unchanged (car (vc-bzr-status file)))) |