comparison lisp/vc-cvs.el @ 93956:bfc762f0b49c

* vc-hooks.el (vc-state): Add new state `conflict'. (vc-after-save): Use when not if. (vc-default-mode-line-string): Deal with the conflict state. (vc-prefix-map): (vc-menu-map): Bind vc-status instead of vc-directory. * vc.el (vc-editable-p): (vc-default-status-printer): (vc-next-action): Deal with the conflict state. (vc-mark-resolved): New function. (vc-status-mode): Fix mode name. (vc-default-comment-history): Use when not if. (Todo): Add new entries, remove old ones. * vc-cvs.el (vc-cvs-merge, vc-cvs-merge-news): Set conflict state. (vc-cvs-parse-status): (vc-cvs-after-dir-status): * vc-svn.el (vc-svn-after-dir-status, vc-svn-parse-status): Detect the conflict state.
author Dan Nicolaescu <dann@ics.uci.edu>
date Thu, 10 Apr 2008 07:32:25 +0000
parents c024d26a0a5d
children 2ecb2ea8d5b5
comparison
equal deleted inserted replaced
93955:758c5f9b9633 93956:bfc762f0b49c
434 (concat "-j" second-revision)) 434 (concat "-j" second-revision))
435 (vc-file-setprop file 'vc-state 'edited) 435 (vc-file-setprop file 'vc-state 'edited)
436 (with-current-buffer (get-buffer "*vc*") 436 (with-current-buffer (get-buffer "*vc*")
437 (goto-char (point-min)) 437 (goto-char (point-min))
438 (if (re-search-forward "conflicts during merge" nil t) 438 (if (re-search-forward "conflicts during merge" nil t)
439 1 ; signal error 439 (progn
440 0))) ; signal success 440 (vc-file-setprop file 'vc-state 'conflict)
441 ;; signal error
442 1)
443 (vc-file-setprop file 'vc-state 'edited)
444 ;; signal success
445 0)))
441 446
442 (defun vc-cvs-merge-news (file) 447 (defun vc-cvs-merge-news (file)
443 "Merge in any new changes made to FILE." 448 "Merge in any new changes made to FILE."
444 (message "Merging changes into %s..." file) 449 (message "Merging changes into %s..." file)
445 ;; (vc-file-setprop file 'vc-working-revision nil) 450 ;; (vc-file-setprop file 'vc-working-revision nil)
476 ((string= (match-string 1) "M ") 481 ((string= (match-string 1) "M ")
477 (vc-file-setprop file 'vc-state 'edited) 482 (vc-file-setprop file 'vc-state 'edited)
478 0);; indicate success to the caller 483 0);; indicate success to the caller
479 ;; Conflicts detected! 484 ;; Conflicts detected!
480 (t 485 (t
481 (vc-file-setprop file 'vc-state 'edited) 486 (vc-file-setprop file 'vc-state 'conflict)
482 1);; signal the error to the caller 487 1);; signal the error to the caller
483 ) 488 )
484 (pop-to-buffer "*vc*") 489 (pop-to-buffer "*vc*")
485 (error "Couldn't analyze cvs update result"))) 490 (error "Couldn't analyze cvs update result")))
486 (message "Merging changes into %s...done" file)))) 491 (message "Merging changes into %s...done" file))))
812 (setq file (expand-file-name (match-string 1))) 817 (setq file (expand-file-name (match-string 1)))
813 (vc-file-setprop file 'vc-backend 'CVS) 818 (vc-file-setprop file 'vc-backend 'CVS)
814 (if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t)) 819 (if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t))
815 (setq status "Unknown") 820 (setq status "Unknown")
816 (setq status (match-string 1))) 821 (setq status (match-string 1)))
817 (if (and full 822 (when (and full
818 (re-search-forward 823 (re-search-forward
819 "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\ 824 "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\
820 \[\t ]+\\([0-9.]+\\)" 825 \[\t ]+\\([0-9.]+\\)"
821 nil t)) 826 nil t))
822 (vc-file-setprop file 'vc-latest-revision (match-string 2))) 827 (vc-file-setprop file 'vc-latest-revision (match-string 2)))
823 (vc-file-setprop 828 (vc-file-setprop
824 file 'vc-state 829 file 'vc-state
825 (cond 830 (cond
826 ((string-match "Up-to-date" status) 831 ((string-match "Up-to-date" status)
831 ((string-match "Needs Merge" status) 'needs-merge) 836 ((string-match "Needs Merge" status) 'needs-merge)
832 ((string-match "Needs \\(Checkout\\|Patch\\)" status) 837 ((string-match "Needs \\(Checkout\\|Patch\\)" status)
833 (if missing 'missing 'needs-patch)) 838 (if missing 'missing 'needs-patch))
834 ((string-match "Locally Added" status) 'added) 839 ((string-match "Locally Added" status) 'added)
835 ((string-match "Locally Removed" status) 'removed) 840 ((string-match "Locally Removed" status) 'removed)
841 ((string-match "File had conflicts " status) 'conflict)
836 (t 'edited)))))))) 842 (t 'edited))))))))
837 843
838 (defun vc-cvs-dir-state-heuristic (dir) 844 (defun vc-cvs-dir-state-heuristic (dir)
839 "Find the CVS state of all files in DIR, using only local information." 845 "Find the CVS state of all files in DIR, using only local information."
840 (with-temp-buffer 846 (with-temp-buffer
895 ((string-match "Needs Merge" status-str) 'needs-merge) 901 ((string-match "Needs Merge" status-str) 'needs-merge)
896 ((string-match "Needs \\(Checkout\\|Patch\\)" status-str) 902 ((string-match "Needs \\(Checkout\\|Patch\\)" status-str)
897 (if missing 'missing 'needs-patch)) 903 (if missing 'missing 'needs-patch))
898 ((string-match "Locally Added" status-str) 'added) 904 ((string-match "Locally Added" status-str) 'added)
899 ((string-match "Locally Removed" status-str) 'removed) 905 ((string-match "Locally Removed" status-str) 'removed)
906 ((string-match "File had conflicts " status-str) 'conflict)
900 (t 'edited))) 907 (t 'edited)))
901 (unless (eq status 'up-to-date) 908 (unless (eq status 'up-to-date)
902 (push (list file status) result)))))) 909 (push (list file status) result))))))
903 (goto-char (point-max)) 910 (goto-char (point-max))
904 (widen)) 911 (widen))