(goto-char (point-min))
(cond
((re-search-forward
- ;; CVS-removed files are not taken under VC control.
- (concat "^/" (regexp-quote basename) "/[^/-]") nil t)
+ (concat "^/" (regexp-quote basename) "/[^/]") nil t)
(beginning-of-line)
(vc-cvs-parse-entry file)
t)
(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*")
(defun vc-cvs-modify-change-comment (files rev comment)
"Modify the change comments for FILES on a specified REV.
Will fail unless you have administrative privileges on the repo."
- (vc-cvs-command nil 0 files "rcs" (concat "-m" comment ":" rev)))
+ (vc-cvs-command nil 0 files "admin" (concat "-m" rev ":" comment)))
;;;
;;; History functions
(vc-switches 'CVS 'diff))))
(if async 1 status))) ; async diff, pessimistic assumption
-
-(defun vc-cvs-diff-tree (dir &optional rev1 rev2)
- "Diff all files at and below DIR."
- (with-current-buffer "*vc-diff*"
- (setq default-directory dir)
- (if (vc-stay-local-p dir)
- ;; local diff: do it filewise, and only for files that are modified
- (vc-file-tree-walk
- dir
- (lambda (f)
- (vc-exec-after
- `(let ((coding-system-for-read (vc-coding-system-for-diff ',f)))
- ;; possible optimization: fetch the state of all files
- ;; in the tree via vc-cvs-dir-state-heuristic
- (unless (vc-up-to-date-p ',f)
- (message "Looking at %s" ',f)
- (vc-diff-internal ',f ',rev1 ',rev2))))))
- ;; cvs diff: use a single call for the entire tree
- (let ((coding-system-for-read
- (or coding-system-for-read 'undecided)))
- (apply 'vc-cvs-command "*vc-diff*" 1 nil "diff"
- (and rev1 (concat "-r" rev1))
- (and rev2 (concat "-r" rev2))
- (vc-switches 'CVS 'diff))))))
-
(defconst vc-cvs-annotate-first-line-re "^[0-9]")
(defun vc-cvs-annotate-process-filter (process string)
(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)
(forward-line 1))))
;; XXX Experimental function for the vc-dired replacement.
-(defun vc-cvs-after-dir-status (update-function status-buffer)
+(defun vc-cvs-after-dir-status (update-function)
;; Heavily inspired by vc-cvs-parse-status. AKA a quick hack.
;; It needs a lot of testing.
(let ((status nil)
(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))))))
(goto-char (point-max))
(widen))
- (funcall update-function result status-buffer)))
+ (funcall update-function result))
+ ;; Alternative implementation: use the "update" command instead of
+ ;; the "status" command.
+ ;; (let ((result nil)
+ ;; (translation '((?? . unregistered)
+ ;; (?A . added)
+ ;; (?C . conflict)
+ ;; (?M . edited)
+ ;; (?P . needs-merge)
+ ;; (?R . removed)
+ ;; (?U . needs-patch))))
+ ;; (goto-char (point-min))
+ ;; (while (not (eobp))
+ ;; (if (looking-at "^[ACMPRU?] \\(.*\\)$")
+ ;; (push (list (match-string 1)
+ ;; (cdr (assoc (char-after) translation)))
+ ;; result)
+ ;; (cond
+ ;; ((looking-at "cvs update: warning: \\(.*\\) was lost")
+ ;; ;; Format is:
+ ;; ;; cvs update: warning: FILENAME was lost
+ ;; ;; U FILENAME
+ ;; (push (list (match-string 1) 'missing) result)
+ ;; ;; Skip the "U" line
+ ;; (forward-line 1))
+ ;; ((looking-at "cvs update: New directory `\\(.*\\)' -- ignored")
+ ;; (push (list (match-string 1) 'unregistered) result))))
+ ;; (forward-line 1))
+ ;; (funcall update-function result)))
+ )
;; XXX Experimental function for the vc-dired replacement.
-(defun vc-cvs-dir-status (dir update-function status-buffer)
+(defun vc-cvs-dir-status (dir update-function)
"Create a list of conses (file . state) for DIR."
(vc-cvs-command (current-buffer) 'async dir "status")
+ ;; Alternative implementation: use the "update" command instead of
+ ;; the "status" command.
+ ;; (vc-cvs-command (current-buffer) 'async
+ ;; (file-relative-name dir)
+ ;; "-f" "-n" "update" "-d" "-P")
(vc-exec-after
- `(vc-cvs-after-dir-status (quote ,update-function) ,status-buffer)))
+ `(vc-cvs-after-dir-status (quote ,update-function))))
(defun vc-cvs-get-entries (dir)
"Insert the CVS/Entries file from below DIR into the current buffer.