Subject: bug#20637: incompatible, undocumented change to vc-working-revision

From: Dmitry Gutov <[email-masked]>
Date: Fri, 15 Apr 2016 03:20:59 +0300

On 04/14/2016 09:31 PM, Michael Albinus wrote:

> I've committed this to emacs-25. Plus commenting the now failing checks
> in vc-tests.el.

Thanks. Any objections to committing this follow-up patch?

It makes the tests look a lot more meaningful, and it passes for all 
backends, AFAICT, but I don't have e.g. Monotone installed.
diff --git a/test/automated/vc-tests.el b/test/automated/vc-tests.el
index 5042196..f9c0ce1 100644
--- a/test/automated/vc-tests.el
+++ b/test/automated/vc-tests.el
@@ -205,12 +205,10 @@ vc-test--create-repo
 (defun vc-test--unregister-function (backend file)
   "Run the `vc-unregister' backend function.
 For backends which dont support it, `vc-not-supported' is signalled."
-
-  (let ((symbol (intern (downcase (format "vc-%s-unregister" backend)))))
-    (if (functionp symbol)
-	(funcall symbol file)
-      ;; CVS, SVN, SCCS, SRC and Mtn are not supported.
-      (signal 'vc-not-supported (list 'unregister backend)))))
+  ;; CVS, SVN, SCCS, SRC and Mtn are not supported, and will signal
+  ;; `vc-not-supported'.
+  (vc-call-backend backend 'unregister file)
+  (vc-file-clearprops file))
 
 (defun vc-test--register (backend)
   "Register and unregister a file."
@@ -289,6 +287,9 @@ vc-test--state
           ;; added: Git
           ;; unregistered: CVS SCCS SRC
 	  ;; up-to-date: Bzr SVN
+          ;; FIXME: Delete this check.  A directory does not have a
+          ;; state, only files inside of it have states, and there is no way
+          ;; to combine those states into a single value unambiguously.
           (message "vc-state1 %s" (vc-state default-directory))
 	  ;;(should (eq (vc-state default-directory)
 		      ;;(vc-state default-directory backend)))
@@ -305,7 +306,7 @@ vc-test--state
             (message "vc-state2 %s" (vc-state tmp-name))
 	    ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend)))
 	    (should (memq (vc-state tmp-name)
-			  '(nil added unregistered up-to-date)))
+			  '(nil)))
 
 	    ;; Write a new file.  Check state.
 	    (write-region "foo" nil tmp-name nil 'nomessage)
@@ -317,19 +318,19 @@ vc-test--state
             (message "vc-state3 %s" (vc-state tmp-name))
 	    ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend)))
 	    (should (memq (vc-state tmp-name)
-			  '(nil added unregistered up-to-date)))
+			  '(nil)))
 
 	    ;; Register a file.  Check state.
 	    (vc-register
-	     (list backend (list (file-name-nondirectory tmp-name))))
+	     (list backend (list tmp-name)))
 
             ;; added: Git Mtn
             ;; unregistered: Hg RCS SCCS SRC SVN
             ;; up-to-date: Bzr CVS
             (message "vc-state4 %s" (vc-state tmp-name))
-	    ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend)))
+	    (should (eq (vc-state tmp-name) (vc-state tmp-name backend)))
 	    (should (memq (vc-state tmp-name)
-                          '(nil added unregistered up-to-date)))
+                          '(added up-to-date)))
 
 	    ;; Unregister the file.  Check state.
 	    (condition-case nil
@@ -343,7 +344,7 @@ vc-test--state
                   (message "vc-state5 %s" (vc-state tmp-name))
 		  ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend)))
 		  (should (memq (vc-state tmp-name)
-				'(nil added unregistered up-to-date))))
+				'(nil unregistered))))
 	      (vc-not-supported (message "vc-state5 unsupported")))))
 
       ;; Save exit.