mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-24 07:20:37 +00:00
* 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.
This commit is contained in:
parent
6e81a223a4
commit
7fbb47976e
@ -1,3 +1,25 @@
|
||||
2008-04-10 Dan Nicolaescu <dann@ics.uci.edu>
|
||||
|
||||
* 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.
|
||||
|
||||
2008-04-10 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* Makefile.in (MH_E_DIR): New variable.
|
||||
|
@ -436,8 +436,13 @@ The changes are between FIRST-REVISION and SECOND-REVISION."
|
||||
(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."
|
||||
@ -478,7 +483,7 @@ The changes are between FIRST-REVISION and SECOND-REVISION."
|
||||
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*")
|
||||
@ -814,11 +819,11 @@ state."
|
||||
(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
|
||||
@ -833,6 +838,7 @@ 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)
|
||||
@ -897,6 +903,7 @@ state."
|
||||
(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))))))
|
||||
|
@ -517,6 +517,11 @@ For registered files, the value returned is one of:
|
||||
|
||||
'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.
|
||||
|
||||
@ -775,10 +780,10 @@ Before doing that, check if there are any old backups and get rid of them."
|
||||
(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
|
||||
@ -861,6 +866,9 @@ This function assumes that the file is registered."
|
||||
((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))
|
||||
@ -981,7 +989,7 @@ Used in `find-file-not-found-functions'."
|
||||
(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)
|
||||
@ -1010,11 +1018,6 @@ Used in `find-file-not-found-functions'."
|
||||
(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
|
||||
@ -1054,6 +1057,9 @@ Used in `find-file-not-found-functions'."
|
||||
(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)
|
||||
|
@ -160,7 +160,7 @@ If you want to force an empty list of arguments, use t."
|
||||
|
||||
(defun vc-svn-after-dir-status (callback buffer)
|
||||
(let ((state-map '((?A . added)
|
||||
(?C . edited)
|
||||
(?C . conflict)
|
||||
(?D . removed)
|
||||
(?I . ignored)
|
||||
(?M . edited)
|
||||
@ -636,7 +636,9 @@ information about FILENAME and return its status."
|
||||
(vc-file-setprop file 'vc-working-revision "0")
|
||||
(vc-file-setprop file 'vc-checkout-time 0)
|
||||
'added)
|
||||
((memq status '(?M ?C))
|
||||
((eq status ?C)
|
||||
(vc-file-setprop file 'vc-state 'conflict))
|
||||
((eq status '?M)
|
||||
(if (eq (char-after (match-beginning 1)) ?*)
|
||||
'needs-merge
|
||||
'edited))
|
||||
|
78
lisp/vc.el
78
lisp/vc.el
@ -37,10 +37,11 @@
|
||||
;; 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
|
||||
@ -199,7 +200,7 @@
|
||||
;; 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)
|
||||
;;
|
||||
@ -362,6 +363,11 @@
|
||||
;; 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)
|
||||
@ -583,20 +589,21 @@
|
||||
;;
|
||||
;; - "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.
|
||||
;;
|
||||
@ -615,7 +622,14 @@
|
||||
;; - 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.
|
||||
;;
|
||||
@ -623,12 +637,13 @@
|
||||
;;
|
||||
;; - 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.
|
||||
@ -646,6 +661,7 @@
|
||||
|
||||
(require 'vc-hooks)
|
||||
(require 'tool-bar)
|
||||
(require 'ewoc)
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl)
|
||||
@ -1478,7 +1494,7 @@ Otherwise, throw an error."
|
||||
(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.
|
||||
@ -1667,6 +1683,9 @@ merge in the changes into your working copy."
|
||||
(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)
|
||||
@ -1901,6 +1920,13 @@ After check-out, runs the normal hook `vc-checkout-hook'."
|
||||
(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)
|
||||
@ -2673,9 +2699,7 @@ With prefix arg READ-SWITCHES, specify a value to override
|
||||
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.
|
||||
@ -2722,7 +2746,7 @@ specific headers."
|
||||
(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)
|
||||
" "
|
||||
@ -2956,7 +2980,7 @@ specific headers."
|
||||
(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)
|
||||
@ -3278,8 +3302,6 @@ that share the same state."
|
||||
;; 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)
|
||||
@ -3909,11 +3931,11 @@ to provide the `find-revision' operation instead."
|
||||
|
||||
(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."
|
||||
|
Loading…
Reference in New Issue
Block a user