(with-current-buffer (get-buffer "*vc*")
(goto-char (point-min))
(if (re-search-forward "conflicts during merge" nil t)
- 1 ; signal error
- 0))) ; signal success
+ (progn
+ (vc-file-setprop file 'vc-state 'conflict)
+ ;; signal error
+ 1)
+ (vc-file-setprop file 'vc-state 'edited)
+ ;; signal success
+ 0)))
(defun vc-cvs-merge-news (file)
"Merge in any new changes made to FILE."
0);; indicate success to the caller
;; Conflicts detected!
(t
- (vc-file-setprop file 'vc-state 'edited)
+ (vc-file-setprop file 'vc-state 'conflict)
1);; signal the error to the caller
)
(pop-to-buffer "*vc*")
(if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t))
(setq status "Unknown")
(setq status (match-string 1)))
- (if (and full
- (re-search-forward
- "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\
+ (when (and full
+ (re-search-forward
+ "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\
\[\t ]+\\([0-9.]+\\)"
- nil t))
+ nil t))
(vc-file-setprop file 'vc-latest-revision (match-string 2)))
(vc-file-setprop
file 'vc-state
(if missing 'missing 'needs-patch))
((string-match "Locally Added" status) 'added)
((string-match "Locally Removed" status) 'removed)
+ ((string-match "File had conflicts " status) 'conflict)
(t 'edited))))))))
(defun vc-cvs-dir-state-heuristic (dir)
(if missing 'missing 'needs-patch))
((string-match "Locally Added" status-str) 'added)
((string-match "Locally Removed" status-str) 'removed)
+ ((string-match "File had conflicts " status-str) 'conflict)
(t 'edited)))
(unless (eq status 'up-to-date)
(push (list file status) result))))))
'removed Scheduled to be deleted from the repository on next commit.
+ 'conflict The file contains conflicts as the result of a merge.
+ For now the conflicts are text conflicts. In the
+ futures this might be extended to deal with metadata
+ conflicts too.
+
'missing The file is not present in the file system, but the VC
system still tracks it.
(eq (vc-checkout-model file) 'implicit)
(vc-file-setprop file 'vc-state 'edited)
(vc-mode-line file)
- (if (featurep 'vc)
- ;; If VC is not loaded, then there can't be
- ;; any VC Dired buffer to synchronize.
- (vc-dired-resynch-file file)))))
+ (when (featurep 'vc)
+ ;; If VC is not loaded, then there can't be
+ ;; any VC Dired buffer to synchronize.
+ (vc-dired-resynch-file file)))))
(defvar vc-menu-entry
'(menu-item "Version Control" vc-menu-map
((eq state 'added)
(setq state-echo "Locally added file")
(concat backend "@" rev))
+ ((eq state 'conflict)
+ (setq state-echo "File contains conflicts after the last merge")
+ (concat backend "!" rev))
((eq state 'removed)
(setq state-echo "File removed from the VC system")
(concat backend "!" rev))
(define-key map "a" 'vc-update-change-log)
(define-key map "b" 'vc-switch-backend)
(define-key map "c" 'vc-rollback)
- (define-key map "d" 'vc-directory)
+ (define-key map "d" 'vc-status)
(define-key map "g" 'vc-annotate)
(define-key map "h" 'vc-insert-headers)
(define-key map "i" 'vc-register)
(define-key map [vc-create-snapshot]
'(menu-item "Create Snapshot" vc-create-snapshot
:help "Create Snapshot"))
- (define-key map [vc-directory]
- '(menu-item "VC Directory Listing" vc-directory
- :help "Show the VC status of files in a directory"))
- ;; `vc-status' is a not-quite-ready replacement for `vc-directory'
- ;; (define-key map [vc-status] '("VC Status" . vc-status))
(define-key map [separator1] '("----"))
(define-key map [vc-annotate]
'(menu-item "Annotate" vc-annotate
(define-key map [vc-register]
'(menu-item "Register" vc-register
:help "Register file set into a version control system"))
+ (define-key map [vc-status]
+ '(menu-item "VC Status" vc-status
+ :help "Show the VC status of files in a directory"))
map))
(defalias 'vc-menu-map vc-menu-map)
;; Martin Lorentzson <martinl@gnu.org>
;; Dave Love <fx@gnu.org>
;; Stefan Monnier <monnier@cs.yale.edu>
+;; Thien-Thi Nguyen <ttn@gnu.org>
+;; Dan Nicolaescu <dann@ics.uci.edu>
;; J.D. Smith <jdsmith@alum.mit.edu>
;; Andre Spiegel <spiegel@gnu.org>
;; Richard Stallman <rms@gnu.org>
-;; Thien-Thi Nguyen <ttn@gnu.org>
;;
;; In July 2007 ESR returned and redesigned the mode to cope better
;; with modern version-control systems that do commits by fileset
;; If a backend needs to show more information than the default FILE
;; and STATE in the vc-status listing, it can store that extra
;; information in `vc-status-fileinfo->extra'. This function can be
-;; used to display that extra information in the vc-status buffer.
+;; used to display that extra information in the *vc-status* buffer.
;;
;; - status-fileinfo-extra (file)
;;
;; Modify the change comments associated with the files at the
;; given revision. This is optional, many backends do not support it.
;;
+;; - mark-resolved (files)
+;;
+;; Mark conflicts as resolved. Some VC systems need to run a
+;; command to mark conflicts as resolved.
+;;
;; HISTORY FUNCTIONS
;;
;; * print-log (files &optional buffer)
;;
;; - "snapshots" should be renamed to "branches", and thoroughly reworked.
;;
-;; - the backend sometimes knows when a file it opens has been marked
-;; by the VCS as having a "conflict". Find a way to pass this info -
-;; to VC so that it can turn on smerge-mode when opening such a
-;; file.
+;; - when a file is in `conflict' state, turn on smerge-mode.
+;;
+;; - figure out what to do with conflicts that are not caused by the
+;; file contents, but by metadata or other causes.
;;
;; - add a generic mechanism for remembering the current branch names,
;; display the branch name in the mode-line. Replace
;; vc-cvs-sticky-tag with that.
;;
;; - vc-diff should be able to show the diff for all files in a
-;; changeset, especially for VC systems that have per repository version numbers.
-;; log-view should take advantage of this.
+;; changeset, especially for VC systems that have per repository
+;; version numbers. log-view should take advantage of this.
;;
-;; - a way to do repository wide log (instead of just per file/fileset) is needed.
+;; - a way to do repository wide log (instead of just per
+;; file/fileset) is needed.
;;
;; - the *VC-log* buffer needs font-locking.
;;
;; - vc-next-action should do something about 'missing files. Maybe
;; just warn, or offer to checkout.
;;
-;; - decide if vc-status should replace vc-dired.
+;; - display the directory names in vc-status, similar to what PCL-CVS
+;; does.
+;;
+;; - most vc-status backends need more work. They might need to
+;; provide custom headers, use the `extra' field and deal with all
+;; possible VC states.
+;;
+;; - add function that calls vc-status to `find-directory-functions'.
;;
;; - vc-status needs mouse bindings.
;;
;;
;; - vc-status toolbar needs more icons.
;;
-;; - the dir-status backend function should take as an argument an
-;; optional fileset. and return the results just for that fileset.
-;; This can be used to speed up status buffer updates after VC
-;; operations.
+;; - vc-status needs a command to insert a file entry in the status
+;; display, similar to `cvs-mode-insert'.
;;
-;; - keep the *vc-status* buffer sorted by file name.
+;; - the dir-status backend function should take as an argument an
+;; optional fileset, and should return the results just for that
+;; fileset. This can be used to speed up status buffer updates
+;; after VC operations.
;;
;; - vc-status: refresh should not completely wipe out the current
;; contents of the vc-status buffer.
(require 'vc-hooks)
(require 'tool-bar)
+(require 'ewoc)
(eval-when-compile
(require 'cl)
(defsubst vc-editable-p (file)
"Return non-nil if FILE can be edited."
(or (eq (vc-checkout-model file) 'implicit)
- (memq (vc-state file) '(edited needs-merge))))
+ (memq (vc-state file) '(edited needs-merge conflict))))
(defun vc-revert-buffer-internal (&optional arg no-confirm)
"Revert buffer, keeping point and mark where user expects them.
(read-string (format "%s revision to steal: " file))
(vc-working-revision file))
state)))
+ ;; conflict
+ ((eq state 'conflict)
+ (vc-mark-resolved files))
;; needs-patch
((eq state 'needs-patch)
(dolist (file files)
(vc-resynch-buffer file t t)
(run-hooks 'vc-checkout-hook))
+(defun vc-mark-resolved (files)
+ (with-vc-properties
+ files
+ (vc-call mark-resolved files)
+ ;; XXX: Is this TRTD? Might not be.
+ `((vc-state . edited))))
+
(defun vc-steal-lock (file rev owner)
"Steal the lock on FILE."
(let (file-description)
vc-dired-switches
'vc-dired-mode))))
-;;; Experimental code for the vc-dired replacement
-(require 'ewoc)
-
+;; VC status implementation
;; Used to store information for the files displayed in the *VC status* buffer.
;; Each item displayed corresponds to one of these defstructs.
(propertize
(format "%-20s" state)
'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face)
- ((eq state 'missing) 'font-lock-warning-face)
+ ((memq state '(missing conflict)) 'font-lock-warning-face)
(t 'font-lock-variable-name-face))
'mouse-face 'highlight)
" "
(defun vc-status-mode ()
"Major mode for VC status.
\\{vc-status-mode-map}"
- (setq mode-name "*VC Status*")
+ (setq mode-name "VC Status")
(setq major-mode 'vc-status-mode)
(setq buffer-read-only t)
(set (make-local-variable 'vc-status-crt-marked) nil)
;; not needed.
(unless found-vc-status-buf (remove-hook 'after-save-hook 'vc-status-mark-buffer-changed)))))
-;;; End experimental code.
-
;; Named-configuration entry points
(defun vc-snapshot-precondition (dir)
(defun vc-default-comment-history (backend file)
"Return a string with all log entries stored in BACKEND for FILE."
- (if (vc-find-backend-function backend 'print-log)
- (with-current-buffer "*vc*"
- (vc-call print-log (list file))
- (vc-call-backend backend 'wash-log)
- (buffer-string))))
+ (when (vc-find-backend-function backend 'print-log)
+ (with-current-buffer "*vc*"
+ (vc-call print-log (list file))
+ (vc-call-backend backend 'wash-log)
+ (buffer-string))))
(defun vc-default-receive-file (backend file rev)
"Let BACKEND receive FILE from another version control system."