From 45b24b4de643475dc82737a89bf9d1c250ce3d9e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 21 Mar 2008 17:53:04 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 12 ++++++++++++ lisp/vc-cvs.el | 32 ++++++++++---------------------- lisp/vc-git.el | 8 -------- lisp/vc-hg.el | 13 ++----------- lisp/vc-hooks.el | 3 +++ lisp/vc-svn.el | 11 ----------- lisp/vc.el | 2 +- 7 files changed, 28 insertions(+), 53 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6c7a0c979f3..7967d04c0ea 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2008-03-21 Stefan Monnier + + * 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 * vc-git.el (vc-git-status-result): New variable. diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index cc63131945e..f75b3f4ebf5 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el @@ -207,9 +207,10 @@ See also variable `vc-cvs-sticky-date-format-string'." ;; 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 @@ Handle the special case of a CVS file that is added but not yet 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 @@ committed and support display of sticky tags." (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 @@ is non-nil." (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 "/[^/]+" diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 888d2aaddf2..8bbb16a62a0 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el @@ -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) diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el index 46617fe19ac..8e55eb20174 100644 --- a/lisp/vc-hg.el +++ b/lisp/vc-hg.el @@ -449,15 +449,6 @@ REV is the revision to check out into WORKFILE." (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 @@ REV is the revision to check out into WORKFILE." ;;; 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)) diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index e167492c089..cf17f9becb7 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el @@ -856,6 +856,9 @@ This function assumes that the file is registered." ((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 diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index c10aa65f930..c50434c4630 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el @@ -205,17 +205,6 @@ RESULT is a list of conses (FILE . STATE) for directory DIR." ;; 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) diff --git a/lisp/vc.el b/lisp/vc.el index be7516e6237..81d45870e64 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -3736,7 +3736,7 @@ to provide the `find-revision' operation instead." (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)") -- 2.39.2