changeset 93976:c53b75d15c27

(vc-bzr-after-dir-status): Detect the conflict state.
author Dan Nicolaescu <dann@ics.uci.edu>
date Thu, 10 Apr 2008 15:03:27 +0000
parents 1e3a407766b9
children bc90a81fc7cb
files lisp/ChangeLog lisp/vc-bzr.el
diffstat 2 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Apr 10 14:10:46 2008 +0000
+++ b/lisp/ChangeLog	Thu Apr 10 15:03:27 2008 +0000
@@ -1,3 +1,7 @@
+2008-04-10  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* vc-bzr.el (vc-bzr-after-dir-status): Detect the conflict state.
+
 2008-04-10  Juanma Barranquero  <lekktu@gmail.com>
 
 	* subr.el (assoc-ignore-case, assoc-ignore-representation):
--- a/lisp/vc-bzr.el	Thu Apr 10 14:10:46 2008 +0000
+++ b/lisp/vc-bzr.el	Thu Apr 10 15:03:27 2008 +0000
@@ -657,7 +657,6 @@
     ;; else fall back to default vc.el representation
     (vc-default-dired-state-info 'Bzr file)))
 
-;; XXX Experimental function for the vc-dired replacement.
 ;; XXX: this needs testing, it's probably incomplete. 
 (defun vc-bzr-after-dir-status (update-function status-buffer)
   (let ((status-str nil)
@@ -667,6 +666,7 @@
 		       (" M" . edited)
 		       ;; XXX: what about ignored files?
 		       (" D" . missing)
+		       ("C " . conflict)
 		       ("? " . unregistered)))
 	(translated nil)
 	(result nil))
@@ -674,11 +674,24 @@
       (while (not (eobp))
 	(setq status-str
 	      (buffer-substring-no-properties (point) (+ (point) 2)))
-	(setq file
-	      (buffer-substring-no-properties (+ (point) 4)
-					      (line-end-position)))
-	(setq translated (assoc status-str translation))
-	(push (list file (cdr translated)) result)
+	(setq translated (cdr (assoc status-str translation)))
+	;; For conflicts the file appears twice in the listing: once
+	;; with the M flag and once with the C flag, so take care not
+	;; to add it twice to `result'.  Ugly.
+	(if (eq translated 'conflict)
+	    (let* ((file
+		    (buffer-substring-no-properties
+		     ;;For files with conflicts the format is:
+		     ;;C   Text conflict in FILENAME
+		     ;; Bah.
+		     (+ (point) 21) (line-end-position)))
+		   (entry (assoc file result)))
+	      (when entry
+		(setf (nth 1 entry) 'conflict)))
+	  (push (list (buffer-substring-no-properties
+		       (+ (point) 4)
+		       (line-end-position)) 
+		      translated) result))
 	(forward-line))
       (funcall update-function result status-buffer)))