* vc-p4.el (vc-p4-state): Avoid error when saving non-Perforce

file inside Perforce working directory.  Still gives incorrect
'up-to-date' status in vc-dir sometimes.

[git-p4: depot-paths = "//guest/Ben_Key/vc-p4/,//guest/jonathan_kamens/vc-p4/,//guest/magnus_henoch/vc-p4/": change = 7377]
This commit is contained in:
Magnus Henoch 2009-09-09 06:16:58 -08:00
parent d4562f9ba7
commit 2d9b785e7c

View file

@ -126,42 +126,44 @@ previously fetched. If DONT-COMPARE-NONOPENED is non-nil, don't
compare non-open files to the depot version." compare non-open files to the depot version."
(if (and (not force) (vc-file-getprop file 'vc-p4-did-fstat)) (if (and (not force) (vc-file-getprop file 'vc-p4-did-fstat))
(vc-file-getprop file 'vc-state) (vc-file-getprop file 'vc-state)
(let* ( (let ((alist (or fstat-list (p4-lowlevel-fstat file nil t))))
(alist (or fstat-list (p4-lowlevel-fstat file nil))) (if (null alist)
(headRev (cdr (assoc "headRev" alist))) 'unregistered
(haveRev (cdr (assoc "haveRev" alist))) (let* (
(depotFile (cdr (assoc "depotFile" alist))) (headRev (cdr (assoc "headRev" alist)))
(action (cdr (assoc "action" alist))) (haveRev (cdr (assoc "haveRev" alist)))
(headAction (cdr (assoc "headAction" alist))) (depotFile (cdr (assoc "depotFile" alist)))
(state (action (cdr (assoc "action" alist)))
(cond (headAction (cdr (assoc "headAction" alist)))
(action (state
(let ((opened (p4-lowlevel-opened file))) (cond
(if (string-match " by \\([^@]+\\)@" opened) (action
(match-string 1 opened) (let ((opened (p4-lowlevel-opened file)))
(if (equal headRev haveRev) (if (string-match " by \\([^@]+\\)@" opened)
'edited (match-string 1 opened)
'needs-merge)))) (if (equal headRev haveRev)
((and (not dont-compare-nonopened) 'edited
(p4-lowlevel-diff-s file "e")) 'needs-merge))))
'unlocked-changes) ((and (not dont-compare-nonopened)
((or (p4-lowlevel-diff-s file "e"))
(equal headRev haveRev) 'unlocked-changes)
(and (null haveRev) (string= headAction "delete"))) ((or
'up-to-date) (equal headRev haveRev)
(t (and (null haveRev) (string= headAction "delete")))
'needs-patch))) 'up-to-date)
) (t
(vc-file-setprop file 'vc-p4-did-fstat t) 'needs-patch)))
(vc-file-setprop file 'vc-p4-depot-file depotFile) )
(vc-file-setprop file 'vc-p4-action action) (vc-file-setprop file 'vc-p4-did-fstat t)
(vc-file-setprop file 'vc-backend 'P4) (vc-file-setprop file 'vc-p4-depot-file depotFile)
(vc-file-setprop file 'vc-checkout-model 'announce) (vc-file-setprop file 'vc-p4-action action)
(vc-file-setprop file 'vc-latest-version headRev) (vc-file-setprop file 'vc-backend 'P4)
(vc-file-setprop file 'vc-name file) (vc-file-setprop file 'vc-checkout-model 'announce)
(vc-file-setprop file 'vc-state state) (vc-file-setprop file 'vc-latest-version headRev)
(vc-file-setprop file 'vc-workfile-version haveRev) (vc-file-setprop file 'vc-name file)
state))) (vc-file-setprop file 'vc-state state)
(vc-file-setprop file 'vc-workfile-version haveRev)
state)))))
(defun vc-p4-dir-status (dir update-function) (defun vc-p4-dir-status (dir update-function)
"Find information for `vc-dir'." "Find information for `vc-dir'."