From eacbba72bc48593faed2e9c2b6a2c8c810e9c750 Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Wed, 27 May 2009 09:54:01 -0800 Subject: [PATCH] * 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] --- vc-p4.el | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/vc-p4.el b/vc-p4.el index 00aa4d0..a94ed44 100644 --- a/vc-p4.el +++ b/vc-p4.el @@ -245,12 +245,13 @@ specify a starting date when you run C-u C-x v g." (vc-p4-state file fstat) t)))) -(defun vc-p4-state (file &optional fstat-list force) - "Returns the current version control state of FILE in Perforce. If -optional FSTAT-LIST is non-nil, use that list of attributes from -p4-lowlevel-fstat instead of calling it. If optional FORCE is -non-nil, refetch all properties even if properties were previously -fetched." +(defun vc-p4-state (file &optional fstat-list force dont-compare-nonopened) + "Returns the current version control state of FILE in Perforce. +If optional FSTAT-LIST is non-nil, use that list of attributes +from p4-lowlevel-fstat instead of calling it. If optional FORCE +is non-nil, refetch all properties even if properties were +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* ( @@ -266,7 +267,8 @@ fetched." (if (equal headRev haveRev) 'edited 'needs-merge))) - (if (p4-lowlevel-diff-s file "e") + (if (and (not dont-compare-nonopened) + (p4-lowlevel-diff-s file "e")) 'unlocked-changes (if (equal headRev haveRev) 'up-to-date @@ -313,18 +315,18 @@ Perforce and sets the appropriate VC properties." (defun vc-p4-dir-status (dir update-function) "Find information for `vc-dir'." ;; 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)) (setq lists (list lists))) (dolist (this-list lists) - (let ((this-file (cdr (assoc "clientFile" this-list))) - (this-action (cdr (assoc "action" this-list)))) - (when this-action - (funcall update-function - (list - (list (file-relative-name this-file dir) - (intern this-action))) - t)))) + (let* ((this-file (cdr (assoc "clientFile" this-list))) + (state (vc-p4-state this-file this-list t t))) + (funcall update-function + (list + (list (file-relative-name this-file dir) state)) + t))) (funcall update-function nil nil))) (defun vc-p4-workfile-version (file)