1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

Change 'needs-patch to 'needs-update.

This commit is contained in:
Eric S. Raymond 2008-05-01 19:13:16 +00:00
parent a84615c77a
commit 3702367bce
11 changed files with 82 additions and 68 deletions

View File

@ -1,3 +1,19 @@
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.

View File

@ -329,7 +329,7 @@ Return non-nil if FILE is unchanged."
(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)))

View File

@ -275,7 +275,7 @@ If any error occurred in running `bzr status', then return nil."
(renamed . edited)
(modified . edited)
(removed . removed)
(ignored . unregistered)
(ignored . ignored)
(unknown . unregistered)
(unchanged . up-to-date)))))))

View File

@ -838,7 +838,7 @@ state."
((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)
@ -903,7 +903,7 @@ state."
((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)
@ -922,7 +922,7 @@ state."
;; (?M . edited)
;; (?P . needs-merge)
;; (?R . removed)
;; (?U . needs-patch))))
;; (?U . needs-update))))
;; (goto-char (point-min))
;; (while (not (eobp))
;; (if (looking-at "^[ACMPRU?] \\(.*\\)$")

View File

@ -156,12 +156,14 @@
(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."

View File

@ -491,7 +491,7 @@ For registered files, the value returned is one of:
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.
@ -528,12 +528,7 @@ For registered files, the value returned is one of:
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.
@ -856,7 +851,7 @@ This function assumes that the file is registered."
(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)
@ -877,7 +872,7 @@ This function assumes that the file is registered."
(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

View File

@ -125,7 +125,7 @@
(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)))

View File

@ -118,23 +118,25 @@ For a description of possible values, see `vc-check-master-templates'."
(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."
@ -889,7 +891,7 @@ file."
;; 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)))

View File

@ -117,19 +117,21 @@ For a description of possible values, see `vc-check-master-templates'."
(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."

View File

@ -625,7 +625,7 @@ information about FILENAME and return its status."
(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))

View File

@ -148,7 +148,8 @@
;; 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)
;;
@ -618,12 +619,6 @@
;; - 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.
@ -1661,12 +1656,11 @@ merge in the changes into your working copy."
;; 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
@ -1745,8 +1739,8 @@ merge in the changes into your working copy."
;; 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? "
@ -1789,7 +1783,10 @@ merge in the changes into your working copy."
"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."
@ -1974,7 +1971,7 @@ After check-out, runs the normal hook `vc-checkout-hook'."
(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)
@ -4277,7 +4274,7 @@ to provide the `find-revision' operation instead."
((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