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>
((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
(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)
(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")
(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)
'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)
(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))))
((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