changeset 93124:97c5b398eee4

* vc-hooks.el (vc-default-mode-line-string): Add case for added files. * vc.el (vc-default-dired-state-info): Use just "modified". * vc-cvs.el (vc-cvs-state-heuristic): Turn rev 0 into `added'. (vc-cvs-mode-line-string): Make use of the better default. (vc-cvs-parse-entry): Use the new `added'. (vc-cvs-dired-state-info): Remove. * vc-svn.el (vc-svn-dired-state-info): Remove. * vc-hg.el (vc-hg-dired-state-info): Remove. * vc-git.el (vc-git-dired-state-info): Remove.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 21 Mar 2008 17:53:04 +0000
parents 38f18130d057
children c10d57278d04
files lisp/ChangeLog lisp/vc-cvs.el lisp/vc-git.el lisp/vc-hg.el lisp/vc-hooks.el lisp/vc-svn.el lisp/vc.el
diffstat 7 files changed, 28 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Mar 21 06:29:04 2008 +0000
+++ b/lisp/ChangeLog	Fri Mar 21 17:53:04 2008 +0000
@@ -1,3 +1,15 @@
+2008-03-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-hooks.el (vc-default-mode-line-string): Add case for added files.
+	* vc.el (vc-default-dired-state-info): Use just "modified".
+	* vc-cvs.el (vc-cvs-state-heuristic): Turn rev 0 into `added'.
+	(vc-cvs-mode-line-string): Make use of the better default.
+	(vc-cvs-parse-entry): Use the new `added'.
+	(vc-cvs-dired-state-info): Remove.
+	* vc-svn.el (vc-svn-dired-state-info): Remove.
+	* vc-hg.el (vc-hg-dired-state-info): Remove.
+	* vc-git.el (vc-git-dired-state-info): Remove.
+
 2008-03-21  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* vc-git.el (vc-git-status-result): New variable.
