[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117698: Add smerge support to the git back end.
From: |
Eric S. Raymond |
Subject: |
[Emacs-diffs] trunk r117698: Add smerge support to the git back end. |
Date: |
Wed, 13 Aug 2014 08:42:56 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117698
revision-id: address@hidden
parent: address@hidden
committer: Eric S. Raymond <address@hidden>
branch nick: trunk
timestamp: Wed 2014-08-13 04:42:33 -0400
message:
Add smerge support to the git back end.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/vc/vc-git.el vcgit.el-20091113204419-o5vbwnq5f7feedwu-5070
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-08-13 08:05:45 +0000
+++ b/lisp/ChangeLog 2014-08-13 08:42:33 +0000
@@ -1,8 +1,13 @@
2014-08-13 Eric S. Raymond <address@hidden>
- * vc/vc-git.el (vc-git-conflicted-files): Integrate Rüdiger
- Sonderfeld's code for detecting conflicted files using a status
- listing. Useful in itself and a step towards better smerge
+ * vc/vc.git.el: (vc-git-find-file-hook): New function. Adds
+ support for calling smerge on a conflicted file, and calling git
+ add when there are no longer conflict markers in a saved file.
+ This is a completed version of Rüdiger Sonderfeld's proposal.
+
+ * vc/vc-git.el (vc-git-conflicted-files): New function. Integrate
+ Rüdiger Sonderfeld's code for detecting conflicted files using a
+ status listing. Useful in itself and a step towards better smerge
support.
2014-08-12 Stefan Monnier <address@hidden>
=== modified file 'lisp/vc/vc-git.el'
--- a/lisp/vc/vc-git.el 2014-08-13 08:05:45 +0000
+++ b/lisp/vc/vc-git.el 2014-08-13 08:42:33 +0000
@@ -101,7 +101,7 @@
;; - clear-headers () NOT NEEDED
;; - delete-file (file) OK
;; - rename-file (old new) OK
-;; - find-file-hook () NOT NEEDED
+;; - find-file-hook () OK
;; - conflicted-files OK
;;; Code:
@@ -786,6 +786,26 @@
"DU" "AA" "UU"))
(push file files)))))))
+(defun vc-git-resolve-when-done ()
+ "Call \"git add\" if the conflict markers have been removed."
+ (save-excursion
+ (goto-char (point-min))
+ (unless (re-search-forward "^<<<<<<< " nil t)
+ (vc-git-command nil 0 buffer-file-name "add")
+ ;; Remove the hook so that it is not called multiple times.
+ (remove-hook 'after-save-hook 'vc-git-resolve-when-done t))))
+
+(defun vc-git-find-file-hook ()
+ "Activate `smerge-mode' if there is a conflict."
+ (when (and buffer-file-name
+ (vc-git-conflicted-files buffer-file-name)
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward "^<<<<<<< " nil 'noerror)))
+ (vc-file-setprop buffer-file-name 'vc-state 'conflict)
+ (smerge-start-session)
+ (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local)
+ (message "There are unresolved conflicts in this file")))
;;; HISTORY FUNCTIONS
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117698: Add smerge support to the git back end.,
Eric S. Raymond <=