changeset 87450:71fc7b1db920

* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered states. and the new return-value convention. These are not actually used yet, just set. * vc-svn.el (vc-svn-parse-status): Set 'ignored and 'unregistered states when appropriate. * vc-hg.el (vc-hg-state,vc-hg-dir-state): Set 'ignored and 'unregistered' when appropriate. * vc-git.el: Document that we don't set the new states yet. * vc.el (vc-dired-state-info): Display 'unregistered and 'ignored states. * vc-cvs.el (vc-cvs-parse-status): Set the 'ignored state when appropriate. * vc-bzr.el (vc-bzr-dir-state): Set 'ignored and 'unregistered' when appropriate.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Fri, 28 Dec 2007 18:16:55 +0000
parents 7477a697d7e1
children 92e4dcb3c37b
files lisp/ChangeLog lisp/vc-bzr.el lisp/vc-cvs.el lisp/vc-git.el lisp/vc-hg.el lisp/vc-hooks.el lisp/vc-svn.el lisp/vc.el
diffstat 8 files changed, 73 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Dec 28 16:24:31 2007 +0000
+++ b/lisp/ChangeLog	Fri Dec 28 18:16:55 2007 +0000
@@ -17,7 +17,30 @@
 	can get extremely large.
 
 	* vc-cvs.el, vc-svn.el: Simplify backend dired-state-info
-	functions so they don't do work that the default one can do instead
+	functions so they don't do work that the default one can do
+	instead.  Also, give the default useful behavior on 'added.
+
+	* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
+	states. and the new return-value convention.  These are not
+	actually used yet, just set.
+
+	* vc-svn.el (vc-svn-parse-status): Set 'ignored and 'unregistered
+	states when appropriate.
+
+	* vc-hg.el (vc-hg-state,vc-hg-dir-state): Set 'ignored and
+	'unregistered' when appropriate.
+
+	* vc-git.el: Document that we don't set the new states yet.
+
+	* vc.el (vc-dired-state-info): Display 'unregistered and
+	'ignored states.
+
+	* vc-cvs.el (vc-cvs-parse-status): Set the 'ignored state when
+	appropriate.
+
+	* vc-bzr.el (vc-bzr-dir-state): Set 'ignored and
+	'unregistered' when appropriate.
+
 
 2007-12-28  Nick Roberts  <nickrob@snap.net.nz>
 
