* 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."
(if (and (not force) (vc-file-getprop file 'vc-p4-did-fstat))
(vc-file-getprop file 'vc-state)
(let* (
(alist (or fstat-list (p4-lowlevel-fstat file nil)))
(headRev (cdr (assoc "headRev" alist)))
(haveRev (cdr (assoc "haveRev" alist)))
(depotFile (cdr (assoc "depotFile" alist)))
(action (cdr (assoc "action" alist)))
(headAction (cdr (assoc "headAction" alist)))
(state
(cond
(action
(let ((opened (p4-lowlevel-opened file)))
(if (string-match " by \\([^@]+\\)@" opened)
(match-string 1 opened)
(if (equal headRev haveRev)
'edited
'needs-merge))))
((and (not dont-compare-nonopened)
(p4-lowlevel-diff-s file "e"))
'unlocked-changes)
((or
(equal headRev haveRev)
(and (null haveRev) (string= headAction "delete")))
'up-to-date)
(t
'needs-patch)))
)
(vc-file-setprop file 'vc-p4-did-fstat t)
(vc-file-setprop file 'vc-p4-depot-file depotFile)
(vc-file-setprop file 'vc-p4-action action)
(vc-file-setprop file 'vc-backend 'P4)
(vc-file-setprop file 'vc-checkout-model 'announce)
(vc-file-setprop file 'vc-latest-version headRev)
(vc-file-setprop file 'vc-name file)
(vc-file-setprop file 'vc-state state)
(vc-file-setprop file 'vc-workfile-version haveRev)
state)))
(let ((alist (or fstat-list (p4-lowlevel-fstat file nil t))))
(if (null alist)
'unregistered
(let* (
(headRev (cdr (assoc "headRev" alist)))
(haveRev (cdr (assoc "haveRev" alist)))
(depotFile (cdr (assoc "depotFile" alist)))
(action (cdr (assoc "action" alist)))
(headAction (cdr (assoc "headAction" alist)))
(state
(cond
(action
(let ((opened (p4-lowlevel-opened file)))
(if (string-match " by \\([^@]+\\)@" opened)
(match-string 1 opened)
(if (equal headRev haveRev)
'edited
'needs-merge))))
((and (not dont-compare-nonopened)
(p4-lowlevel-diff-s file "e"))
'unlocked-changes)
((or
(equal headRev haveRev)
(and (null haveRev) (string= headAction "delete")))
'up-to-date)
(t
'needs-patch)))
)
(vc-file-setprop file 'vc-p4-did-fstat t)
(vc-file-setprop file 'vc-p4-depot-file depotFile)
(vc-file-setprop file 'vc-p4-action action)
(vc-file-setprop file 'vc-backend 'P4)
(vc-file-setprop file 'vc-checkout-model 'announce)
(vc-file-setprop file 'vc-latest-version headRev)
(vc-file-setprop file 'vc-name file)
(vc-file-setprop file 'vc-state state)
(vc-file-setprop file 'vc-workfile-version haveRev)
state)))))
(defun vc-p4-dir-status (dir update-function)
"Find information for `vc-dir'."