aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-09-28 18:45:43 +0000
committerStefan Monnier2007-09-28 18:45:43 +0000
commit1c67a81478ffb168a097a068c2bacee6adf48bcf (patch)
tree955691d7d4df545068e0a0b23928162a28ca20fa
parent2e24a955f8a4c16ff47489709672a41e430ad214 (diff)
downloademacs-1c67a81478ffb168a097a068c2bacee6adf48bcf.tar.gz
emacs-1c67a81478ffb168a097a068c2bacee6adf48bcf.zip
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Used to try and automatically enabled smerge-mode in the presence of conflicts and to call `svn resolved' when the conflicts are gone. (vc-svn-parse-status): Remember the svn-specific status.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc-svn.el29
2 files changed, 34 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e2b68f2b617..b8ff1f4827c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12007-09-28 Stefan Monnier <monnier@iro.umontreal.ca> 12007-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * vc-svn.el (vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
4 Used to try and automatically enabled smerge-mode in the presence of
5 conflicts and to call `svn resolved' when the conflicts are gone.
6 (vc-svn-parse-status): Remember the svn-specific status.
7
3 * newcomment.el (comment-choose-indent): New function extracted 8 * newcomment.el (comment-choose-indent): New function extracted
4 from comment-indent. Improve the alignment algorithm. 9 from comment-indent. Improve the alignment algorithm.
5 (comment-indent): Use it. 10 (comment-indent): Use it.
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el
index ceb1df52eaf..bfb0da68048 100644
--- a/lisp/vc-svn.el
+++ b/lisp/vc-svn.el
@@ -493,6 +493,33 @@ and that it passes `vc-svn-global-switches' to it before FLAGS."
493 ;; behavior for different modules on the same server. 493 ;; behavior for different modules on the same server.
494 (match-string 1)))) 494 (match-string 1))))
495 495
496(defun vc-svn-resolve-when-done ()
497 "Call \"svn resolved\" if the conflict markers have been removed."
498 (save-excursion
499 (goto-char (point-min))
500 (if (not (re-search-forward "^<<<<<<< " nil t))
501 (vc-svn-command nil 0 buffer-file-name "resolved"))))
502
503;; Inspired by vc-arch-find-file-hook.
504(defun vc-svn-find-file-hook ()
505 (when (eq ?C (vc-file-getprop buffer-file-name 'vc-svn-status))
506 ;; If the file is marked as "conflicted", then we should try and call
507 ;; "svn resolved" when applicable.
508 (if (save-excursion
509 (goto-char (point-min))
510 (re-search-forward "^<<<<<<< " nil t))
511 ;; There are conflict markers.
512 (progn
513 (smerge-mode 1)
514 (add-hook 'after-save-hook 'vc-svn-resolve-when-done nil t))
515 ;; There are no conflict markers. This is problematic: maybe it means
516 ;; the conflict has been resolved and we should immediately call "svn
517 ;; resolved", or it means that the file's type does not allow Svn to
518 ;; use conflict markers in which case we don't really know what to do.
519 ;; So let's just punt for now.
520 nil)
521 (message "There are unresolved conflicts in this file")))
522
496(defun vc-svn-parse-status (&optional filename) 523(defun vc-svn-parse-status (&optional filename)
497 "Parse output of \"svn status\" command in the current buffer. 524 "Parse output of \"svn status\" command in the current buffer.
498Set file properties accordingly. Unless FILENAME is non-nil, parse only 525Set file properties accordingly. Unless FILENAME is non-nil, parse only
@@ -515,6 +542,8 @@ information about FILENAME and return its status."
515 ;; Use the last-modified revision, so that searching in vc-print-log 542 ;; Use the last-modified revision, so that searching in vc-print-log
516 ;; output works. 543 ;; output works.
517 (vc-file-setprop file 'vc-workfile-version (match-string 3)) 544 (vc-file-setprop file 'vc-workfile-version (match-string 3))
545 ;; Remember Svn's own status.
546 (vc-file-setprop file 'vc-svn-status status)
518 (vc-file-setprop 547 (vc-file-setprop
519 file 'vc-state 548 file 'vc-state
520 (cond 549 (cond