diff options
| author | Michael Albinus | 2016-04-24 14:59:05 +0200 |
|---|---|---|
| committer | Michael Albinus | 2016-04-24 14:59:05 +0200 |
| commit | 5cb7620027f78a3a0f473972a0584c8ea1791398 (patch) | |
| tree | 1571c0f33ee69290d52d9fe48bf140e97781c27a | |
| parent | b876ee8971a8a040e14251f9733e4209ef7ad637 (diff) | |
| download | emacs-5cb7620027f78a3a0f473972a0584c8ea1791398.tar.gz emacs-5cb7620027f78a3a0f473972a0584c8ea1791398.zip | |
Some improvements in vc
* lisp/vc/vc-hooks.el (vc-state, vc-working-revision):
Check, whether FILE is registered.
* lisp/vc/vc-rcs.el (vc-rcs-checkout-model): Return `locking'
for nonexistent files.
* test/lisp/vc/vc-tests.el (w32-application-type): Declare.
(vc-test--revision-granularity-function)
(vc-test--unregister-function): Use `vc-call-backend'.
(vc-test--run-maybe-unsupported-function): New defmacro.
(vc-test--register, vc-test--state, vc-test--working-revision)
(vc-test--checkout-model): Use it. Fix also expected results.
(vc-test-src02-state, vc-test-rcs04-checkout-model): They pass now.
| -rw-r--r-- | lisp/vc/vc-hooks.el | 15 | ||||
| -rw-r--r-- | lisp/vc/vc-rcs.el | 4 | ||||
| -rw-r--r-- | test/lisp/vc/vc-tests.el | 204 |
3 files changed, 103 insertions, 120 deletions
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 4c0161d7978..0535565db28 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el | |||
| @@ -475,10 +475,11 @@ status of this file. Otherwise, the value returned is one of: | |||
| 475 | ;; FIXME: New (sub)states needed (?): | 475 | ;; FIXME: New (sub)states needed (?): |
| 476 | ;; - `copied' and `moved' (might be handled by `removed' and `added') | 476 | ;; - `copied' and `moved' (might be handled by `removed' and `added') |
| 477 | (or (vc-file-getprop file 'vc-state) | 477 | (or (vc-file-getprop file 'vc-state) |
| 478 | (and (not (vc-registered file)) 'unregistered) | ||
| 478 | (when (> (length file) 0) ;Why?? --Stef | 479 | (when (> (length file) 0) ;Why?? --Stef |
| 479 | (setq backend (or backend (vc-responsible-backend file))) | 480 | (setq backend (or backend (vc-responsible-backend file))) |
| 480 | (when backend | 481 | (when backend |
| 481 | (vc-state-refresh file backend))))) | 482 | (vc-state-refresh file backend))))) |
| 482 | 483 | ||
| 483 | (defun vc-state-refresh (file backend) | 484 | (defun vc-state-refresh (file backend) |
| 484 | "Quickly recompute the `state' of FILE." | 485 | "Quickly recompute the `state' of FILE." |
| @@ -494,11 +495,13 @@ status of this file. Otherwise, the value returned is one of: | |||
| 494 | "Return the repository version from which FILE was checked out. | 495 | "Return the repository version from which FILE was checked out. |
| 495 | If FILE is not registered, this function always returns nil." | 496 | If FILE is not registered, this function always returns nil." |
| 496 | (or (vc-file-getprop file 'vc-working-revision) | 497 | (or (vc-file-getprop file 'vc-working-revision) |
| 497 | (progn | 498 | (and (vc-registered file) |
| 498 | (setq backend (or backend (vc-responsible-backend file))) | 499 | (progn |
| 499 | (when backend | 500 | (setq backend (or backend (vc-responsible-backend file))) |
| 500 | (vc-file-setprop file 'vc-working-revision | 501 | (when backend |
| 501 | (vc-call-backend backend 'working-revision file)))))) | 502 | (vc-file-setprop file 'vc-working-revision |
| 503 | (vc-call-backend | ||
| 504 | backend 'working-revision file))))))) | ||
| 502 | 505 | ||
| 503 | ;; Backward compatibility. | 506 | ;; Backward compatibility. |
| 504 | (define-obsolete-function-alias | 507 | (define-obsolete-function-alias |
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 8d58611cb5b..b972956b109 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el | |||
| @@ -120,7 +120,9 @@ For a description of possible values, see `vc-check-master-templates'." | |||
| 120 | (setq result (vc-file-getprop file 'vc-checkout-model))) | 120 | (setq result (vc-file-getprop file 'vc-checkout-model))) |
| 121 | (or result | 121 | (or result |
| 122 | (progn (vc-rcs-fetch-master-state file) | 122 | (progn (vc-rcs-fetch-master-state file) |
| 123 | (vc-file-getprop file 'vc-checkout-model))))) | 123 | (vc-file-getprop file 'vc-checkout-model)) |
| 124 | ;; For non-existing files we assume strict locking. | ||
| 125 | 'locking))) | ||
| 124 | 126 | ||
| 125 | ;;; | 127 | ;;; |
| 126 | ;;; State-querying functions | 128 | ;;; State-querying functions |
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el index 1a3e8e08b68..793ad82c74f 100644 --- a/test/lisp/vc/vc-tests.el +++ b/test/lisp/vc/vc-tests.el | |||
| @@ -109,6 +109,8 @@ | |||
| 109 | (require 'ert) | 109 | (require 'ert) |
| 110 | (require 'vc) | 110 | (require 'vc) |
| 111 | 111 | ||
| 112 | (declare-function w32-application-type "w32proc") | ||
| 113 | |||
| 112 | ;; The working horses. | 114 | ;; The working horses. |
| 113 | 115 | ||
| 114 | (defvar vc-test--cleanup-hook nil | 116 | (defvar vc-test--cleanup-hook nil |
| @@ -117,7 +119,7 @@ Don't set it globally, the functions shall be let-bound.") | |||
| 117 | 119 | ||
| 118 | (defun vc-test--revision-granularity-function (backend) | 120 | (defun vc-test--revision-granularity-function (backend) |
| 119 | "Run the `vc-revision-granularity' backend function." | 121 | "Run the `vc-revision-granularity' backend function." |
| 120 | (funcall (intern (downcase (format "vc-%s-revision-granularity" backend))))) | 122 | (vc-call-backend backend 'revision-granularity)) |
| 121 | 123 | ||
| 122 | (defun vc-test--create-repo-function (backend) | 124 | (defun vc-test--create-repo-function (backend) |
| 123 | "Run the `vc-create-repo' backend function. | 125 | "Run the `vc-create-repo' backend function. |
| @@ -137,7 +139,7 @@ For backends which dont support it, it is emulated." | |||
| 137 | (tdir tmp-dir)) | 139 | (tdir tmp-dir)) |
| 138 | ;; If CVS executable is an MSYS program, reformat the file | 140 | ;; If CVS executable is an MSYS program, reformat the file |
| 139 | ;; name of TMP-DIR to have the /d/foo/bar form supported by | 141 | ;; name of TMP-DIR to have the /d/foo/bar form supported by |
| 140 | ;; MSYS programs. (FIXME What about Cygwin cvs.exe?) | 142 | ;; MSYS programs. (FIXME: What about Cygwin cvs.exe?) |
| 141 | (if (eq (w32-application-type cvs-prog) 'msys) | 143 | (if (eq (w32-application-type cvs-prog) 'msys) |
| 142 | (setq tdir | 144 | (setq tdir |
| 143 | (concat "/" (substring tmp-dir 0 1) (substring tmp-dir 2)))) | 145 | (concat "/" (substring tmp-dir 0 1) (substring tmp-dir 2)))) |
| @@ -201,21 +203,25 @@ For backends which dont support it, it is emulated." | |||
| 201 | ;; Save exit. | 203 | ;; Save exit. |
| 202 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) | 204 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) |
| 203 | 205 | ||
| 204 | ;; FIXME Why isn't there `vc-unregister'? | 206 | ;; FIXME: Why isn't there `vc-unregister'? |
| 205 | (defun vc-test--unregister-function (backend file) | 207 | (defun vc-test--unregister-function (backend file) |
| 206 | "Run the `vc-unregister' backend function. | 208 | "Run the `vc-unregister' backend function. |
| 207 | For backends which dont support it, `vc-not-supported' is signalled." | 209 | For backends which don't support it, `vc-not-supported' is signalled." |
| 208 | 210 | ;; CVS, SVN, SCCS, SRC and Mtn are not supported, and will signal | |
| 209 | (unwind-protect | 211 | ;; `vc-not-supported'. |
| 210 | (let ((symbol (intern (downcase (format "vc-%s-unregister" backend))))) | 212 | (prog1 |
| 211 | (if (functionp symbol) | 213 | (vc-call-backend backend 'unregister file) |
| 212 | (funcall symbol file) | ||
| 213 | ;; CVS, SVN, SCCS, SRC and Mtn are not supported. | ||
| 214 | (signal 'vc-not-supported (list 'unregister backend)))) | ||
| 215 | |||
| 216 | ;; FIXME This shall be called in `vc-unregister'. | ||
| 217 | (vc-file-clearprops file))) | 214 | (vc-file-clearprops file))) |
| 218 | 215 | ||
| 216 | (defmacro vc-test--run-maybe-unsupported-function (func &rest args) | ||
| 217 | "Run FUNC withs ARGS as arguments. | ||
| 218 | Catch the `vc-not-supported' error." | ||
| 219 | `(let (err) | ||
| 220 | (condition-case err | ||
| 221 | (funcall ,func ,@args) | ||
| 222 | (vc-not-supported 'vc-not-supported) | ||
| 223 | (t (signal (car err) (cdr err)))))) | ||
| 224 | |||
| 219 | (defun vc-test--register (backend) | 225 | (defun vc-test--register (backend) |
| 220 | "Register and unregister a file. | 226 | "Register and unregister a file. |
| 221 | This checks also `vc-backend' and `vc-responsible-backend'." | 227 | This checks also `vc-backend' and `vc-responsible-backend'." |
| @@ -239,7 +245,6 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 239 | (vc-test--create-repo-function backend) | 245 | (vc-test--create-repo-function backend) |
| 240 | ;; For file oriented backends CVS, RCS and SVN the backend is | 246 | ;; For file oriented backends CVS, RCS and SVN the backend is |
| 241 | ;; returned, and the directory is registered already. | 247 | ;; returned, and the directory is registered already. |
| 242 | ;; FIXME is this correct? | ||
| 243 | (should (if (vc-backend default-directory) | 248 | (should (if (vc-backend default-directory) |
| 244 | (vc-registered default-directory) | 249 | (vc-registered default-directory) |
| 245 | (not (vc-registered default-directory)))) | 250 | (not (vc-registered default-directory)))) |
| @@ -271,22 +276,21 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 271 | (should (eq (vc-responsible-backend tmp-name2) backend)) | 276 | (should (eq (vc-responsible-backend tmp-name2) backend)) |
| 272 | (should (vc-registered tmp-name2)) | 277 | (should (vc-registered tmp-name2)) |
| 273 | 278 | ||
| 274 | ;; FIXME `vc-backend' accepts also a list of files, | 279 | ;; `vc-backend' accepts also a list of files, |
| 275 | ;; `vc-responsible-backend' doesn't. Is this right? | 280 | ;; `vc-responsible-backend' doesn't. |
| 276 | (should (vc-backend (list tmp-name1 tmp-name2))) | 281 | (should (vc-backend (list tmp-name1 tmp-name2))) |
| 277 | 282 | ||
| 278 | ;; Unregister the files. | 283 | ;; Unregister the files. |
| 279 | (condition-case err | 284 | (unless (eq (vc-test--run-maybe-unsupported-function |
| 280 | (progn | 285 | 'vc-test--unregister-function backend tmp-name1) |
| 281 | (vc-test--unregister-function backend tmp-name1) | 286 | 'vc-not-supported) |
| 282 | (should-not (vc-backend tmp-name1)) | 287 | (should-not (vc-backend tmp-name1)) |
| 283 | (should-not (vc-registered tmp-name1)) | 288 | (should-not (vc-registered tmp-name1))) |
| 284 | (vc-test--unregister-function backend tmp-name2) | 289 | (unless (eq (vc-test--run-maybe-unsupported-function |
| 285 | (should-not (vc-backend tmp-name2)) | 290 | 'vc-test--unregister-function backend tmp-name2) |
| 286 | (should-not (vc-registered tmp-name2))) | 291 | 'vc-not-supported) |
| 287 | ;; CVS, SVN, SCCS, SRC and Mtn are not supported. | 292 | (should-not (vc-backend tmp-name2)) |
| 288 | (vc-not-supported t) | 293 | (should-not (vc-registered tmp-name2))) |
| 289 | (t (signal (car err) (cdr err)))) | ||
| 290 | 294 | ||
| 291 | ;; The files shall still exist. | 295 | ;; The files shall still exist. |
| 292 | (should (file-exists-p tmp-name1)) | 296 | (should (file-exists-p tmp-name1)) |
| @@ -316,66 +320,54 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 316 | (make-directory default-directory) | 320 | (make-directory default-directory) |
| 317 | (vc-test--create-repo-function backend) | 321 | (vc-test--create-repo-function backend) |
| 318 | 322 | ||
| 319 | ;; nil: Hg Mtn RCS | 323 | ;; FIXME: The state shall be unregistered only. |
| 320 | ;; added: Git | 324 | ;; nil: RCS |
| 321 | ;; unregistered: CVS SCCS SRC | 325 | ;; unregistered: Bzr CVS Git Hg Mtn SCCS SRC |
| 322 | ;; up-to-date: Bzr SVN | 326 | ;; up-to-date: SVN |
| 323 | (message "vc-state1 %s" (vc-state default-directory)) | 327 | (message "vc-state1 %s" (vc-state default-directory)) |
| 324 | (should (eq (vc-state default-directory) | 328 | (should (eq (vc-state default-directory) |
| 325 | (vc-state default-directory backend))) | 329 | (vc-state default-directory backend))) |
| 326 | (should (memq (vc-state default-directory) | 330 | (should (memq (vc-state default-directory) |
| 327 | '(nil added unregistered up-to-date))) | 331 | '(nil unregistered up-to-date))) |
| 328 | 332 | ||
| 329 | (let ((tmp-name (expand-file-name "foo" default-directory))) | 333 | (let ((tmp-name (expand-file-name "foo" default-directory))) |
| 330 | ;; Check state of an empty file. | 334 | ;; Check state of a nonexistent file. |
| 331 | 335 | ||
| 332 | ;; nil: Hg Mtn SRC SVN | 336 | ;; unregistered: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN |
| 333 | ;; added: Git | ||
| 334 | ;; unregistered: RCS SCCS | ||
| 335 | ;; up-to-date: Bzr CVS | ||
| 336 | (message "vc-state2 %s" (vc-state tmp-name)) | 337 | (message "vc-state2 %s" (vc-state tmp-name)) |
| 337 | (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) | 338 | (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) |
| 338 | (should (memq (vc-state tmp-name) | 339 | (should (eq (vc-state tmp-name) 'unregistered)) |
| 339 | '(nil added unregistered up-to-date))) | ||
| 340 | 340 | ||
| 341 | ;; Write a new file. Check state. | 341 | ;; Write a new file. Check state. |
| 342 | (write-region "foo" nil tmp-name nil 'nomessage) | 342 | (write-region "foo" nil tmp-name nil 'nomessage) |
| 343 | 343 | ||
| 344 | ;; nil: Mtn | 344 | ;; unregistered: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN |
| 345 | ;; added: Git | ||
| 346 | ;; unregistered: Hg RCS SCCS SRC SVN | ||
| 347 | ;; up-to-date: Bzr CVS | ||
| 348 | (message "vc-state3 %s" (vc-state tmp-name)) | 345 | (message "vc-state3 %s" (vc-state tmp-name)) |
| 349 | (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) | 346 | (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) |
| 350 | (should (memq (vc-state tmp-name) | 347 | (should (eq (vc-state tmp-name) 'unregistered)) |
| 351 | '(nil added unregistered up-to-date))) | ||
| 352 | 348 | ||
| 353 | ;; Register a file. Check state. | 349 | ;; Register a file. Check state. |
| 354 | (vc-register | 350 | (vc-register |
| 355 | (list backend (list (file-name-nondirectory tmp-name)))) | 351 | (list backend (list (file-name-nondirectory tmp-name)))) |
| 356 | 352 | ||
| 357 | ;; added: Git Mtn | 353 | ;; FIXME: nil seems to be wrong. |
| 358 | ;; unregistered: Hg RCS SCCS SRC SVN | 354 | ;; nil: SRC |
| 359 | ;; up-to-date: Bzr CVS | 355 | ;; added: Bzr CVS Git Hg Mtn SVN |
| 356 | ;; up-to-date: RCS SCCS | ||
| 360 | (message "vc-state4 %s" (vc-state tmp-name)) | 357 | (message "vc-state4 %s" (vc-state tmp-name)) |
| 361 | (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) | 358 | (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) |
| 362 | (should (memq (vc-state tmp-name) '(added unregistered up-to-date))) | 359 | (should (memq (vc-state tmp-name) '(nil added up-to-date))) |
| 363 | 360 | ||
| 364 | ;; Unregister the file. Check state. | 361 | ;; Unregister the file. Check state. |
| 365 | (condition-case err | 362 | (if (eq (vc-test--run-maybe-unsupported-function |
| 366 | (progn | 363 | 'vc-test--unregister-function backend tmp-name) |
| 367 | (vc-test--unregister-function backend tmp-name) | 364 | 'vc-not-supported) |
| 368 | 365 | (message "vc-state5 unsupported") | |
| 369 | ;; added: Git | 366 | ;; unregistered: Bzr Git Hg RCS |
| 370 | ;; unregistered: Hg RCS | 367 | ;; unsupported: CVS Mtn SCCS SRC SVN |
| 371 | ;; unsupported: CVS Mtn SCCS SRC SVN | 368 | (message "vc-state5 %s" (vc-state tmp-name)) |
| 372 | ;; up-to-date: Bzr | 369 | (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) |
| 373 | (message "vc-state5 %s" (vc-state tmp-name)) | 370 | (should (memq (vc-state tmp-name) '(unregistered)))))) |
| 374 | (should (eq (vc-state tmp-name) (vc-state tmp-name backend))) | ||
| 375 | (should (memq (vc-state tmp-name) | ||
| 376 | '(added unregistered up-to-date)))) | ||
| 377 | (vc-not-supported (message "vc-state5 unsupported")) | ||
| 378 | (t (signal (car err) (cdr err)))))) | ||
| 379 | 371 | ||
| 380 | ;; Save exit. | 372 | ;; Save exit. |
| 381 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) | 373 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) |
| @@ -402,8 +394,9 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 402 | (make-directory default-directory) | 394 | (make-directory default-directory) |
| 403 | (vc-test--create-repo-function backend) | 395 | (vc-test--create-repo-function backend) |
| 404 | 396 | ||
| 405 | ;; nil: CVS Git Mtn RCS SCCS | 397 | ;; FIXME: Is the value for SVN correct? |
| 406 | ;; "0": Bzr Hg SRC SVN | 398 | ;; nil: Bzr CVS Git Hg Mtn RCS SCCS SRC |
| 399 | ;; "0": SVN | ||
| 407 | (message | 400 | (message |
| 408 | "vc-working-revision1 %s" (vc-working-revision default-directory)) | 401 | "vc-working-revision1 %s" (vc-working-revision default-directory)) |
| 409 | (should (eq (vc-working-revision default-directory) | 402 | (should (eq (vc-working-revision default-directory) |
| @@ -414,50 +407,45 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 414 | ;; Check initial working revision, should be nil until | 407 | ;; Check initial working revision, should be nil until |
| 415 | ;; it's registered. | 408 | ;; it's registered. |
| 416 | 409 | ||
| 417 | ;; nil: CVS Git Mtn RCS SCCS SVN | 410 | ;; nil: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN |
| 418 | ;; "0": Bzr Hg SRC | ||
| 419 | (message "vc-working-revision2 %s" (vc-working-revision tmp-name)) | 411 | (message "vc-working-revision2 %s" (vc-working-revision tmp-name)) |
| 420 | (should (eq (vc-working-revision tmp-name) | 412 | (should (eq (vc-working-revision tmp-name) |
| 421 | (vc-working-revision tmp-name backend))) | 413 | (vc-working-revision tmp-name backend))) |
| 422 | (should (member (vc-working-revision tmp-name) '(nil "0"))) | 414 | (should-not (vc-working-revision tmp-name)) |
| 423 | 415 | ||
| 424 | ;; Write a new file. Check working revision. | 416 | ;; Write a new file. Check working revision. |
| 425 | (write-region "foo" nil tmp-name nil 'nomessage) | 417 | (write-region "foo" nil tmp-name nil 'nomessage) |
| 426 | 418 | ||
| 427 | ;; nil: CVS Git Mtn RCS SCCS SVN | 419 | ;; nil: Bzr CVS Git Hg Mtn RCS SCCS SRC SVN |
| 428 | ;; "0": Bzr Hg SRC | ||
| 429 | (message "vc-working-revision3 %s" (vc-working-revision tmp-name)) | 420 | (message "vc-working-revision3 %s" (vc-working-revision tmp-name)) |
| 430 | (should (eq (vc-working-revision tmp-name) | 421 | (should (eq (vc-working-revision tmp-name) |
| 431 | (vc-working-revision tmp-name backend))) | 422 | (vc-working-revision tmp-name backend))) |
| 432 | (should (member (vc-working-revision tmp-name) '(nil "0"))) | 423 | (should-not (vc-working-revision tmp-name)) |
| 433 | 424 | ||
| 434 | ;; Register a file. Check working revision. | 425 | ;; Register a file. Check working revision. |
| 435 | (vc-register | 426 | (vc-register |
| 436 | (list backend (list (file-name-nondirectory tmp-name)))) | 427 | (list backend (list (file-name-nondirectory tmp-name)))) |
| 437 | 428 | ||
| 438 | ;; nil: Mtn Git | 429 | ;; FIXME: nil doesn't seem to be proper. |
| 430 | ;; nil: Git Mtn | ||
| 439 | ;; "0": Bzr CVS Hg SRC SVN | 431 | ;; "0": Bzr CVS Hg SRC SVN |
| 440 | ;; "1.1" RCS SCCS | 432 | ;; "1.1": RCS SCCS |
| 441 | (message "vc-working-revision4 %s" (vc-working-revision tmp-name)) | 433 | (message "vc-working-revision4 %s" (vc-working-revision tmp-name)) |
| 442 | (should (eq (vc-working-revision tmp-name) | 434 | (should (eq (vc-working-revision tmp-name) |
| 443 | (vc-working-revision tmp-name backend))) | 435 | (vc-working-revision tmp-name backend))) |
| 444 | (should (member (vc-working-revision tmp-name) '(nil "0" "1.1"))) | 436 | (should (member (vc-working-revision tmp-name) '(nil "0" "1.1"))) |
| 445 | 437 | ||
| 446 | ;; Unregister the file. Check working revision. | 438 | ;; Unregister the file. Check working revision. |
| 447 | (condition-case err | 439 | (if (eq (vc-test--run-maybe-unsupported-function |
| 448 | (progn | 440 | 'vc-test--unregister-function backend tmp-name) |
| 449 | (vc-test--unregister-function backend tmp-name) | 441 | 'vc-not-supported) |
| 450 | 442 | (message "vc-working-revision5 unsupported") | |
| 451 | ;; nil: Git RCS | 443 | ;; nil: Bzr Git Hg RCS |
| 452 | ;; "0": Bzr Hg | 444 | ;; unsupported: CVS Mtn SCCS SRC SVN |
| 453 | ;; unsupported: CVS Mtn SCCS SRC SVN | 445 | (message "vc-working-revision5 %s" (vc-working-revision tmp-name)) |
| 454 | (message | 446 | (should (eq (vc-working-revision tmp-name) |
| 455 | "vc-working-revision5 %s" (vc-working-revision tmp-name)) | 447 | (vc-working-revision tmp-name backend))) |
| 456 | (should (eq (vc-working-revision tmp-name) | 448 | (should-not (vc-working-revision tmp-name))))) |
| 457 | (vc-working-revision tmp-name backend))) | ||
| 458 | (should (member (vc-working-revision tmp-name) '(nil "0")))) | ||
| 459 | (vc-not-supported (message "vc-working-revision5 unsupported")) | ||
| 460 | (t (signal (car err) (cdr err)))))) | ||
| 461 | 449 | ||
| 462 | ;; Save exit. | 450 | ;; Save exit. |
| 463 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) | 451 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) |
| @@ -484,9 +472,8 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 484 | (vc-test--create-repo-function backend) | 472 | (vc-test--create-repo-function backend) |
| 485 | 473 | ||
| 486 | ;; Surprisingly, none of the backends returns 'announce. | 474 | ;; Surprisingly, none of the backends returns 'announce. |
| 487 | ;; nil: RCS | ||
| 488 | ;; implicit: Bzr CVS Git Hg Mtn SRC SVN | 475 | ;; implicit: Bzr CVS Git Hg Mtn SRC SVN |
| 489 | ;; locking: SCCS | 476 | ;; locking: RCS SCCS |
| 490 | (message | 477 | (message |
| 491 | "vc-checkout-model1 %s" | 478 | "vc-checkout-model1 %s" |
| 492 | (vc-checkout-model backend default-directory)) | 479 | (vc-checkout-model backend default-directory)) |
| @@ -494,11 +481,10 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 494 | '(announce implicit locking))) | 481 | '(announce implicit locking))) |
| 495 | 482 | ||
| 496 | (let ((tmp-name (expand-file-name "foo" default-directory))) | 483 | (let ((tmp-name (expand-file-name "foo" default-directory))) |
| 497 | ;; Check checkout model of an empty file. | 484 | ;; Check checkout model of a nonexistent file. |
| 498 | 485 | ||
| 499 | ;; nil: RCS | ||
| 500 | ;; implicit: Bzr CVS Git Hg Mtn SRC SVN | 486 | ;; implicit: Bzr CVS Git Hg Mtn SRC SVN |
| 501 | ;; locking: SCCS | 487 | ;; locking: RCS SCCS |
| 502 | (message | 488 | (message |
| 503 | "vc-checkout-model2 %s" (vc-checkout-model backend tmp-name)) | 489 | "vc-checkout-model2 %s" (vc-checkout-model backend tmp-name)) |
| 504 | (should (memq (vc-checkout-model backend tmp-name) | 490 | (should (memq (vc-checkout-model backend tmp-name) |
| @@ -507,9 +493,8 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 507 | ;; Write a new file. Check checkout model. | 493 | ;; Write a new file. Check checkout model. |
| 508 | (write-region "foo" nil tmp-name nil 'nomessage) | 494 | (write-region "foo" nil tmp-name nil 'nomessage) |
| 509 | 495 | ||
| 510 | ;; nil: RCS | ||
| 511 | ;; implicit: Bzr CVS Git Hg Mtn SRC SVN | 496 | ;; implicit: Bzr CVS Git Hg Mtn SRC SVN |
| 512 | ;; locking: SCCS | 497 | ;; locking: RCS SCCS |
| 513 | (message | 498 | (message |
| 514 | "vc-checkout-model3 %s" (vc-checkout-model backend tmp-name)) | 499 | "vc-checkout-model3 %s" (vc-checkout-model backend tmp-name)) |
| 515 | (should (memq (vc-checkout-model backend tmp-name) | 500 | (should (memq (vc-checkout-model backend tmp-name) |
| @@ -519,28 +504,25 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 519 | (vc-register | 504 | (vc-register |
| 520 | (list backend (list (file-name-nondirectory tmp-name)))) | 505 | (list backend (list (file-name-nondirectory tmp-name)))) |
| 521 | 506 | ||
| 522 | ;; nil: RCS | ||
| 523 | ;; implicit: Bzr CVS Git Hg Mtn SRC SVN | 507 | ;; implicit: Bzr CVS Git Hg Mtn SRC SVN |
| 524 | ;; locking: SCCS | 508 | ;; locking: RCS SCCS |
| 525 | (message | 509 | (message |
| 526 | "vc-checkout-model4 %s" (vc-checkout-model backend tmp-name)) | 510 | "vc-checkout-model4 %s" (vc-checkout-model backend tmp-name)) |
| 527 | (should (memq (vc-checkout-model backend tmp-name) | 511 | (should (memq (vc-checkout-model backend tmp-name) |
| 528 | '(announce implicit locking))) | 512 | '(announce implicit locking))) |
| 529 | 513 | ||
| 530 | ;; Unregister the file. Check checkout model. | 514 | ;; Unregister the file. Check checkout model. |
| 531 | (condition-case err | 515 | (if (eq (vc-test--run-maybe-unsupported-function |
| 532 | (progn | 516 | 'vc-test--unregister-function backend tmp-name) |
| 533 | (vc-test--unregister-function backend tmp-name) | 517 | 'vc-not-supported) |
| 534 | 518 | (message "vc-checkout-model5 unsupported") | |
| 535 | ;; nil: RCS | 519 | ;; implicit: Bzr Git Hg |
| 536 | ;; implicit: Bzr Git Hg | 520 | ;; locking: RCS |
| 537 | ;; unsupported: CVS Mtn SCCS SRC SVN | 521 | ;; unsupported: CVS Mtn SCCS SRC SVN |
| 538 | (message | 522 | (message |
| 539 | "vc-checkout-model5 %s" (vc-checkout-model backend tmp-name)) | 523 | "vc-checkout-model5 %s" (vc-checkout-model backend tmp-name)) |
| 540 | (should (memq (vc-checkout-model backend tmp-name) | 524 | (should (memq (vc-checkout-model backend tmp-name) |
| 541 | '(announce implicit locking)))) | 525 | '(announce implicit locking)))))) |
| 542 | (vc-not-supported (message "vc-checkout-model5 unsupported")) | ||
| 543 | (t (signal (car err) (cdr err)))))) | ||
| 544 | 526 | ||
| 545 | ;; Save exit. | 527 | ;; Save exit. |
| 546 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) | 528 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) |
| @@ -615,8 +597,6 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 615 | (ert-deftest | 597 | (ert-deftest |
| 616 | ,(intern (format "vc-test-%s02-state" backend-string)) () | 598 | ,(intern (format "vc-test-%s02-state" backend-string)) () |
| 617 | ,(format "Check `vc-state' for the %s backend." backend-string) | 599 | ,(format "Check `vc-state' for the %s backend." backend-string) |
| 618 | ;; FIXME make this pass. | ||
| 619 | :expected-result ,(if (equal backend 'SRC) :failed :passed) | ||
| 620 | (skip-unless | 600 | (skip-unless |
| 621 | (ert-test-passed-p | 601 | (ert-test-passed-p |
| 622 | (ert-test-most-recent-result | 602 | (ert-test-most-recent-result |
| @@ -641,8 +621,6 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 641 | ,(intern (format "vc-test-%s04-checkout-model" backend-string)) () | 621 | ,(intern (format "vc-test-%s04-checkout-model" backend-string)) () |
| 642 | ,(format "Check `vc-checkout-model' for the %s backend." | 622 | ,(format "Check `vc-checkout-model' for the %s backend." |
| 643 | backend-string) | 623 | backend-string) |
| 644 | ;; FIXME make this pass. | ||
| 645 | :expected-result ,(if (equal backend 'RCS) :failed :passed) | ||
| 646 | (skip-unless | 624 | (skip-unless |
| 647 | (ert-test-passed-p | 625 | (ert-test-passed-p |
| 648 | (ert-test-most-recent-result | 626 | (ert-test-most-recent-result |