* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
authorEric S. Raymond <esr@snark.thyrsus.com>
Fri, 28 Dec 2007 18:16:55 +0000 (18:16 +0000)
committerEric S. Raymond <esr@snark.thyrsus.com>
Fri, 28 Dec 2007 18:16:55 +0000 (18:16 +0000)
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.

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

index eefada1..b68e3de 100644 (file)
        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>
 
index c87424f..01599c9 100644 (file)
@@ -533,8 +533,11 @@ Optional argument LOCALP is always ignored."
          ((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
index 3728d72..c3aff66 100644 (file)
@@ -818,9 +818,14 @@ For an empty string, nil is returned (invalid CVS root)."
 (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)
index 722e352..7895251 100644 (file)
 
 (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"
       '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")
index 5c2cc35..592bcca 100644 (file)
            (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)
         ;; 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)
          (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)
index 3657878..3d589e1 100644 (file)
@@ -501,7 +501,27 @@ For registered files, the value returned is one of:
 
   '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)
index 7ce1634..ced4c94 100644 (file)
@@ -578,6 +578,10 @@ information about FILENAME and return its status."
           (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))))
 
index 373d0f5..5ec8725 100644 (file)
@@ -3076,7 +3076,10 @@ to provide the `find-revision' operation instead."
          ((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