diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2016-04-24 23:32:48 +0300 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2016-04-24 23:34:09 +0300 |
commit | 1face76ba6d19b269310ddbb0a6a618a3bfe54a2 (patch) | |
tree | ae4c3973dba7915bdf2053f76b871e5feaeb2f54 /lisp/vc/vc-hooks.el | |
parent | dba65ec99361a534042e3a1ade4d08b0f40481d1 (diff) | |
download | emacs-1face76ba6d19b269310ddbb0a6a618a3bfe54a2.tar.gz |
Revert the disputed VC change and update the tests
* lisp/vc/vc-hooks.el (vc-working-revision):
Remove the previous change.
(vc-state): Same. And update the old, incorrect comment about
unregistered files
(http://lists.gnu.org/archive/html/emacs-devel/2016-04/msg00526.html).
* test/lisp/vc/vc-tests.el (vc-test--state): Remove the check
calling `vc-state' on default-directory (VC state is undefined
for directories). Check that `vc-state' returns nil where it
returned `unregistered' before. Remove all checks comparing
invocations with the backend passed in explictly and without.
(vc-test--working-revision): Remove all checks comparing
invocations with the backend passed in explictly and without.
Update comments, and add a new one.
Diffstat (limited to 'lisp/vc/vc-hooks.el')
-rw-r--r-- | lisp/vc/vc-hooks.el | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 4047bca046a..6b4cd6acd03 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -468,18 +468,21 @@ status of this file. Otherwise, the value returned is one of: `unregistered' The file is not under version control." - ;; Note: in Emacs 22 and older, return of nil meant the file was - ;; unregistered. This is potentially a source of - ;; backward-compatibility bugs. + ;; Note: we usually return nil here for unregistered files anyway + ;; when called with only one argument. This doesn't seem to cause + ;; any problems. But if we wanted to change that, we should + ;; probably opt for redefining the `registered' command to return + ;; non-nil even for unregistered files (maybe also rename it), and + ;; then make sure that all `state' implementations handle + ;; unregistered file appropriately. ;; FIXME: New (sub)states needed (?): ;; - `copied' and `moved' (might be handled by `removed' and `added') (or (vc-file-getprop file 'vc-state) - (and (not (vc-registered file)) 'unregistered) (when (> (length file) 0) ;Why?? --Stef - (setq backend (or backend (vc-responsible-backend file))) - (when backend - (vc-state-refresh file backend))))) + (setq backend (or backend (vc-backend file))) + (when backend + (vc-state-refresh file backend))))) (defun vc-state-refresh (file backend) "Quickly recompute the `state' of FILE." @@ -495,13 +498,12 @@ status of this file. Otherwise, the value returned is one of: "Return the repository version from which FILE was checked out. If FILE is not registered, this function always returns nil." (or (vc-file-getprop file 'vc-working-revision) - (and (vc-registered file) - (progn - (setq backend (or backend (vc-responsible-backend file))) - (when backend - (vc-file-setprop file 'vc-working-revision - (vc-call-backend - backend 'working-revision file))))))) + (progn + (setq backend (or backend (vc-backend file))) + (when backend + (vc-file-setprop file 'vc-working-revision + (vc-call-backend + backend 'working-revision file)))))) ;; Backward compatibility. (define-obsolete-function-alias |