diff options
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/vc-cvs.el | 93 |
2 files changed, 63 insertions, 36 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cf2b0aa1a47..d2c78c98869 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2002-03-28 Andre Spiegel <spiegel@gnu.org> | ||
| 2 | |||
| 3 | * vc-cvs.el (vc-cvs-global-switches): New user option. | ||
| 4 | (vc-cvs-command): New function. Update all callers of | ||
| 5 | `vc-do-command' in vc-cvs.el to use this instead. | ||
| 6 | |||
| 1 | 2002-03-27 Andrew Innes <andrewi@gnu.org> | 7 | 2002-03-27 Andrew Innes <andrewi@gnu.org> |
| 2 | 8 | ||
| 3 | * makefile.w32-in (bootstrap-clean-SH): Use for loop, instead of | 9 | * makefile.w32-in (bootstrap-clean-SH): Use for loop, instead of |
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 450a433a897..815b9abf692 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: FSF (see vc.el for full credits) | 5 | ;; Author: FSF (see vc.el for full credits) |
| 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
| 7 | 7 | ||
| 8 | ;; $Id: vc-cvs.el,v 1.36 2002/03/18 17:19:45 spiegel Exp $ | 8 | ;; $Id: vc-cvs.el,v 1.37 2002/03/22 23:10:01 monnier Exp $ |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -35,6 +35,16 @@ | |||
| 35 | ;;; Customization options | 35 | ;;; Customization options |
| 36 | ;;; | 36 | ;;; |
| 37 | 37 | ||
| 38 | (defcustom vc-cvs-global-switches nil | ||
| 39 | "*Global switches to pass to any CVS command." | ||
| 40 | :type '(choice (const :tag "None" nil) | ||
| 41 | (string :tag "Argument String") | ||
| 42 | (repeat :tag "Argument List" | ||
| 43 | :value ("") | ||
| 44 | string)) | ||
| 45 | :version "21.3" | ||
| 46 | :group 'vc) | ||
| 47 | |||
| 38 | (defcustom vc-cvs-register-switches nil | 48 | (defcustom vc-cvs-register-switches nil |
| 39 | "*Extra switches for registering a file into CVS. | 49 | "*Extra switches for registering a file into CVS. |
| 40 | A string or list of strings passed to the checkin program by | 50 | A string or list of strings passed to the checkin program by |
| @@ -182,7 +192,7 @@ See also variable `vc-cvs-sticky-date-format-string'." | |||
| 182 | state)) | 192 | state)) |
| 183 | (with-temp-buffer | 193 | (with-temp-buffer |
| 184 | (cd (file-name-directory file)) | 194 | (cd (file-name-directory file)) |
| 185 | (vc-do-command t 0 "cvs" file "status") | 195 | (vc-cvs-command t 0 file "status") |
| 186 | (vc-cvs-parse-status t)))) | 196 | (vc-cvs-parse-status t)))) |
| 187 | 197 | ||
| 188 | (defun vc-cvs-state-heuristic (file) | 198 | (defun vc-cvs-state-heuristic (file) |
| @@ -203,7 +213,7 @@ See also variable `vc-cvs-sticky-date-format-string'." | |||
| 203 | ;; Don't specify DIR in this command, the default-directory is | 213 | ;; Don't specify DIR in this command, the default-directory is |
| 204 | ;; enough. Otherwise it might fail with remote repositories. | 214 | ;; enough. Otherwise it might fail with remote repositories. |
| 205 | (with-temp-buffer | 215 | (with-temp-buffer |
| 206 | (vc-do-command t 0 "cvs" nil "status" "-l") | 216 | (vc-cvs-command t 0 nil "status" "-l") |
| 207 | (goto-char (point-min)) | 217 | (goto-char (point-min)) |
| 208 | (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) | 218 | (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) |
| 209 | (narrow-to-region (match-beginning 0) (match-end 0)) | 219 | (narrow-to-region (match-beginning 0) (match-end 0)) |
| @@ -288,7 +298,7 @@ the CVS command (in that order)." | |||
| 288 | (list vc-cvs-register-switches) | 298 | (list vc-cvs-register-switches) |
| 289 | vc-cvs-register-switches)))) | 299 | vc-cvs-register-switches)))) |
| 290 | 300 | ||
| 291 | (apply 'vc-do-command nil 0 "cvs" file | 301 | (apply 'vc-cvs-command nil 0 file |
| 292 | "add" | 302 | "add" |
| 293 | (and comment (string-match "[^\t\n ]" comment) | 303 | (and comment (string-match "[^\t\n ]" comment) |
| 294 | (concat "-m" comment)) | 304 | (concat "-m" comment)) |
| @@ -313,7 +323,7 @@ This is only possible if CVS is responsible for FILE's directory." | |||
| 313 | vc-checkin-switches)) | 323 | vc-checkin-switches)) |
| 314 | status) | 324 | status) |
| 315 | (if (not rev) | 325 | (if (not rev) |
| 316 | (setq status (apply 'vc-do-command nil 1 "cvs" file | 326 | (setq status (apply 'vc-cvs-command nil 1 file |
| 317 | "ci" (if rev (concat "-r" rev)) | 327 | "ci" (if rev (concat "-r" rev)) |
| 318 | (concat "-m" comment) | 328 | (concat "-m" comment) |
| 319 | switches)) | 329 | switches)) |
| @@ -321,9 +331,9 @@ This is only possible if CVS is responsible for FILE's directory." | |||
| 321 | (error "%s is not a valid symbolic tag name") | 331 | (error "%s is not a valid symbolic tag name") |
| 322 | ;; If the input revison is a valid symbolic tag name, we create it | 332 | ;; If the input revison is a valid symbolic tag name, we create it |
| 323 | ;; as a branch, commit and switch to it. | 333 | ;; as a branch, commit and switch to it. |
| 324 | (apply 'vc-do-command nil 0 "cvs" file "tag" "-b" (list rev)) | 334 | (apply 'vc-cvs-command nil 0 file "tag" "-b" (list rev)) |
| 325 | (apply 'vc-do-command nil 0 "cvs" file "update" "-r" (list rev)) | 335 | (apply 'vc-cvs-command nil 0 file "update" "-r" (list rev)) |
| 326 | (setq status (apply 'vc-do-command nil 1 "cvs" file | 336 | (setq status (apply 'vc-cvs-command nil 1 file |
| 327 | "ci" | 337 | "ci" |
| 328 | (concat "-m" comment) | 338 | (concat "-m" comment) |
| 329 | switches)) | 339 | switches)) |
| @@ -356,7 +366,7 @@ This is only possible if CVS is responsible for FILE's directory." | |||
| 356 | ;; if this was an explicit check-in (does not include creation of | 366 | ;; if this was an explicit check-in (does not include creation of |
| 357 | ;; a branch), remove the sticky tag. | 367 | ;; a branch), remove the sticky tag. |
| 358 | (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) | 368 | (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) |
| 359 | (vc-do-command nil 0 "cvs" file "update" "-A")))) | 369 | (vc-cvs-command nil 0 file "update" "-A")))) |
| 360 | 370 | ||
| 361 | (defun vc-cvs-checkout (file &optional editable rev workfile) | 371 | (defun vc-cvs-checkout (file &optional editable rev workfile) |
| 362 | "Retrieve a revision of FILE into a WORKFILE. | 372 | "Retrieve a revision of FILE into a WORKFILE. |
| @@ -395,8 +405,8 @@ REV is the revision to check out into WORKFILE." | |||
| 395 | (let ((coding-system-for-read 'no-conversion) | 405 | (let ((coding-system-for-read 'no-conversion) |
| 396 | (coding-system-for-write 'no-conversion)) | 406 | (coding-system-for-write 'no-conversion)) |
| 397 | (with-temp-file filename | 407 | (with-temp-file filename |
| 398 | (apply 'vc-do-command | 408 | (apply 'vc-cvs-command |
| 399 | (current-buffer) 0 "cvs" file | 409 | (current-buffer) 0 file |
| 400 | "-Q" ; suppress diagnostic output | 410 | "-Q" ; suppress diagnostic output |
| 401 | "update" | 411 | "update" |
| 402 | (and rev (not (string= rev "")) | 412 | (and rev (not (string= rev "")) |
| @@ -418,20 +428,20 @@ REV is the revision to check out into WORKFILE." | |||
| 418 | ;; if necessary (using `cvs-edit' if requested). | 428 | ;; if necessary (using `cvs-edit' if requested). |
| 419 | (and editable (not (eq (vc-cvs-checkout-model file) 'implicit)) | 429 | (and editable (not (eq (vc-cvs-checkout-model file) 'implicit)) |
| 420 | (if vc-cvs-use-edit | 430 | (if vc-cvs-use-edit |
| 421 | (vc-do-command nil 0 "cvs" file "edit") | 431 | (vc-cvs-command nil 0 file "edit") |
| 422 | (set-file-modes file (logior (file-modes file) 128)) | 432 | (set-file-modes file (logior (file-modes file) 128)) |
| 423 | (if file-buffer (toggle-read-only -1)))) | 433 | (if file-buffer (toggle-read-only -1)))) |
| 424 | ;; Check out a particular version (or recreate the file). | 434 | ;; Check out a particular version (or recreate the file). |
| 425 | (vc-file-setprop file 'vc-workfile-version nil) | 435 | (vc-file-setprop file 'vc-workfile-version nil) |
| 426 | (apply 'vc-do-command nil 0 "cvs" file | 436 | (apply 'vc-cvs-command nil 0 file |
| 427 | (and editable | 437 | (and editable |
| 428 | (or (not (file-exists-p file)) | 438 | (or (not (file-exists-p file)) |
| 429 | (not (eq (vc-cvs-checkout-model file) | 439 | (not (eq (vc-cvs-checkout-model file) |
| 430 | 'implicit))) | 440 | 'implicit))) |
| 431 | "-w") | 441 | "-w") |
| 432 | "update" | 442 | "update" |
| 433 | ;; default for verbose checkout: clear the sticky tag so | 443 | ;; default for verbose checkout: clear the sticky tag so |
| 434 | ;; that the actual update will get the head of the trunk | 444 | ;; that the actual update will get the head of the trunk |
| 435 | (if (or (not rev) (string= rev "")) | 445 | (if (or (not rev) (string= rev "")) |
| 436 | "-A" | 446 | "-A" |
| 437 | (concat "-r" rev)) | 447 | (concat "-r" rev)) |
| @@ -447,14 +457,14 @@ REV is the revision to check out into WORKFILE." | |||
| 447 | (vc-cvs-checkout file nil (vc-workfile-version file) file)) | 457 | (vc-cvs-checkout file nil (vc-workfile-version file) file)) |
| 448 | (unless (eq (vc-checkout-model file) 'implicit) | 458 | (unless (eq (vc-checkout-model file) 'implicit) |
| 449 | (if vc-cvs-use-edit | 459 | (if vc-cvs-use-edit |
| 450 | (vc-do-command nil 0 "cvs" file "unedit") | 460 | (vc-cvs-command nil 0 file "unedit") |
| 451 | ;; Make the file read-only by switching off all w-bits | 461 | ;; Make the file read-only by switching off all w-bits |
| 452 | (set-file-modes file (logand (file-modes file) 3950))))) | 462 | (set-file-modes file (logand (file-modes file) 3950))))) |
| 453 | 463 | ||
| 454 | (defun vc-cvs-merge (file first-version &optional second-version) | 464 | (defun vc-cvs-merge (file first-version &optional second-version) |
| 455 | "Merge changes into current working copy of FILE. | 465 | "Merge changes into current working copy of FILE. |
| 456 | The changes are between FIRST-VERSION and SECOND-VERSION." | 466 | The changes are between FIRST-VERSION and SECOND-VERSION." |
| 457 | (vc-do-command nil 0 "cvs" file | 467 | (vc-cvs-command nil 0 file |
| 458 | "update" "-kk" | 468 | "update" "-kk" |
| 459 | (concat "-j" first-version) | 469 | (concat "-j" first-version) |
| 460 | (concat "-j" second-version)) | 470 | (concat "-j" second-version)) |
| @@ -472,7 +482,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION." | |||
| 472 | (save-excursion | 482 | (save-excursion |
| 473 | ;; (vc-file-setprop file 'vc-workfile-version nil) | 483 | ;; (vc-file-setprop file 'vc-workfile-version nil) |
| 474 | (vc-file-setprop file 'vc-checkout-time 0) | 484 | (vc-file-setprop file 'vc-checkout-time 0) |
| 475 | (vc-do-command nil 0 "cvs" file "update") | 485 | (vc-cvs-command nil 0 file "update") |
| 476 | ;; Analyze the merge result reported by CVS, and set | 486 | ;; Analyze the merge result reported by CVS, and set |
| 477 | ;; file properties accordingly. | 487 | ;; file properties accordingly. |
| 478 | (set-buffer (get-buffer "*vc*")) | 488 | (set-buffer (get-buffer "*vc*")) |
| @@ -522,10 +532,10 @@ The changes are between FIRST-VERSION and SECOND-VERSION." | |||
| 522 | 532 | ||
| 523 | (defun vc-cvs-print-log (file) | 533 | (defun vc-cvs-print-log (file) |
| 524 | "Get change log associated with FILE." | 534 | "Get change log associated with FILE." |
| 525 | (vc-do-command | 535 | (vc-cvs-command |
| 526 | nil | 536 | nil |
| 527 | (if (and (vc-cvs-stay-local-p file) (fboundp 'start-process)) 'async 0) | 537 | (if (and (vc-cvs-stay-local-p file) (fboundp 'start-process)) 'async 0) |
| 528 | "cvs" file "log")) | 538 | file "log")) |
| 529 | 539 | ||
| 530 | (defun vc-cvs-show-log-entry (version) | 540 | (defun vc-cvs-show-log-entry (version) |
| 531 | (when (re-search-forward | 541 | (when (re-search-forward |
| @@ -565,18 +575,19 @@ The changes are between FIRST-VERSION and SECOND-VERSION." | |||
| 565 | ;; This file is added but not yet committed; there is no master file. | 575 | ;; This file is added but not yet committed; there is no master file. |
| 566 | (if (or oldvers newvers) | 576 | (if (or oldvers newvers) |
| 567 | (error "No revisions of %s exist" file) | 577 | (error "No revisions of %s exist" file) |
| 568 | ;; we regard this as "changed". | 578 | ;; We regard this as "changed". |
| 569 | ;; diff it against /dev/null. | 579 | ;; Diff it against /dev/null. |
| 580 | ;; Note: this is NOT a "cvs diff". | ||
| 570 | (apply 'vc-do-command "*vc-diff*" | 581 | (apply 'vc-do-command "*vc-diff*" |
| 571 | 1 "diff" file | 582 | 1 "diff" file |
| 572 | (append diff-switches-list '("/dev/null")))) | 583 | (append diff-switches-list '("/dev/null")))) |
| 573 | (setq status | 584 | (setq status |
| 574 | (apply 'vc-do-command "*vc-diff*" | 585 | (apply 'vc-cvs-command "*vc-diff*" |
| 575 | (if (and (vc-cvs-stay-local-p file) | 586 | (if (and (vc-cvs-stay-local-p file) |
| 576 | (fboundp 'start-process)) | 587 | (fboundp 'start-process)) |
| 577 | 'async | 588 | 'async |
| 578 | 1) | 589 | 1) |
| 579 | "cvs" file "diff" | 590 | file "diff" |
| 580 | (and oldvers (concat "-r" oldvers)) | 591 | (and oldvers (concat "-r" oldvers)) |
| 581 | (and newvers (concat "-r" newvers)) | 592 | (and newvers (concat "-r" newvers)) |
| 582 | diff-switches-list)) | 593 | diff-switches-list)) |
| @@ -603,7 +614,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION." | |||
| 603 | ;; cvs diff: use a single call for the entire tree | 614 | ;; cvs diff: use a single call for the entire tree |
| 604 | (let ((coding-system-for-read | 615 | (let ((coding-system-for-read |
| 605 | (or coding-system-for-read 'undecided))) | 616 | (or coding-system-for-read 'undecided))) |
| 606 | (apply 'vc-do-command "*vc-diff*" 1 "cvs" nil "diff" | 617 | (apply 'vc-cvs-command "*vc-diff*" 1 nil "diff" |
| 607 | (and rev1 (concat "-r" rev1)) | 618 | (and rev1 (concat "-r" rev1)) |
| 608 | (and rev2 (concat "-r" rev2)) | 619 | (and rev2 (concat "-r" rev2)) |
| 609 | (vc-diff-switches-list 'CVS)))))) | 620 | (vc-diff-switches-list 'CVS)))))) |
| @@ -611,7 +622,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION." | |||
| 611 | (defun vc-cvs-annotate-command (file buffer &optional version) | 622 | (defun vc-cvs-annotate-command (file buffer &optional version) |
| 612 | "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER. | 623 | "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER. |
| 613 | Optional arg VERSION is a version to annotate from." | 624 | Optional arg VERSION is a version to annotate from." |
| 614 | (vc-do-command buffer 0 "cvs" file "annotate" (if version | 625 | (vc-cvs-command buffer 0 file "annotate" (if version |
| 615 | (concat "-r" version)))) | 626 | (concat "-r" version)))) |
| 616 | 627 | ||
| 617 | (defun vc-cvs-annotate-current-time () | 628 | (defun vc-cvs-annotate-current-time () |
| @@ -655,8 +666,8 @@ systime, or nil if there is none." | |||
| 655 | "Assign to DIR's current version a given NAME. | 666 | "Assign to DIR's current version a given NAME. |
| 656 | If BRANCHP is non-nil, the name is created as a branch (and the current | 667 | If BRANCHP is non-nil, the name is created as a branch (and the current |
| 657 | workspace is immediately moved to that new branch)." | 668 | workspace is immediately moved to that new branch)." |
| 658 | (vc-do-command nil 0 "cvs" dir "tag" "-c" (if branchp "-b") name) | 669 | (vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name) |
| 659 | (when branchp (vc-do-command nil 0 "cvs" dir "update" "-r" name))) | 670 | (when branchp (vc-cvs-command nil 0 dir "update" "-r" name))) |
| 660 | 671 | ||
| 661 | (defun vc-cvs-retrieve-snapshot (dir name update) | 672 | (defun vc-cvs-retrieve-snapshot (dir name update) |
| 662 | "Retrieve a snapshot at and below DIR. | 673 | "Retrieve a snapshot at and below DIR. |
| @@ -667,8 +678,8 @@ If UPDATE is non-nil, then update (resynch) any affected buffers." | |||
| 667 | (sticky-tag)) | 678 | (sticky-tag)) |
| 668 | (erase-buffer) | 679 | (erase-buffer) |
| 669 | (if (or (not name) (string= name "")) | 680 | (if (or (not name) (string= name "")) |
| 670 | (vc-do-command t 0 "cvs" nil "update") | 681 | (vc-cvs-command t 0 nil "update") |
| 671 | (vc-do-command t 0 "cvs" nil "update" "-r" name) | 682 | (vc-cvs-command t 0 nil "update" "-r" name) |
| 672 | (setq sticky-tag name)) | 683 | (setq sticky-tag name)) |
| 673 | (when update | 684 | (when update |
| 674 | (goto-char (point-min)) | 685 | (goto-char (point-min)) |
| @@ -715,6 +726,16 @@ If UPDATE is non-nil, then update (resynch) any affected buffers." | |||
| 715 | ;;; Internal functions | 726 | ;;; Internal functions |
| 716 | ;;; | 727 | ;;; |
| 717 | 728 | ||
| 729 | (defun vc-cvs-command (buffer okstatus file &rest flags) | ||
| 730 | "A wrapper around `vc-do-command' for use in vc-cvs.el. | ||
| 731 | The difference to vc-do-command is that this function always invokes `cvs', | ||
| 732 | and that it passes `vc-cvs-global-switches' to it before FLAGS." | ||
| 733 | (apply 'vc-do-command buffer okstatus "cvs" file | ||
| 734 | (if (stringp vc-cvs-global-switches) | ||
| 735 | (cons vc-cvs-global-switches flags) | ||
| 736 | (append vc-cvs-global-switches | ||
| 737 | flags)))) | ||
| 738 | |||
| 718 | (defun vc-cvs-stay-local-p (file) | 739 | (defun vc-cvs-stay-local-p (file) |
| 719 | "Return non-nil if VC should stay local when handling FILE." | 740 | "Return non-nil if VC should stay local when handling FILE." |
| 720 | (if vc-cvs-stay-local | 741 | (if vc-cvs-stay-local |