aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov2016-04-24 23:32:48 +0300
committerDmitry Gutov2016-04-24 23:34:09 +0300
commit1face76ba6d19b269310ddbb0a6a618a3bfe54a2 (patch)
treeae4c3973dba7915bdf2053f76b871e5feaeb2f54 /lisp
parentdba65ec99361a534042e3a1ade4d08b0f40481d1 (diff)
downloademacs-1face76ba6d19b269310ddbb0a6a618a3bfe54a2.tar.gz
emacs-1face76ba6d19b269310ddbb0a6a618a3bfe54a2.zip
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')
-rw-r--r--lisp/vc/vc-hooks.el30
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:
468 468
469 `unregistered' The file is not under version control." 469 `unregistered' The file is not under version control."
470 470
471 ;; Note: in Emacs 22 and older, return of nil meant the file was 471 ;; Note: we usually return nil here for unregistered files anyway
472 ;; unregistered. This is potentially a source of 472 ;; when called with only one argument. This doesn't seem to cause
473 ;; backward-compatibility bugs. 473 ;; any problems. But if we wanted to change that, we should
474 ;; probably opt for redefining the `registered' command to return
475 ;; non-nil even for unregistered files (maybe also rename it), and
476 ;; then make sure that all `state' implementations handle
477 ;; unregistered file appropriately.
474 478
475 ;; FIXME: New (sub)states needed (?): 479 ;; FIXME: New (sub)states needed (?):
476 ;; - `copied' and `moved' (might be handled by `removed' and `added') 480 ;; - `copied' and `moved' (might be handled by `removed' and `added')
477 (or (vc-file-getprop file 'vc-state) 481 (or (vc-file-getprop file 'vc-state)
478 (and (not (vc-registered file)) 'unregistered)
479 (when (> (length file) 0) ;Why?? --Stef 482 (when (> (length file) 0) ;Why?? --Stef
480 (setq backend (or backend (vc-responsible-backend file))) 483 (setq backend (or backend (vc-backend file)))
481 (when backend 484 (when backend
482 (vc-state-refresh file backend))))) 485 (vc-state-refresh file backend)))))
483 486
484(defun vc-state-refresh (file backend) 487(defun vc-state-refresh (file backend)
485 "Quickly recompute the `state' of FILE." 488 "Quickly recompute the `state' of FILE."
@@ -495,13 +498,12 @@ status of this file. Otherwise, the value returned is one of:
495 "Return the repository version from which FILE was checked out. 498 "Return the repository version from which FILE was checked out.
496If FILE is not registered, this function always returns nil." 499If FILE is not registered, this function always returns nil."
497 (or (vc-file-getprop file 'vc-working-revision) 500 (or (vc-file-getprop file 'vc-working-revision)
498 (and (vc-registered file) 501 (progn
499 (progn 502 (setq backend (or backend (vc-backend file)))
500 (setq backend (or backend (vc-responsible-backend file))) 503 (when backend
501 (when backend 504 (vc-file-setprop file 'vc-working-revision
502 (vc-file-setprop file 'vc-working-revision 505 (vc-call-backend
503 (vc-call-backend 506 backend 'working-revision file))))))
504 backend 'working-revision file)))))))
505 507
506;; Backward compatibility. 508;; Backward compatibility.
507(define-obsolete-function-alias 509(define-obsolete-function-alias