From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: vc-svn and "resolved" Date: Tue, 18 Sep 2007 23:33:20 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1190172832 2585 80.91.229.12 (19 Sep 2007 03:33:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 19 Sep 2007 03:33:52 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org To: Tom Tromey Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 19 05:33:48 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IXqJu-000201-4q for ged-emacs-devel@m.gmane.org; Wed, 19 Sep 2007 05:33:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXqJs-0004Z9-Ee for ged-emacs-devel@m.gmane.org; Tue, 18 Sep 2007 23:33:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXqJd-0004Ud-Qw for emacs-devel@gnu.org; Tue, 18 Sep 2007 23:33:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXqJb-0004TT-9m for emacs-devel@gnu.org; Tue, 18 Sep 2007 23:33:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXqJa-0004TK-TB for emacs-devel@gnu.org; Tue, 18 Sep 2007 23:33:26 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IXqJa-0006ZZ-Nw for emacs-devel@gnu.org; Tue, 18 Sep 2007 23:33:26 -0400 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IXqJ3-0004b6-5C for emacs-pretest-bug@gnu.org; Tue, 18 Sep 2007 23:32:53 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1IXqJW-0006Yd-Dl for emacs-pretest-bug@gnu.org; Tue, 18 Sep 2007 23:33:26 -0400 Original-Received: from tomts13.bellnexxia.net ([209.226.175.34] helo=tomts13-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IXqJV-0006YK-UD for emacs-pretest-bug@gnu.org; Tue, 18 Sep 2007 23:33:22 -0400 Original-Received: from pastel.home ([70.55.141.227]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070919033320.VWEM13659.tomts13-srv.bellnexxia.net@pastel.home> for ; Tue, 18 Sep 2007 23:33:20 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 5B77C8A98; Tue, 18 Sep 2007 23:33:20 -0400 (EDT) In-Reply-To: (Tom Tromey's message of "Sat\, 08 Sep 2007 13\:28\:15 -0600") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-Detected-Kernel: Solaris 8 (1) X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:79263 gmane.emacs.pretest.bugs:19928 Archived-At: > After an "svn update", sometimes a file will have a conflict. With > svn, unlike cvs, you must run "svn resolved" on a file after resolving > conflicts. > I think vc-svn should do this for me. Ideally this would happen > automatically when I edit out the conflict markers and save the file. The patch below might be a good starting point. Could you try it out? Stefan --- vc-svn.el 28 jui 2007 16:22:17 -0400 1.34.2.1 +++ vc-svn.el 18 sep 2007 23:26:14 -0400 @@ -493,6 +493,33 @@ ;; behavior for different modules on the same server. (match-string 1)))) +(defun vc-svn-resolve-when-done () + "Call \"svn resolved\" if the conflict markers have been removed." + (save-excursion + (goto-char (point-min)) + (if (not (re-search-forward "^<<<<<<< " nil t)) + (vc-svn-command nil 0 buffer-file-name "resolved")))) + +;; Inspired by vc-arch-find-file-hook. +(defun vc-svn-find-file-hook () + (when (eq ?C (vc-file-getprop buffer-file-name 'vc-svn-status)) + ;; If the file is marked as "conflicted", then we should try and call + ;; "svn resolved" when applicable. + (if (save-excursion + (goto-char (point-min)) + (re-search-forward "^<<<<<<< " nil t)) + ;; There are conflict markers. + (progn + (smerge-mode 1) + (add-hook 'after-save-hook 'vc-svn-resolve-when-done nil t)) + ;; There are no conflict markers. This is problematic: maybe it means + ;; the conflict has been resolved and we should immediately call "svn + ;; resolved", or it means that the file's type does not allow Svn to + ;; use conflict markers in which case we don't really know what to do. + ;; So let's just punt for now. + nil) + (message "There are unresolved conflicts in this file"))) + (defun vc-svn-parse-status (&optional filename) "Parse output of \"svn status\" command in the current buffer. Set file properties accordingly. Unless FILENAME is non-nil, parse only @@ -515,6 +542,8 @@ ;; Use the last-modified revision, so that searching in vc-print-log ;; output works. (vc-file-setprop file 'vc-workfile-version (match-string 3)) + ;; Remember Svn's own status. + (vc-file-setprop file 'vc-svn-status status) (vc-file-setprop file 'vc-state (cond