+2008-05-01 Eric S. Raymond <esr@snark.thyrsus.com>
+
+ * vc-bzr.el (vc-bzr-state): Allow this to return 'ignored
+ when appropriate.
+ * vc-sccs.el (vc-sccs-state): Call vc-sccs-unregistered so
+ we report the 'unregistered state reliably.
+ * vc-rcs.el (vc-rcs-state): Call vc-rcs-unregistered so
+ we report the 'unregistered state reliably.
+ * vc-git.el (vc-git-state): Call vc-git-unregistered so
+ we report the 'unregistered state reliably.
+ * vc-hooks (vc-state): Document that vc-unregistered is
+ now expected to be returned reliably.
+ * vc.el (vc-default-dired-state): Change needs-patch state to
+ needs-update, since the name now shows up in dir-status listings
+ and was somewhat misleading.
+
2008-05-01 Sam Steingold <sds@gnu.org>
* vc.el (vc-delete-file): Check if the file has uncommitted changed.
(setq rev (replace-match (cdr rule) t nil rev))))
(format "Arch%c%s"
(case (vc-state file)
- ((up-to-date needs-patch) ?-)
+ ((up-to-date needs-update) ?-)
(added ?@)
(t ?:))
rev)))
(renamed . edited)
(modified . edited)
(removed . removed)
- (ignored . unregistered)
+ (ignored . ignored)
(unknown . unregistered)
(unchanged . up-to-date)))))))
((string-match "Locally Modified" status) 'edited)
((string-match "Needs Merge" status) 'needs-merge)
((string-match "Needs \\(Checkout\\|Patch\\)" status)
- (if missing 'missing 'needs-patch))
+ (if missing 'missing 'needs-update))
((string-match "Locally Added" status) 'added)
((string-match "Locally Removed" status) 'removed)
((string-match "File had conflicts " status) 'conflict)
((string-match "Locally Modified" status-str) 'edited)
((string-match "Needs Merge" status-str) 'needs-merge)
((string-match "Needs \\(Checkout\\|Patch\\)" status-str)
- (if missing 'missing 'needs-patch))
+ (if missing 'missing 'needs-update))
((string-match "Locally Added" status-str) 'added)
((string-match "Locally Removed" status-str) 'removed)
((string-match "File had conflicts " status-str) 'conflict)
;; (?M . edited)
;; (?P . needs-merge)
;; (?R . removed)
- ;; (?U . needs-patch))))
+ ;; (?U . needs-update))))
;; (goto-char (point-min))
;; (while (not (eobp))
;; (if (looking-at "^[ACMPRU?] \\(.*\\)$")
(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\\} \\([ADMUT]\\)\0[^\0]+\0"
- diff))
- (vc-git--state-code (match-string 1 diff))
- (if (vc-git--empty-db-p) 'added 'up-to-date))))
+ (if (not (vc-git-registered file))
+ 'unregistered
+ (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\\} \\([ADMUT]\\)\0[^\0]+\0"
+ diff))
+ (vc-git--state-code (match-string 1 diff))
+ (if (vc-git--empty-db-p) 'added 'up-to-date)))))
(defun vc-git--ls-files-state (state &rest args)
"Set state to STATE on all files found with git-ls-files ARGS."
USER The current version of the working file is locked by
some other USER (a string).
- 'needs-patch The file has not been edited by the user, but there is
+ 'needs-update The file has not been edited by the user, but there is
a more recent version on the current branch stored
in the master file.
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.
+ 'unregistered The file is not under version control.
A return of nil from this function means we have no information on the
status of this file.
(rev (vc-working-revision file)))
(propertize
(cond ((or (eq state 'up-to-date)
- (eq state 'needs-patch))
+ (eq state 'needs-update))
(setq state-echo "Up to date file")
(concat backend "-" rev))
((stringp state)
(t
;; Not just for the 'edited state, but also a fallback
;; for all other states. Think about different symbols
- ;; for 'needs-patch and 'needs-merge.
+ ;; for 'needs-update and 'needs-merge.
(setq state-echo "Locally modified file")
(concat backend ":" rev)))
'help-echo (concat state-echo " under the " backend
(setq branch (replace-match (cdr rule) t nil branch))))
(format "Mtn%c%s"
(case (vc-state file)
- ((up-to-date needs-patch) ?-)
+ ((up-to-date needs-update) ?-)
(added ?@)
(t ?:))
branch)))
(defun vc-rcs-state (file)
"Implementation of `vc-state' for RCS."
- (or (boundp 'vc-rcs-headers-result)
- (and vc-consult-headers
- (vc-rcs-consult-headers file)))
- (let ((state
- ;; vc-working-revision might not be known; in that case the
- ;; property is nil. vc-rcs-fetch-master-state knows how to
- ;; handle that.
- (vc-rcs-fetch-master-state file
- (vc-file-getprop file
- 'vc-working-revision))))
- (if (not (eq state 'up-to-date))
- state
- (if (vc-workfile-unchanged-p file)
- 'up-to-date
- (if (eq (vc-rcs-checkout-model file) 'locking)
- 'unlocked-changes
- 'edited)))))
+ (if (not (vc-rc-registered f))
+ 'unregistered
+ (or (boundp 'vc-rcs-headers-result)
+ (and vc-consult-headers
+ (vc-rcs-consult-headers file)))
+ (let ((state
+ ;; vc-working-revision might not be known; in that case the
+ ;; property is nil. vc-rcs-fetch-master-state knows how to
+ ;; handle that.
+ (vc-rcs-fetch-master-state file
+ (vc-file-getprop file
+ 'vc-working-revision))))
+ (if (not (eq state 'up-to-date))
+ state
+ (if (vc-workfile-unchanged-p file)
+ 'up-to-date
+ (if (eq (vc-rcs-checkout-model file) 'locking)
+ 'unlocked-changes
+ 'edited))))))
(defun vc-rcs-state-heuristic (file)
"State heuristic for RCS."
;; workfile version is latest on branch
'up-to-date
;; workfile version is not latest on branch
- 'needs-patch))
+ 'needs-update))
;; locked by the calling user
((and (stringp locking-user)
(string= locking-user (vc-user-login-name file)))
(defun vc-sccs-state (file)
"SCCS-specific function to compute the version control state."
- (with-temp-buffer
- (if (vc-insert-file (vc-sccs-lock-file file))
- (let* ((locks (vc-sccs-parse-locks))
- (working-revision (vc-working-revision file))
- (locking-user (cdr (assoc working-revision locks))))
- (if (not locking-user)
- (if (vc-workfile-unchanged-p file)
- 'up-to-date
- 'unlocked-changes)
- (if (string= locking-user (vc-user-login-name file))
- 'edited
- locking-user)))
- 'up-to-date)))
+ (if (not (vc-sccs-registered file))
+ 'unregistered
+ (with-temp-buffer
+ (if (vc-insert-file (vc-sccs-lock-file file))
+ (let* ((locks (vc-sccs-parse-locks))
+ (working-revision (vc-working-revision file))
+ (locking-user (cdr (assoc working-revision locks))))
+ (if (not locking-user)
+ (if (vc-workfile-unchanged-p file)
+ 'up-to-date
+ 'unlocked-changes)
+ (if (string= locking-user (vc-user-login-name file))
+ 'edited
+ locking-user)))
+ 'up-to-date))))
(defun vc-sccs-state-heuristic (file)
"SCCS-specific state heuristic."
(cond
((eq status ?\ )
(if (eq (char-after (match-beginning 1)) ?*)
- 'needs-patch
+ 'needs-update
(vc-file-setprop file 'vc-checkout-time
(nth 5 (file-attributes file)))
'up-to-date))
;; possible values, see `vc-state'. This function should do a full and
;; reliable state computation; it is usually called immediately after
;; C-x v v. If you want to use a faster heuristic when visiting a
-;; file, put that into `state-heuristic' below.
+;; file, put that into `state-heuristic' below. Note that under most
+;; VCSes this won't be called at all, dir-state or dir-stus is used instead.
;;
;; - state-heuristic (file)
;;
;; - make it easier to write logs. Maybe C-x 4 a should add to the log
;; buffer, if one is present, instead of adding to the ChangeLog.
;;
-;; - make vc-state for all backends return 'unregistered instead of
-;; nil for unregistered files, then update vc-next-action.
-;;
-;; - vc-default-registered should return 'unregistered not nil for
-;; unregistered files.
-;;
;; - vc-register should register a fileset at a time. The backends
;; already support this, only the front-end needs to be changed to
;; handle multiple files at a time.
;; Do the right thing
(cond
;; Files aren't registered
- ((or (not state) ;; RCS uses nil for unregistered files.
- (eq state 'unregistered)
+ ((or (eq state 'unregistered)
(eq state 'ignored))
(mapc 'vc-register files))
;; Files are up-to-date, or need a merge and user specified a revision
- ((or (eq state 'up-to-date) (and verbose (eq state 'needs-patch)))
+ ((or (eq state 'up-to-date) (and verbose (eq state 'needs-update)))
(cond
(verbose
;; go to a different revision
;; conflict
((eq state 'conflict)
(vc-mark-resolved files))
- ;; needs-patch
- ((eq state 'needs-patch)
+ ;; needs-update
+ ((eq state 'needs-update)
(dolist (file files)
(if (yes-or-no-p (format
"%s is not up-to-date. Get latest revision? "
"Revert to checked-in revision, instead? "))
(error "Checkout aborted")
(vc-revert-buffer-internal t t)
- (vc-checkout file t))))))))
+ (vc-checkout file t)))))
+ ;; Unknown fileset state
+ (t
+ (error "Fileset is in an unknown state %s" state)))))
(defun vc-create-repo (backend)
"Create an empty repository in the current directory."
(not writable))
(if (vc-call latest-on-branch-p file)
'up-to-date
- 'needs-patch)
+ 'needs-update)
'edited))
(vc-checkout-time . ,(nth 5 (file-attributes file))))))
(vc-resynch-buffer file t t)
((stringp state) (concat "(" state ")"))
((eq state 'edited) "(modified)")
((eq state 'needs-merge) "(merge)")
- ((eq state 'needs-patch) "(patch)")
+ ((eq state 'needs-update) "(update)")
((eq state 'added) "(added)")
((eq state 'removed) "(removed)")
((eq state 'ignored) "(ignored)") ;; dired-hook filters this out