You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ma...@apache.org on 2012/05/06 18:42:01 UTC

svn commit: r1334686 - in /subversion/trunk/contrib/client-side/emacs: dsvn.el vc-svn.el

Author: mattiase
Date: Sun May  6 16:42:01 2012
New Revision: 1334686

URL: http://svn.apache.org/viewvc?rev=1334686&view=rev
Log:
Make the Emacs client code handle tree conflicts more gracefully, instead of
giving up, signalling an error or emitting nonsensical messages.

* contrib/client-side/emacs/dsvn.el
  (svn-status-filter, svn-status-v-filter, svn-update-filter): Parse svn output
    with tree conflicts better, and annotate the corresponding items with the
    detailed conflict message.
  (svn-update-status-msg): Left-align message for consistency.
  (svn-update-conflict-msg): New.

* contrib/client-side/emacs/vc-svn.el
  (vc-svn-parse-status): Parse output from "svn status -v" in a way that is
    more tolerant of tree conflicts and locks.

Modified:
    subversion/trunk/contrib/client-side/emacs/dsvn.el
    subversion/trunk/contrib/client-side/emacs/vc-svn.el

Modified: subversion/trunk/contrib/client-side/emacs/dsvn.el
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/client-side/emacs/dsvn.el?rev=1334686&r1=1334685&r2=1334686&view=diff
==============================================================================
--- subversion/trunk/contrib/client-side/emacs/dsvn.el (original)
+++ subversion/trunk/contrib/client-side/emacs/dsvn.el Sun May  6 16:42:01 2012
@@ -1083,19 +1083,24 @@ outside."
       (goto-char (point-max))
       (insert str)
       (goto-char svn-output-marker)
