diff options
| author | Richard M. Stallman | 1995-12-25 18:46:17 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-12-25 18:46:17 +0000 |
| commit | 2c28ac43ed68261c5bb740f0cb009542ebfc72b9 (patch) | |
| tree | cf2ae98a7ddaa22d7cd81bd7f6cf08da8c74d760 | |
| parent | d7993a1c99c13532702510037a4866f5aee6de5a (diff) | |
| download | emacs-2c28ac43ed68261c5bb740f0cb009542ebfc72b9.tar.gz emacs-2c28ac43ed68261c5bb740f0cb009542ebfc72b9.zip | |
Fix error message style.
(vc-backend-checkout, vc-backend-checkin):
Allow vc-checkin-switches to be a string.
| -rw-r--r-- | lisp/vc.el | 212 |
1 files changed, 110 insertions, 102 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index b81b2990502..166870811bc 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -631,7 +631,7 @@ to an optional list of FLAGS." | |||
| 631 | (progn (vc-backend-steal file) | 631 | (progn (vc-backend-steal file) |
| 632 | (vc-mode-line file)) | 632 | (vc-mode-line file)) |
| 633 | (if (not (yes-or-no-p "Revert to checked-in version, instead? ")) | 633 | (if (not (yes-or-no-p "Revert to checked-in version, instead? ")) |
| 634 | (error "Checkout aborted.") | 634 | (error "Checkout aborted") |
| 635 | (vc-revert-buffer1 t t) | 635 | (vc-revert-buffer1 t t) |
| 636 | (vc-checkout-writable-buffer file)) | 636 | (vc-checkout-writable-buffer file)) |
| 637 | ) | 637 | ) |
| @@ -639,7 +639,7 @@ to an optional list of FLAGS." | |||
| 639 | (if (not (eq vc-type 'SCCS)) | 639 | (if (not (eq vc-type 'SCCS)) |
| 640 | (vc-checkout file nil | 640 | (vc-checkout file nil |
| 641 | (read-string "Branch or version to move to: ")) | 641 | (read-string "Branch or version to move to: ")) |
| 642 | (error "Sorry, this is not implemented for SCCS.")) | 642 | (error "Sorry, this is not implemented for SCCS")) |
| 643 | (if (vc-latest-on-branch-p file) | 643 | (if (vc-latest-on-branch-p file) |
| 644 | (vc-checkout-writable-buffer file) | 644 | (vc-checkout-writable-buffer file) |
| 645 | (if (yes-or-no-p | 645 | (if (yes-or-no-p |
| @@ -659,7 +659,7 @@ to an optional list of FLAGS." | |||
| 659 | (error "Sorry, you can't steal the lock on %s this way" file)) | 659 | (error "Sorry, you can't steal the lock on %s this way" file)) |
| 660 | (and (eq vc-type 'RCS) | 660 | (and (eq vc-type 'RCS) |
| 661 | (not (vc-backend-release-p 'RCS "5.6.2")) | 661 | (not (vc-backend-release-p 'RCS "5.6.2")) |
| 662 | (error "File is locked by %s." owner)) | 662 | (error "File is locked by %s" owner)) |
| 663 | (vc-steal-lock | 663 | (vc-steal-lock |
| 664 | file | 664 | file |
| 665 | (if verbose (read-string "Version to steal: ") | 665 | (if verbose (read-string "Version to steal: ") |
| @@ -1612,9 +1612,9 @@ A prefix argument means do not revert the buffer afterwards." | |||
| 1612 | ((eq (vc-backend (buffer-file-name)) 'CVS) | 1612 | ((eq (vc-backend (buffer-file-name)) 'CVS) |
| 1613 | (error "Unchecking files under CVS is dangerous and not supported in VC")) | 1613 | (error "Unchecking files under CVS is dangerous and not supported in VC")) |
| 1614 | ((vc-locking-user (buffer-file-name)) | 1614 | ((vc-locking-user (buffer-file-name)) |
| 1615 | (error "This version is locked. Use vc-revert-buffer to discard changes.")) | 1615 | (error "This version is locked; use vc-revert-buffer to discard changes")) |
| 1616 | ((not (vc-latest-on-branch-p (buffer-file-name))) | 1616 | ((not (vc-latest-on-branch-p (buffer-file-name))) |
| 1617 | (error "This is not the latest version. VC cannot cancel it."))) | 1617 | (error "This is not the latest version--VC cannot cancel it"))) |
| 1618 | (let ((target (vc-workfile-version (buffer-file-name)))) | 1618 | (let ((target (vc-workfile-version (buffer-file-name)))) |
| 1619 | (if (null (yes-or-no-p "Remove this version from master? ")) | 1619 | (if (null (yes-or-no-p "Remove this version from master? ")) |
| 1620 | nil | 1620 | nil |
| @@ -1645,7 +1645,7 @@ A prefix argument means do not revert the buffer afterwards." | |||
| 1645 | ;; implemented things might change for the better. This is unlikely to occur | 1645 | ;; implemented things might change for the better. This is unlikely to occur |
| 1646 | ;; until CVS 2.0 is released. --ceder 1994-01-23 21:27:51 | 1646 | ;; until CVS 2.0 is released. --ceder 1994-01-23 21:27:51 |
| 1647 | (if (eq (vc-backend old) 'CVS) | 1647 | (if (eq (vc-backend old) 'CVS) |
| 1648 | (error "Renaming files under CVS is dangerous and not supported in VC.")) | 1648 | (error "Renaming files under CVS is dangerous and not supported in VC")) |
| 1649 | (let ((oldbuf (get-file-buffer old))) | 1649 | (let ((oldbuf (get-file-buffer old))) |
| 1650 | (if (and oldbuf (buffer-modified-p oldbuf)) | 1650 | (if (and oldbuf (buffer-modified-p oldbuf)) |
| 1651 | (error "Please save files before moving them")) | 1651 | (error "Please save files before moving them")) |
| @@ -1804,11 +1804,15 @@ From a program, any arguments are passed to the `rcs2log' script." | |||
| 1804 | ;; Retrieve a copy of a saved version into a workfile | 1804 | ;; Retrieve a copy of a saved version into a workfile |
| 1805 | (let ((filename (or workfile file)) | 1805 | (let ((filename (or workfile file)) |
| 1806 | (file-buffer (get-file-buffer file)) | 1806 | (file-buffer (get-file-buffer file)) |
| 1807 | (old-default-dir default-directory)) | 1807 | (old-default-dir default-directory) |
| 1808 | switches) | ||
| 1808 | (message "Checking out %s..." filename) | 1809 | (message "Checking out %s..." filename) |
| 1809 | (save-excursion | 1810 | (save-excursion |
| 1810 | ;; Change buffers to get local value of vc-checkin-switches. | 1811 | ;; Change buffers to get local value of vc-checkout-switches. |
| 1811 | (if file-buffer (set-buffer file-buffer)) | 1812 | (if file-buffer (set-buffer file-buffer)) |
| 1813 | (setq switches (if (stringp vc-checkout-switches) | ||
| 1814 | (list vc-checkout-switches) | ||
| 1815 | vc-checkout-switches)) | ||
| 1812 | ;; Adjust the default-directory so that the check-out creates | 1816 | ;; Adjust the default-directory so that the check-out creates |
| 1813 | ;; the file in the right place. The old value is restored below. | 1817 | ;; the file in the right place. The old value is restored below. |
| 1814 | (setq default-directory (file-name-directory filename)) | 1818 | (setq default-directory (file-name-directory filename)) |
| @@ -1839,13 +1843,13 @@ From a program, any arguments are passed to the `rcs2log' script." | |||
| 1839 | (if writable "-e") | 1843 | (if writable "-e") |
| 1840 | "-p" (and rev | 1844 | "-p" (and rev |
| 1841 | (concat "-r" (vc-lookup-triple file rev))) | 1845 | (concat "-r" (vc-lookup-triple file rev))) |
| 1842 | vc-checkout-switches) | 1846 | switches) |
| 1843 | (setq failed nil)) | 1847 | (setq failed nil)) |
| 1844 | (and failed (file-exists-p filename) (delete-file filename)))) | 1848 | (and failed (file-exists-p filename) (delete-file filename)))) |
| 1845 | (apply 'vc-do-command nil 0 "get" file 'MASTER ;; SCCS | 1849 | (apply 'vc-do-command nil 0 "get" file 'MASTER ;; SCCS |
| 1846 | (if writable "-e") | 1850 | (if writable "-e") |
| 1847 | (and rev (concat "-r" (vc-lookup-triple file rev))) | 1851 | (and rev (concat "-r" (vc-lookup-triple file rev))) |
| 1848 | vc-checkout-switches) | 1852 | switches) |
| 1849 | (vc-file-setprop file 'vc-workfile-version nil)) | 1853 | (vc-file-setprop file 'vc-workfile-version nil)) |
| 1850 | (if workfile ;; RCS | 1854 | (if workfile ;; RCS |
| 1851 | ;; RCS doesn't let us check out into arbitrary file names directly. | 1855 | ;; RCS doesn't let us check out into arbitrary file names directly. |
| @@ -1868,7 +1872,7 @@ From a program, any arguments are passed to the `rcs2log' script." | |||
| 1868 | filename | 1872 | filename |
| 1869 | (if writable "-l") | 1873 | (if writable "-l") |
| 1870 | (concat "-p" rev) | 1874 | (concat "-p" rev) |
| 1871 | vc-checkout-switches) | 1875 | switches) |
| 1872 | (setq failed nil)) | 1876 | (setq failed nil)) |
| 1873 | (and failed (file-exists-p filename) (delete-file filename)))) | 1877 | (and failed (file-exists-p filename) (delete-file filename)))) |
| 1874 | (let (new-version) | 1878 | (let (new-version) |
| @@ -1889,7 +1893,7 @@ From a program, any arguments are passed to the `rcs2log' script." | |||
| 1889 | (let ((workrev (vc-workfile-version file))) | 1893 | (let ((workrev (vc-workfile-version file))) |
| 1890 | (if workrev (concat "-r" workrev) | 1894 | (if workrev (concat "-r" workrev) |
| 1891 | nil))) | 1895 | nil))) |
| 1892 | vc-checkout-switches) | 1896 | switches) |
| 1893 | ;; determine the new workfile version | 1897 | ;; determine the new workfile version |
| 1894 | (save-excursion | 1898 | (save-excursion |
| 1895 | (set-buffer "*vc*") | 1899 | (set-buffer "*vc*") |
| @@ -1917,7 +1921,7 @@ From a program, any arguments are passed to the `rcs2log' script." | |||
| 1917 | workfile | 1921 | workfile |
| 1918 | (concat "-r" rev) | 1922 | (concat "-r" rev) |
| 1919 | "-p" | 1923 | "-p" |
| 1920 | vc-checkout-switches) | 1924 | switches) |
| 1921 | (setq failed nil)) | 1925 | (setq failed nil)) |
| 1922 | (and failed (file-exists-p filename) (delete-file filename)))) | 1926 | (and failed (file-exists-p filename) (delete-file filename)))) |
| 1923 | ;; default for verbose checkout: clear the sticky tag | 1927 | ;; default for verbose checkout: clear the sticky tag |
| @@ -1931,7 +1935,7 @@ From a program, any arguments are passed to the `rcs2log' script." | |||
| 1931 | "update" | 1935 | "update" |
| 1932 | (and rev (not (string= rev "")) | 1936 | (and rev (not (string= rev "")) |
| 1933 | (concat "-r" rev)) | 1937 | (concat "-r" rev)) |
| 1934 | vc-checkout-switches) | 1938 | switches) |
| 1935 | ;; If no revision was specified, simply make the file writable. | 1939 | ;; If no revision was specified, simply make the file writable. |
| 1936 | (and writable | 1940 | (and writable |
| 1937 | (or (eq (vc-checkout-model file) 'manual) | 1941 | (or (eq (vc-checkout-model file) 'manual) |
| @@ -1975,93 +1979,97 @@ From a program, any arguments are passed to the `rcs2log' script." | |||
| 1975 | (save-excursion | 1979 | (save-excursion |
| 1976 | ;; Change buffers to get local value of vc-checkin-switches. | 1980 | ;; Change buffers to get local value of vc-checkin-switches. |
| 1977 | (set-buffer (or (get-file-buffer file) (current-buffer))) | 1981 | (set-buffer (or (get-file-buffer file) (current-buffer))) |
| 1978 | ;; Clear the master-properties. Do that here, not at the | 1982 | (let ((switches |
| 1979 | ;; end, because if the check-in fails we want them to get | 1983 | (if (stringp vc-checkout-switches) |
| 1980 | ;; re-computed before the next try. | 1984 | (list vc-checkout-switches) |
| 1981 | (vc-file-clear-masterprops file) | 1985 | vc-checkout-switches))) |
| 1982 | (vc-backend-dispatch file | 1986 | ;; Clear the master-properties. Do that here, not at the |
| 1983 | ;; SCCS | 1987 | ;; end, because if the check-in fails we want them to get |
| 1984 | (progn | 1988 | ;; re-computed before the next try. |
| 1985 | (apply 'vc-do-command nil 0 "delta" file 'MASTER | 1989 | (vc-file-clear-masterprops file) |
| 1986 | (if rev (concat "-r" rev)) | 1990 | (vc-backend-dispatch file |
| 1987 | (concat "-y" comment) | 1991 | ;; SCCS |
| 1988 | vc-checkin-switches) | 1992 | (progn |
| 1989 | (vc-file-setprop file 'vc-locking-user 'none) | 1993 | (apply 'vc-do-command nil 0 "delta" file 'MASTER |
| 1990 | (vc-file-setprop file 'vc-workfile-version nil) | 1994 | (if rev (concat "-r" rev)) |
| 1991 | (if vc-keep-workfiles | 1995 | (concat "-y" comment) |
| 1992 | (vc-do-command nil 0 "get" file 'MASTER)) | 1996 | switches) |
| 1993 | ) | 1997 | (vc-file-setprop file 'vc-locking-user 'none) |
| 1994 | ;; RCS | 1998 | (vc-file-setprop file 'vc-workfile-version nil) |
| 1995 | (let ((old-version (vc-workfile-version file)) new-version) | 1999 | (if vc-keep-workfiles |
| 1996 | (apply 'vc-do-command nil 0 "ci" file 'MASTER | 2000 | (vc-do-command nil 0 "get" file 'MASTER)) |
| 1997 | ;; if available, use the secure check-in option | 2001 | ) |
| 1998 | (and (vc-backend-release-p 'RCS "5.6.4") "-j") | 2002 | ;; RCS |
| 1999 | (concat (if vc-keep-workfiles "-u" "-r") rev) | 2003 | (let ((old-version (vc-workfile-version file)) new-version) |
| 2000 | (concat "-m" comment) | 2004 | (apply 'vc-do-command nil 0 "ci" file 'MASTER |
| 2001 | vc-checkin-switches) | 2005 | ;; if available, use the secure check-in option |
| 2002 | (vc-file-setprop file 'vc-locking-user 'none) | 2006 | (and (vc-backend-release-p 'RCS "5.6.4") "-j") |
| 2003 | (vc-file-setprop file 'vc-workfile-version nil) | 2007 | (concat (if vc-keep-workfiles "-u" "-r") rev) |
| 2004 | 2008 | (concat "-m" comment) | |
| 2005 | ;; determine the new workfile version | 2009 | switches) |
| 2006 | (set-buffer "*vc*") | 2010 | (vc-file-setprop file 'vc-locking-user 'none) |
| 2007 | (goto-char (point-min)) | 2011 | (vc-file-setprop file 'vc-workfile-version nil) |
| 2008 | (if (or (re-search-forward | 2012 | |
| 2009 | "new revision: \\([0-9.]+\\);" nil t) | 2013 | ;; determine the new workfile version |
| 2010 | (re-search-forward | 2014 | (set-buffer "*vc*") |
| 2011 | "reverting to previous revision \\([0-9.]+\\)" nil t)) | 2015 | (goto-char (point-min)) |
| 2012 | (progn (setq new-version (buffer-substring (match-beginning 1) | 2016 | (if (or (re-search-forward |
| 2013 | (match-end 1))) | 2017 | "new revision: \\([0-9.]+\\);" nil t) |
| 2014 | (vc-file-setprop file 'vc-workfile-version new-version))) | 2018 | (re-search-forward |
| 2015 | 2019 | "reverting to previous revision \\([0-9.]+\\)" nil t)) | |
| 2016 | ;; if we got to a different branch, adjust the default | 2020 | (progn (setq new-version (buffer-substring (match-beginning 1) |
| 2017 | ;; branch accordingly | 2021 | (match-end 1))) |
| 2018 | (cond | 2022 | (vc-file-setprop file 'vc-workfile-version new-version))) |
| 2019 | ((and old-version new-version | 2023 | |
| 2020 | (not (string= (vc-branch-part old-version) | 2024 | ;; if we got to a different branch, adjust the default |
| 2021 | (vc-branch-part new-version)))) | 2025 | ;; branch accordingly |
| 2022 | (vc-do-command nil 0 "rcs" file 'MASTER | 2026 | (cond |
| 2023 | (if (vc-trunk-p new-version) "-b" | 2027 | ((and old-version new-version |
| 2024 | (concat "-b" (vc-branch-part new-version)))) | 2028 | (not (string= (vc-branch-part old-version) |
| 2025 | ;; If this is an old RCS release, we might have | 2029 | (vc-branch-part new-version)))) |
| 2026 | ;; to remove a remaining lock. | 2030 | (vc-do-command nil 0 "rcs" file 'MASTER |
| 2027 | (if (not (vc-backend-release-p 'RCS "5.6.2")) | 2031 | (if (vc-trunk-p new-version) "-b" |
| 2028 | ;; exit status of 1 is also accepted. | 2032 | (concat "-b" (vc-branch-part new-version)))) |
| 2029 | ;; It means that the lock was removed before. | 2033 | ;; If this is an old RCS release, we might have |
| 2030 | (vc-do-command nil 1 "rcs" file 'MASTER | 2034 | ;; to remove a remaining lock. |
| 2031 | (concat "-u" old-version)))))) | 2035 | (if (not (vc-backend-release-p 'RCS "5.6.2")) |
| 2032 | ;; CVS | 2036 | ;; exit status of 1 is also accepted. |
| 2033 | (progn | 2037 | ;; It means that the lock was removed before. |
| 2034 | ;; explicit check-in to the trunk requires a | 2038 | (vc-do-command nil 1 "rcs" file 'MASTER |
| 2035 | ;; double check-in (first unexplicit) (CVS-1.3) | 2039 | (concat "-u" old-version)))))) |
| 2036 | (condition-case nil | 2040 | ;; CVS |
| 2037 | (progn | 2041 | (progn |
| 2038 | (if (and rev (vc-trunk-p rev)) | 2042 | ;; explicit check-in to the trunk requires a |
| 2039 | (apply 'vc-do-command nil 0 "cvs" file 'WORKFILE | 2043 | ;; double check-in (first unexplicit) (CVS-1.3) |
| 2040 | "ci" "-m" "intermediate" | 2044 | (condition-case nil |
| 2041 | vc-checkin-switches)) | 2045 | (progn |
| 2042 | (apply 'vc-do-command nil 0 "cvs" file 'WORKFILE | 2046 | (if (and rev (vc-trunk-p rev)) |
| 2043 | "ci" (if rev (concat "-r" rev)) | 2047 | (apply 'vc-do-command nil 0 "cvs" file 'WORKFILE |
| 2044 | (concat "-m" comment) | 2048 | "ci" "-m" "intermediate" |
| 2045 | vc-checkin-switches)) | 2049 | switches)) |
| 2046 | (error (if (eq (vc-cvs-status file) 'needs-merge) | 2050 | (apply 'vc-do-command nil 0 "cvs" file 'WORKFILE |
| 2047 | ;; The CVS output will be on top of this message. | 2051 | "ci" (if rev (concat "-r" rev)) |
| 2048 | (error "Type C-x 0 C-x C-q to merge in changes.") | 2052 | (concat "-m" comment) |
| 2049 | (error "Check in FAILED.")))) | 2053 | switches)) |
| 2050 | ;; determine and store the new workfile version | 2054 | (error (if (eq (vc-cvs-status file) 'needs-merge) |
| 2051 | (set-buffer "*vc*") | 2055 | ;; The CVS output will be on top of this message. |
| 2052 | (goto-char (point-min)) | 2056 | (error "Type C-x 0 C-x C-q to merge in changes") |
| 2053 | (if (re-search-forward | 2057 | (error "Check-in failed")))) |
| 2054 | "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" nil t) | 2058 | ;; determine and store the new workfile version |
| 2055 | (vc-file-setprop file 'vc-workfile-version | 2059 | (set-buffer "*vc*") |
| 2056 | (buffer-substring (match-beginning 2) | 2060 | (goto-char (point-min)) |
| 2057 | (match-end 2))) | 2061 | (if (re-search-forward |
| 2058 | (vc-file-setprop file 'vc-workfile-version nil)) | 2062 | "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" nil t) |
| 2059 | ;; if this was an explicit check-in, remove the sticky tag | 2063 | (vc-file-setprop file 'vc-workfile-version |
| 2060 | (if rev | 2064 | (buffer-substring (match-beginning 2) |
| 2061 | (vc-do-command nil 0 "cvs" file 'WORKFILE "update" "-A")) | 2065 | (match-end 2))) |
| 2062 | (vc-file-setprop file 'vc-locking-user 'none) | 2066 | (vc-file-setprop file 'vc-workfile-version nil)) |
| 2063 | (vc-file-setprop file 'vc-checkout-time | 2067 | ;; if this was an explicit check-in, remove the sticky tag |
| 2064 | (nth 5 (file-attributes file)))))) | 2068 | (if rev |
| 2069 | (vc-do-command nil 0 "cvs" file 'WORKFILE "update" "-A")) | ||
| 2070 | (vc-file-setprop file 'vc-locking-user 'none) | ||
| 2071 | (vc-file-setprop file 'vc-checkout-time | ||
| 2072 | (nth 5 (file-attributes file))))))) | ||
| 2065 | (message "Checking in %s...done" file)) | 2073 | (message "Checking in %s...done" file)) |
| 2066 | 2074 | ||
| 2067 | (defun vc-backend-revert (file) | 2075 | (defun vc-backend-revert (file) |
| @@ -2097,7 +2105,7 @@ From a program, any arguments are passed to the `rcs2log' script." | |||
| 2097 | ) | 2105 | ) |
| 2098 | (vc-do-command nil 0 "rcs" file 'MASTER ;RCS | 2106 | (vc-do-command nil 0 "rcs" file 'MASTER ;RCS |
| 2099 | "-M" (concat "-u" rev) (concat "-l" rev)) | 2107 | "-M" (concat "-u" rev) (concat "-l" rev)) |
| 2100 | (error "You cannot steal a CVS lock; there are no CVS locks to steal.") ;CVS | 2108 | (error "You cannot steal a CVS lock; there are no CVS locks to steal") ;CVS |
| 2101 | ) | 2109 | ) |
| 2102 | (vc-file-setprop file 'vc-locking-user (user-login-name)) | 2110 | (vc-file-setprop file 'vc-locking-user (user-login-name)) |
| 2103 | (message "Stealing lock on %s...done" file) | 2111 | (message "Stealing lock on %s...done" file) |