changeset 87477:b5060e79eb98

* vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed, and 'unregistered states. * vc-hooks.el (vc-state): Added 'removed state to documentation. * vc-hg (vc-hg-parse-status): Recognize 'added, 'removed, and 'up-to-date state. Deal with the possibility that C for clean might change to "=" in the next point release. * vc-git.el (vc-git-parse-status): Recognize 'removed. * vc.el (header comment): Better description of new dir-state. (vc-compatible-state): Defines which states are mutually compatible; usable with 'edited as a test for which can be committed on. (vc-dired-hook): Turn off undo in the VC-Dired buffer, a speed tweak. (vc-default-dired-state-info): Display 'removed state. * vc-bzr.el (vc-bzr-dir-state): Recognize 'added.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Sat, 29 Dec 2007 13:20:49 +0000
parents 6455e422c87c
children 585596662817
files lisp/ChangeLog lisp/vc-bzr.el lisp/vc-git.el lisp/vc-hg.el lisp/vc-hooks.el lisp/vc-svn.el lisp/vc.el
diffstat 7 files changed, 63 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Dec 29 12:59:09 2007 +0000
+++ b/lisp/ChangeLog	Sat Dec 29 13:20:49 2007 +0000
@@ -1,3 +1,23 @@
+2007-12-29  Eric S. Raymond  <esr@snark.thyrsus.com>
+
+	* vc-svn.el (vc-svn-parse-status): Recognize 'unregistered,
+	'added, 'removed.
+
+	* vc.el (header coment): Better description of dir-state.
+	(vc-compatible-state): New function.  Checks whether two states
+	can be in the same changeset; used with 'edited it can test whether
+	the next action for a state should be commit.
+	(vc-default-dired-format0info): Display 'added state.
+	(vc-dired-hook): Turn off undo, this is a speed tweak.
+
+	* vc-bzr.el (vc-bzr-dir-state): Recognize 'added.
+
+	* vc-hg.el (vc-bzr-hg-state): Recognize 'added and 'removed.
+	Cope with the possibility that the 'C' status flag might change
+	in 0.9,6.
+
+	* vc-git.el (vc-bzr-dir-state): Recognize 'removed.
+
 2007-12-29  Thien-Thi Nguyen  <ttn@gnuvola.org>
 
 	* files.el (cd-absolute): Fix omission bug:
--- a/lisp/vc-bzr.el	Sat Dec 29 12:59:09 2007 +0000
+++ b/lisp/vc-bzr.el	Sat Dec 29 13:20:49 2007 +0000
@@ -522,7 +522,7 @@
         (setq at-start nil)
         (cond 
          ((looking-at "^added") 
-          (setq current-vc-state 'edited)
+          (setq current-vc-state 'added)
           (setq current-bzr-state 'added))
          ((looking-at "^kind changed") 
           (setq current-vc-state 'edited)
--- a/lisp/vc-git.el	Sat Dec 29 12:59:09 2007 +0000
+++ b/lisp/vc-git.el	Sat Dec 29 13:20:49 2007 +0000
@@ -168,19 +168,20 @@
                                                (line-end-position))))
 	(cond
 	 ;; The rest of the possible states in "git ls-files -t" output:
-         ;;      R              removed/deleted
 	 ;;      K              to be killed
 	 ;; should not show up in vc-dired, so don't deal with them
 	 ;; here.
 	 ((eq status-char ?H)
 	  (vc-file-setprop file 'vc-state 'up-to-date))
+	 ((eq status-char ?R)
+	  (vc-file-setprop file 'vc-state 'removed))
 	 ((eq status-char ?M)
 	  (vc-file-setprop file 'vc-state 'edited))
 	 ((eq status-char ?C)
 	  (vc-file-setprop file 'vc-state 'edited))
 	 ((eq status-char ??)
 	  (vc-file-setprop file 'vc-backend 'none)
-	  (vc-file-setprop file 'vc-state 'nil)))
+	  (vc-file-setprop file 'vc-state nil)))
 	(forward-line)))))
 
 (defun vc-git-working-revision (file)
--- a/lisp/vc-hg.el	Sat Dec 29 12:59:09 2007 +0000
+++ b/lisp/vc-hg.el	Sat Dec 29 13:20:49 2007 +0000
@@ -194,8 +194,8 @@
 	       (buffer-substring-no-properties (+ (point) 2) 
 					       (line-end-position))))
 	(cond
+	 ;; State flag for a clean file is now C, might change to =.
 	 ;; The rest of the possible states in "hg status" output:
-	 ;; 	 R = removed
 	 ;; 	 ! = deleted, but still tracked
 	 ;; should not show up in vc-dired, so don't deal with them
 	 ;; here.
@@ -203,14 +203,20 @@
  	  (vc-file-setprop file 'vc-state 'up-to-date))
 	 ((eq status-char ?A)
 	  (vc-file-setprop file 'vc-working-revision "0")
-	  (vc-file-setprop file 'vc-state 'edited))
+	  (vc-file-setprop file 'vc-state 'added))
+	 ((eq status-char ?R)
+	  (vc-file-setprop file 'vc-state 'removed))
 	 ((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 'unregistered)))
+	  (vc-file-setprop file 'vc-state 'unregistered))
+	 ((eq status-char ?!)
+	  nil)
+	 (t	;; Presently C, might change to = in 0.9.6
+	  (vc-file-setprop file 'vc-state 'up-to-date)))
 	(forward-line)))))
 
 (defun vc-hg-working-revision (file)
--- a/lisp/vc-hooks.el	Sat Dec 29 12:59:09 2007 +0000
+++ b/lisp/vc-hooks.el	Sat Dec 29 13:20:49 2007 +0000
@@ -503,14 +503,16 @@
                      Often represented by vc-working-revision = \"0\" in VCSes
                      with monotonic IDs like Subversion and Mercurial.
 
-   'ignored          The file showed up in a dir-state listing with a flag 
+  'removed           Scheduled to be deleted from the repository on next commit.
+ 
+  '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 
+  '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 
--- a/lisp/vc-svn.el	Sat Dec 29 12:59:09 2007 +0000
+++ b/lisp/vc-svn.el	Sat Dec 29 13:20:49 2007 +0000
@@ -543,15 +543,16 @@
   (let (file status)
     (goto-char (point-min))
     (while (re-search-forward
-            ;; Ignore the files with status in [IX?].
-	    "^[ ACDGMR!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t)
+            ;; Ignore the files with status X.
+	    "^[ ACDGIMR!?~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t)
       ;; If the username contains spaces, the output format is ambiguous,
       ;; so don't trust the output's filename unless we have to.
       (setq file (or filename
                      (expand-file-name
                       (buffer-substring (point) (line-end-position)))))
       (setq status (char-after (line-beginning-position)))
-      (unless (eq status ??)
+      (if (eq status ??)
+	  (vc-file-setprop file 'vc-state 'unregistered)
 	;; `vc-BACKEND-registered' must not set vc-backend,
 	;; which is instead set in vc-registered.
 	(unless filename (vc-file-setprop file 'vc-backend 'SVN))
@@ -573,15 +574,15 @@
 	   ;; If the file was actually copied, (match-string 2) is "-".
 	   (vc-file-setprop file 'vc-working-revision "0")
 	   (vc-file-setprop file 'vc-checkout-time 0)
-	   'edited)
+	   'added)
 	  ((memq status '(?M ?C))
 	   (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))
+	  ((eq status ?R)
+	   (vc-file-setprop file 'vc-state 'removed))
 	  (t 'edited)))))
     (if filename (vc-file-getprop filename 'vc-state))))
 
--- a/lisp/vc.el	Sat Dec 29 12:59:09 2007 +0000
+++ b/lisp/vc.el	Sat Dec 29 13:20:49 2007 +0000
@@ -159,12 +159,13 @@
 ;;
 ;; - dir-state (dir)
 ;;
-;;   If provided, this function is used to find the version control state
-;;   of all files in DIR, and all subdirecties of DIR, in a fast way.  
-;;   The function should not return anything, but rather store the files' 
-;;   states into the corresponding `vc-state' properties.  (Note: in
-;;   older versions this method was not required to recurse into 
-;;   subdirectories.)
+;;   If provided, this function is used to find the version control
+;;   state of as many files as possible in DIR, and all subdirecties
+;;   of DIR, in a fast way; it is used to avoid expensive indivitual
+;;   vc-state calls.  The function should not return anything, but
+;;   rather store the files' states into the corresponding `vc-state'
+;;   properties.  (Note: in older versions this method was not
+;;   required to recurse into subdirectories.)
 ;;
 ;; * working-revision (file)
 ;;
@@ -1346,6 +1347,12 @@
 
 (defvar vc-dired-window-configuration)
 
+(defun vc-compatible-state (p q)
+  "Controls which states can be in the same commit."
+  (or
+   (eq p q)
+   (and (member p '(edited added removed)) (member q '(edited added removed)))))
+
 ;; Here's the major entry point.
 
 ;;;###autoload
@@ -1386,7 +1393,7 @@
 	 revision)
     ;; Verify that the fileset is homogenous
     (dolist (file (cdr files))
-      (if (not (eq (vc-state file) state))
+      (if (not (vc-compatible-state (vc-state file) state))
 	  (error "Fileset is in a mixed-up state"))
       (if (not (eq (vc-checkout-model file) model))
 	  (error "Fileset has mixed checkout models")))
@@ -1436,7 +1443,7 @@
         ;; do nothing
         (message "Fileset is up-to-date"))))
      ;; Files have local changes
-     ((eq state 'edited)
+     ((vc-compatible-state state 'edited)
       (let ((ready-for-commit files))
 	;; If files are edited but read-only, give user a chance to correct
 	(dolist (file files)
@@ -2349,7 +2356,9 @@
     (if (and (vc-call-backend backend 'responsible-p default-directory)
 	     (vc-find-backend-function backend 'dir-state))
 	(vc-call-backend backend 'dir-state default-directory)))
-  (let (filename (inhibit-read-only t))
+  (let (filename 
+	(inhibit-read-only t)
+	(buffer-undo-list t))
     (goto-char (point-min))
     (while (not (eobp))
       (cond
@@ -3076,6 +3085,7 @@
 	  ((eq state 'needs-merge) "(merge)")
 	  ((eq state 'needs-patch) "(patch)")
 	  ((eq state 'added) "(added)")
+	  ((eq state 'removed) "(removed)")
           ((eq state 'ignored) "(ignored)")     ;; dired-hook filters this out
           ((eq state 'unregistered) "?")
 	  ((eq state 'unlocked-changes) "(stale)")