-      (while (cond ((looking-at
-                     "\\([ ACDGIMRX?!~][ CM][ L][ +][ S][ KOTB]\\)[ C]? \\([^ ].*\\)\n")
-                    (let ((status (match-string 1))
-                          (filename (svn-normalise-path (match-string 2))))
-                      (delete-region (match-beginning 0)
-                                     (match-end 0))
-                      (svn-insert-file filename status))
-                    t)
-                   ((looking-at
-                     "\n\\|Performing status on external item at .*\n")
-                    (delete-region (match-beginning 0)
-                                   (match-end 0))
-                    t))))))
+      (while
+	 (cond
+	  ((looking-at
+	    "\\([ ACDGIMRX?!~][ CM][ L][ +][ S][ KOTB]\\)[ C]? \\([^ ].*\\)\n")
+	   (let ((status (match-string 1))
+		 (filename (svn-normalise-path (match-string 2))))
+	     (delete-region (match-beginning 0) (match-end 0))
+	     (svn-insert-file filename status))
+	   t)
+	  ((looking-at "\n\\|Performing status on external item at .*\n")
+	   (delete-region (match-beginning 0) (match-end 0))
+	   t)
+	  ((looking-at "      > +\\([^ ].*\\)\n")
+	   (let ((tree-conflict (match-string 1)))
+	     (delete-region (match-beginning 0) (match-end 0))
+	     (svn-update-status-msg svn-last-inserted-marker "TConflict")
+	     (svn-update-conflict-msg svn-last-inserted-marker tree-conflict))
+	   t))))))
 
 (defun svn-status-sentinel (proc reason)
   (with-current-buffer (process-buffer proc)
@@ -1110,15 +1115,23 @@ outside."
       (goto-char (point-max))
       (insert str)
       (goto-char svn-output-marker)
-      (while (looking-at
-              "\\(?:\\(\\?.....\\)\\|\\([ ACDGIMRX!~][ CM][ L][ +][ S][ KOTB]\\)[ C]? [* ] +[^ ]+ +[^ ]+ +[^ ]+\\) +\\([^ ].*\\)\n")
-        (let ((status (or (match-string 1) (match-string 2)))
-              (filename (svn-normalise-path (match-string 3))))
-          (delete-region (match-beginning 0)
-                         (match-end 0))
-	  (when (or (not svn-file-filter)
-		    (member filename svn-file-filter))
-	    (svn-insert-file filename status)))))))
+      (while
+	  (cond
+	   ((looking-at
+	     "\\(?:\\(\\?.....\\)\\|\\([ ACDGIMRX!~][ CM][ L][ +][ S][ KOTB]\\)[ C]? [* ] +[^ ]+ +[^ ]+ +[^ ]+\\) +\\([^ ].*\\)\n")
+	    (let ((status (or (match-string 1) (match-string 2)))
+		  (filename (svn-normalise-path (match-string 3))))
+	      (delete-region (match-beginning 0) (match-end 0))
+	      (when (or (not svn-file-filter)
+			(member filename svn-file-filter))
+		(svn-insert-file filename status)))
+	    t)
+	   ((looking-at "      > +\\([^ ].*\\)\n")
+	    (let ((tree-conflict (match-string 1)))
+	      (delete-region (match-beginning 0) (match-end 0))
+	      (svn-update-status-msg svn-last-inserted-marker "TConflict")
+	      (svn-update-conflict-msg svn-last-inserted-marker tree-conflict))
+	    t))))))
 
 (defun svn-status-v-sentinel (proc reason)
   (with-current-buffer (process-buffer proc)
@@ -1209,11 +1222,12 @@ With prefix arg, prompt for REVISION."
       (goto-char svn-output-marker)
       (while (not nomore)
         (cond ((looking-at
-                "\\([ ADUCGE][ ADUCGE][ B]\\)  \\(.*\\)\n")
+                "\\([ ADUCGE][ ADUCGE][ B]\\)\\([ C]?\\) \\([^ ].*\\)\n")
                (let* ((status (match-string 1))
                       (file-status (elt status 0))
                       (prop-status (elt status 1))
-                      (filename (svn-normalise-path (match-string 2))))
+		      (tree-status (match-string 2))
+                      (filename (svn-normalise-path (match-string 3))))
                  (delete-region (match-beginning 0)
                                 (match-end 0))
                  (svn-insert-file
@@ -1223,7 +1237,9 @@ With prefix arg, prompt for REVISION."
                           (svn-remap-update-to-status file-status)
                           (svn-remap-update-to-status prop-status))
                   ;; Optimize for some common cases
-                  (cond ((= prop-status ?\ )
+                  (cond ((string= tree-status "C")
+			 "TConflict")
+			((= prop-status ?\ )
                          (cdr (assq file-status svn-update-flag-name)))
                         ((= file-status ?\ )
                          (let ((s (format "P %s"
@@ -2104,7 +2120,14 @@ Argument MSG is the character to use."
   (save-excursion
     (goto-char (+ pos svn-status-msg-col))
     (delete-char 9)
-    (insert-and-inherit (format "%9s" msg))))
+    (insert-and-inherit (format "%-9s" msg))))
+
+(defun svn-update-conflict-msg (pos msg)
+  (save-excursion
+    (let ((filename (svn-getprop pos 'file)))
+      (goto-char (+ pos svn-status-file-col (length filename)))
+      (delete-char (- (line-end-position) (point)))
+      (insert-and-inherit (concat " -- " msg)))))
 
 (defun svn-foreach-svn-buffer (file-name function)
   "Call FUNCTION for each svn status buffer that contains FILE-NAME.

Modified: subversion/trunk/contrib/client-side/emacs/vc-svn.el
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/client-side/emacs/vc-svn.el?rev=1334686&r1=1334685&r2=1334686&view=diff
==============================================================================
--- subversion/trunk/contrib/client-side/emacs/vc-svn.el (original)
+++ subversion/trunk/contrib/client-side/emacs/vc-svn.el Sun May  6 16:42:01 2012
@@ -200,9 +200,9 @@ If the file is newly added, LOCAL is \"0
     (cond
      ((not state) nil)
      ;; A newly added file has no revision.
-     ((looking-at "....\\s-+\\(\\*\\s-+\\)?[-0]\\s-+\\(\\?\\|[0-9]+\\)")
+     ((looking-at ".......\\s-+\\(\\*\\s-+\\)?[-0]\\s-+\\(\\?\\|[0-9]+\\)")
       (list state "0" nil))
-     ((looking-at "....\\s-+\\(\\*\\s-+\\)?\\([0-9]+\\)\\s-+\\([0-9]+\\)")
+     ((looking-at ".......\\s-+\\(\\*\\s-+\\)?\\([0-9]+\\)\\s-+\\([0-9]+\\)")
       (list state
             (match-string 2)
             (match-string 3)))