--- a/lisp/vc-cvs.el	Fri Mar 21 06:29:04 2008 +0000
+++ b/lisp/vc-cvs.el	Fri Mar 21 17:53:04 2008 +0000
@@ -207,9 +207,10 @@
   ;; Otherwise consider it `edited'.
   (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
         (lastmod (nth 5 (file-attributes file))))
-    (if (equal checkout-time lastmod)
-        'up-to-date
-      'edited)))
+    (cond
+     ((equal checkout-time lastmod) 'up-to-date)
+     ((string= (vc-working-revision file) "0") 'added)
+     (t 'edited))))
 
 (defun vc-cvs-dir-state (dir)
   "Find the CVS state of all files in DIR and subdirectories."
@@ -261,16 +262,11 @@
 committed and support display of sticky tags."
   (let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag))
 	 help-echo
-	 (string 
-	  (if (string= (vc-working-revision file) "0")
-	      ;; A file that is added but not yet committed.
-	      (progn
-		(setq help-echo "Added file (needs commit) under CVS")
-		"CVS @@")
-	    (let ((def-ml (vc-default-mode-line-string 'CVS file)))
-	      (setq help-echo 
-		    (get-text-property 0 'help-echo def-ml))
-	      def-ml))))
+	 (string
+          (let ((def-ml (vc-default-mode-line-string 'CVS file)))
+            (setq help-echo 
+                  (get-text-property 0 'help-echo def-ml))
+            def-ml)))
     (propertize 
      (if (zerop (length sticky-tag))
 	 string
@@ -279,14 +275,6 @@
        (concat string "[" sticky-tag "]"))
      'help-echo help-echo)))
 
-(defun vc-cvs-dired-state-info (file)
-  "CVS-specific version of `vc-dired-state-info'."
-  (let ((cvs-state (vc-state file)))
-    (cond ((eq cvs-state 'edited)
-	   (if (equal (vc-working-revision file) "0")
-	       "(added)" "(modified)"))
-	  (t
-	   (vc-default-dired-state-info 'CVS file)))))
 
 ;;;
 ;;; State-changing functions
@@ -960,7 +948,7 @@
     (vc-file-setprop file 'vc-backend 'CVS)
     (vc-file-setprop file 'vc-checkout-time 0)
     (vc-file-setprop file 'vc-working-revision "0")
-    (if set-state (vc-file-setprop file 'vc-state 'edited)))
+    (if set-state (vc-file-setprop file 'vc-state 'added)))
    ;; normal entry
    ((looking-at
      (concat "/[^/]+"
--- a/lisp/vc-git.el	Fri Mar 21 06:29:04 2008 +0000
+++ b/lisp/vc-git.el	Fri Mar 21 17:53:04 2008 +0000
@@ -199,14 +199,6 @@
       (propertize def-ml
                   'help-echo (concat help-echo "\nCurrent branch: " branch)))))
 
-(defun vc-git-dired-state-info (file)
-  "Git-specific version of `vc-dired-state-info'."
-  (let ((git-state (vc-state file)))
-    (if (eq git-state 'edited)
-	"(modified)"
-      ;; fall back to the default VC representation
-      (vc-default-dired-state-info 'Git file))))
-
 ;; Variable used to keep the intermediate results for vc-git-status.
 (defvar vc-git-status-result nil)
 
--- a/lisp/vc-hg.el	Fri Mar 21 06:29:04 2008 +0000
+++ b/lisp/vc-hg.el	Fri Mar 21 17:53:04 2008 +0000
@@ -449,15 +449,6 @@
 (defun vc-hg-workfile-unchanged-p (file)
   (eq 'up-to-date (vc-hg-state file)))
 
-(defun vc-hg-dired-state-info (file)
-  "Hg-specific version of `vc-dired-state-info'."
-  (let ((hg-state (vc-state file)))
-    (if (eq hg-state 'edited)
-	(if (equal (vc-working-revision file) "0")
-	    "(added)" "(modified)")
-      ;; fall back to the default VC representation
-      (vc-default-dired-state-info 'Hg file))))
-
 ;; Modelled after the similar function in vc-bzr.el
 (defun vc-hg-revert (file &optional contents-done)
   (unless contents-done
@@ -465,8 +456,8 @@
 
 ;;; Hg specific functionality.
 
-;;; XXX This functionality is experimental/work in progress. It might
-;;; change without notice.
+;; XXX This functionality is experimental/work in progress. It might
+;; change without notice.
 (defvar vc-hg-extra-menu-map
   (let ((map (make-sparse-keymap)))
     (define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming))
--- a/lisp/vc-hooks.el	Fri Mar 21 06:29:04 2008 +0000
+++ b/lisp/vc-hooks.el	Fri Mar 21 17:53:04 2008 +0000
@@ -856,6 +856,9 @@
 	   ((stringp state)
 	    (setq state-echo (concat "File locked by" state))
 	    (concat backend ":" state ":" rev))
+           ((eq state 'added)
+            (setq state-echo "Locally added file")
+            (concat backend "@" rev))
 	   (t
 	    ;; Not just for the 'edited state, but also a fallback
 	    ;; for all other states.  Think about different symbols
--- a/lisp/vc-svn.el	Fri Mar 21 06:29:04 2008 +0000
+++ b/lisp/vc-svn.el	Fri Mar 21 17:53:04 2008 +0000
@@ -205,17 +205,6 @@
 ;; vc-svn-mode-line-string doesn't exist because the default implementation
 ;; works just fine.
 
-(defun vc-svn-dired-state-info (file)
-  "SVN-specific version of `vc-dired-state-info'."
-  (let ((svn-state (vc-state file)))
-    (cond ((eq svn-state 'edited)
-	   (if (equal (vc-working-revision file) "0")
-	       "(added)" "(modified)"))
-	  (t
-	   ;; fall back to the default VC representation
-	   (vc-default-dired-state-info 'SVN file)))))
-
-
 (defun vc-svn-previous-revision (file rev)
   (let ((newrev (1- (string-to-number rev))))
     (when (< 0 newrev)
--- a/lisp/vc.el	Fri Mar 21 06:29:04 2008 +0000
+++ b/lisp/vc.el	Fri Mar 21 17:53:04 2008 +0000
@@ -3736,7 +3736,7 @@
 	(statestring
 	 (cond
 	  ((stringp state) (concat "(" state ")"))
-	  ((eq state 'edited) (concat "(" (vc-user-login-name file) ")"))
+	  ((eq state 'edited) "(modified)")
 	  ((eq state 'needs-merge) "(merge)")
 	  ((eq state 'needs-patch) "(patch)")
 	  ((eq state 'added) "(added)")