* vc-p4.el (vc-p4-dir-status): Handle subdirectories. Use

information from vc-p4-state.
(vc-p4-state): New argument: dont-compare-nonopened.

[git-p4: depot-paths = "//guest/Ben_Key/vc-p4/,//guest/jonathan_kamens/vc-p4/,//guest/magnus_henoch/vc-p4/": change = 7236]
This commit is contained in:
Magnus Henoch 2009-05-27 09:54:01 -08:00
parent 5c078b4c12
commit eacbba72bc

View file

@ -245,12 +245,13 @@ specify a starting date when you run C-u C-x v g."
(vc-p4-state file fstat) (vc-p4-state file fstat)
t)))) t))))
(defun vc-p4-state (file &optional fstat-list force) (defun vc-p4-state (file &optional fstat-list force dont-compare-nonopened)
"Returns the current version control state of FILE in Perforce. If "Returns the current version control state of FILE in Perforce.
optional FSTAT-LIST is non-nil, use that list of attributes from If optional FSTAT-LIST is non-nil, use that list of attributes
p4-lowlevel-fstat instead of calling it. If optional FORCE is from p4-lowlevel-fstat instead of calling it. If optional FORCE
non-nil, refetch all properties even if properties were previously is non-nil, refetch all properties even if properties were
fetched." 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)) (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* (
@ -266,7 +267,8 @@ fetched."
(if (equal headRev haveRev) (if (equal headRev haveRev)
'edited 'edited
'needs-merge))) 'needs-merge)))
(if (p4-lowlevel-diff-s file "e") (if (and (not dont-compare-nonopened)
(p4-lowlevel-diff-s file "e"))
'unlocked-changes 'unlocked-changes
(if (equal headRev haveRev) (if (equal headRev haveRev)
'up-to-date 'up-to-date
@ -313,18 +315,18 @@ Perforce and sets the appropriate VC properties."
(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'."
;; XXX: this should be asynchronous. ;; XXX: this should be asynchronous.
(let ((lists (p4-lowlevel-fstat (format "%s/*" (expand-file-name dir)) nil t))) (let ((lists (p4-lowlevel-fstat
(format "%s/..." (directory-file-name (expand-file-name dir)))
nil t)))
(when (stringp (caar lists)) (when (stringp (caar lists))
(setq lists (list lists))) (setq lists (list lists)))
(dolist (this-list lists) (dolist (this-list lists)
(let ((this-file (cdr (assoc "clientFile" this-list))) (let* ((this-file (cdr (assoc "clientFile" this-list)))
(this-action (cdr (assoc "action" this-list)))) (state (vc-p4-state this-file this-list t t)))
(when this-action (funcall update-function
(funcall update-function (list
(list (list (file-relative-name this-file dir) state))
(list (file-relative-name this-file dir) t)))
(intern this-action)))
t))))
(funcall update-function nil nil))) (funcall update-function nil nil)))
(defun vc-p4-workfile-version (file) (defun vc-p4-workfile-version (file)