--- a/lisp/vc-bzr.el	Fri Dec 28 16:24:31 2007 +0000
+++ b/lisp/vc-bzr.el	Fri Dec 28 18:16:55 2007 +0000
@@ -533,8 +533,11 @@
          ((looking-at "^renamed") 
           (setq current-vc-state 'edited)
           (setq current-bzr-state 'renamed))
-         ((looking-at "^\\(unknown\\|ignored\\)")
-          (setq current-vc-state nil)
+         ((looking-at "^ignored")
+          (setq current-vc-state 'ignored)
+          (setq current-bzr-state 'not-versioned))
+         ((looking-at "^unknown")
+          (setq current-vc-state 'unregistered)
           (setq current-bzr-state 'not-versioned))
          ((looking-at "  ")
           ;; file names are indented by two spaces
--- a/lisp/vc-cvs.el	Fri Dec 28 16:24:31 2007 +0000
+++ b/lisp/vc-cvs.el	Fri Dec 28 18:16:55 2007 +0000
@@ -818,9 +818,14 @@
 (defun vc-cvs-parse-status (&optional full)
   "Parse output of \"cvs status\" command in the current buffer.
 Set file properties accordingly.  Unless FULL is t, parse only
-essential information."
+essential information. Note that this can never set the 'ignored
+state."
   (let (file status)
     (goto-char (point-min))
+    (while (looking-at "? \\(.*\\)")
+      (setq file (expand-file-name (match-string 1)))
+      (vc-file-setprop file 'vc-state 'unregistered)
+      (forward-line 1))
     (if (re-search-forward "^File: " nil t)
         (cond
          ((looking-at "no file") nil)
--- a/lisp/vc-git.el	Fri Dec 28 16:24:31 2007 +0000
+++ b/lisp/vc-git.el	Fri Dec 28 18:16:55 2007 +0000
@@ -143,6 +143,7 @@
 
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
+  ;; FIXME: This can't set 'ignored yet
   (vc-git--call nil "add" "--refresh" "--" (file-relative-name file))
   (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--")))
     (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} [ADMU]\0[^\0]+\0"
@@ -151,6 +152,8 @@
       'up-to-date)))
 
 (defun vc-git-dir-state (dir)
+  "Git-specific version of `dir-state'."
+  ;; FIXME: This can't set 'ignored yet
   (with-temp-buffer
     (buffer-disable-undo)		;; Because these buffers can get huge
     (vc-git-command (current-buffer) nil nil "ls-files" "-t" "-c" "-m" "-o")
--- a/lisp/vc-hg.el	Fri Dec 28 16:24:31 2007 +0000
+++ b/lisp/vc-hg.el	Fri Dec 28 18:16:55 2007 +0000
@@ -173,8 +173,9 @@
 	    (cond
 	     ((eq state ?A) 'edited)
 	     ((eq state ?M) 'edited)
-	     ((eq state ?R) nil)
-	     ((eq state ??) nil)
+	     ((eq state ?I) 'ignored)
+	     ((eq state ?R) 'unregistered)
+	     ((eq state ??) 'unregistered)
 	     (t 'up-to-date))))))))
 
 (defun vc-hg-dir-state (dir)
@@ -194,7 +195,6 @@
 	 ;; The rest of the possible states in "hg status" output:
 	 ;; 	 R = removed
 	 ;; 	 ! = deleted, but still tracked
-	 ;; 	 ? = not tracked
 	 ;; should not show up in vc-dired, so don't deal with them
 	 ;; here.
 	 ((eq status-char ?A)
@@ -202,9 +202,11 @@
 	  (vc-file-setprop file 'vc-state 'edited))
 	 ((eq status-char ?M)
 	  (vc-file-setprop file 'vc-state 'edited))
+	 ((eq status-char ?I)
+	  (vc-file-setprop file 'vc-state 'ignored))
 	 ((eq status-char ??)
 	  (vc-file-setprop file 'vc-backend 'none)
-	  (vc-file-setprop file 'vc-state 'nil)))
+	  (vc-file-setprop file 'vc-state 'unregistered)))
 	(forward-line)))))
 
 (defun vc-hg-working-revision (file)
--- a/lisp/vc-hooks.el	Fri Dec 28 16:24:31 2007 +0000
+++ b/lisp/vc-hooks.el	Fri Dec 28 18:16:55 2007 +0000
@@ -501,7 +501,27 @@
 
   'added             Scheduled to go into the repository on the next commit.
                      Often represented by vc-working-revision = \"0\" in VCSes
-                     with monotonic IDs like Subversion and Mercxurial."
+                     with monotonic IDs like Subversion and Mercurial.
+
+   'ignored          The file showed up in a dir-state listing with a flag 
+                     indicating the version-control system is ignoring it,
+                     Note: This property is not set reliably (some VCSes 
+                     don't have useful directory-status commands) so assume 
+                     that any file with vc-state nil might be ignorable
+                     without VC knowing it. 
+
+   'unregistered     The file showed up in a dir-state listing with a flag 
+                     indicating that it is not under version control.
+                     Note: This property is not set reliably (some VCSes 
+                     don't have useful directory-status commands) so assume 
+                     that any file with vc-state nil might be unregistered
+                     without VC knowing it. 
+
+A return of nil from this function means we have no information on the 
+status of this file.
+"
+  ;; Note: in Emacs 22 and older, return of nil meant the file was unregistered.
+  ;; This is potentially a source of backward-compatibility bugs.
 
   ;; FIXME: New (sub)states needed (?):
   ;; - `conflict' (i.e. `edited' with conflict markers)
--- a/lisp/vc-svn.el	Fri Dec 28 16:24:31 2007 +0000
+++ b/lisp/vc-svn.el	Fri Dec 28 18:16:55 2007 +0000
@@ -578,6 +578,10 @@
 	   (if (eq (char-after (match-beginning 1)) ?*)
 	       'needs-merge
 	     'edited))
+	  ((eq status ?I)
+	   (vc-file-setprop file 'vc-state 'ignored))
+	  ((eq status ??)
+	   (vc-file-setprop file 'vc-state 'unregistered))
 	  (t 'edited)))))
     (if filename (vc-file-getprop filename 'vc-state))))
 
--- a/lisp/vc.el	Fri Dec 28 16:24:31 2007 +0000
+++ b/lisp/vc.el	Fri Dec 28 18:16:55 2007 +0000
@@ -3076,7 +3076,10 @@
 	  ((eq state 'needs-merge) "(merge)")
 	  ((eq state 'needs-patch) "(patch)")
 	  ((eq state 'added) "(added)")
-	  ((eq state 'unlocked-changes) "(stale)")))
+          ((eq state 'ignored) "(ignored)")     ;; dired-hook filters this out
+          ((eq state 'unregistered) "?")
+	  ((eq state 'unlocked-changes) "(stale)")
+	  ((not state) "(unknown)")))
 	(buffer
 	 (get-file-buffer file))
 	(modflag