diff options
| author | Dan Nicolaescu | 2008-04-22 09:00:14 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2008-04-22 09:00:14 +0000 |
| commit | ae67f2d0c00a7f8d23cf057f3ff9bafffbe41275 (patch) | |
| tree | 32eb0acfb513c1eba028e1010898b75ebcb60e62 | |
| parent | c9b96e40c5ce007c6be248b264ae34cfb0f15b80 (diff) | |
| download | emacs-ae67f2d0c00a7f8d23cf057f3ff9bafffbe41275.tar.gz emacs-ae67f2d0c00a7f8d23cf057f3ff9bafffbe41275.zip | |
(vc-next-action): Do not consider directories when
checking for state compatibility.
(vc-transfer-file): Use when not if.
(vc-dir-parent-marked-p, vc-dir-children-marked-p): New functions.
(vc-dir-mark-file): Use them.
(vc-deduce-fileset): Also return the backend.
(vc-diff-internal): Take as argument the value returned by
vc-deduce-fileset instead of just the fileset.
(vc-next-action, vc-finish-logentry, vc-version-diff, vc-diff)
(vc-dir-mark-file, vc-print-log, vc-revert, vc-rollback)
(vc-update): Update the vc-deduce-fileset and vc-diff-internal calls.
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/vc.el | 228 |
2 files changed, 149 insertions, 93 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c08e64b81dc..5bedc23fcbb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2008-04-22 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * vc.el (vc-next-action): Do not consider directories when | ||
| 4 | checking for state compatibility. | ||
| 5 | (vc-transfer-file): Use when not if. | ||
| 6 | (vc-dir-parent-marked-p, vc-dir-children-marked-p): New functions. | ||
| 7 | (vc-dir-mark-file): Use them. | ||
| 8 | (vc-deduce-fileset): Also return the backend. | ||
| 9 | (vc-diff-internal): Take as argument the value returned by | ||
| 10 | vc-deduce-fileset instead of just the fileset. | ||
| 11 | (vc-next-action, vc-finish-logentry, vc-version-diff, vc-diff) | ||
| 12 | (vc-dir-mark-file, vc-print-log, vc-revert, vc-rollback) | ||
| 13 | (vc-update): Update the vc-deduce-fileset and vc-diff-internal calls. | ||
| 14 | |||
| 1 | 2008-04-22 Tassilo Horn <tassilo@member.fsf.org> | 15 | 2008-04-22 Tassilo Horn <tassilo@member.fsf.org> |
| 2 | 16 | ||
| 3 | * doc-view.el (doc-view-scroll-up-or-next-page): Don't use | 17 | * doc-view.el (doc-view-scroll-up-or-next-page): Don't use |
diff --git a/lisp/vc.el b/lisp/vc.el index 758f26d0dc3..f38edaea03a 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -648,6 +648,10 @@ | |||
| 648 | ;; | 648 | ;; |
| 649 | ;; - vc-dir toolbar needs more icons. | 649 | ;; - vc-dir toolbar needs more icons. |
| 650 | ;; | 650 | ;; |
| 651 | ;; - implement `vc-dir-parent-marked-p' and `vc-dir-children-marked-p'. | ||
| 652 | ;; | ||
| 653 | ;; - test operations on directories in vc-dir. | ||
| 654 | ;; | ||
| 651 | ;; - vc-diff, vc-annotate, etc. need to deal better with unregistered | 655 | ;; - vc-diff, vc-annotate, etc. need to deal better with unregistered |
| 652 | ;; files. Now that unregistered and ignored files are shown in | 656 | ;; files. Now that unregistered and ignored files are shown in |
| 653 | ;; vc-dired/vc-dir, it is possible that these commands are called | 657 | ;; vc-dired/vc-dir, it is possible that these commands are called |
| @@ -1419,6 +1423,7 @@ Only files already under version control are noticed." | |||
| 1419 | (defun vc-deduce-fileset (&optional allow-directory-wildcard allow-unregistered) | 1423 | (defun vc-deduce-fileset (&optional allow-directory-wildcard allow-unregistered) |
| 1420 | "Deduce a set of files and a backend to which to apply an operation. | 1424 | "Deduce a set of files and a backend to which to apply an operation. |
| 1421 | 1425 | ||
| 1426 | Return (BACKEND . FILESET). | ||
| 1422 | If we're in VC-dired mode, the fileset is the list of marked files. | 1427 | If we're in VC-dired mode, the fileset is the list of marked files. |
| 1423 | Otherwise, if we're looking at a buffer visiting a version-controlled file, | 1428 | Otherwise, if we're looking at a buffer visiting a version-controlled file, |
| 1424 | the fileset is a singleton containing this file. | 1429 | the fileset is a singleton containing this file. |
| @@ -1427,45 +1432,54 @@ and we're in a dired buffer, select the current directory. | |||
| 1427 | If none of these conditions is met, but ALLOW_UNREGISTERED is in and the | 1432 | If none of these conditions is met, but ALLOW_UNREGISTERED is in and the |
| 1428 | visited file is not registered, return a singletin fileset containing it. | 1433 | visited file is not registered, return a singletin fileset containing it. |
| 1429 | Otherwise, throw an error." | 1434 | Otherwise, throw an error." |
| 1430 | (cond (vc-dired-mode | 1435 | (let (backend) |
| 1431 | (let ((marked (dired-map-over-marks (dired-get-filename) nil))) | 1436 | (cond |
| 1432 | (unless marked | 1437 | (vc-dired-mode |
| 1433 | (error "No files have been selected.")) | 1438 | (let ((marked (dired-map-over-marks (dired-get-filename) nil))) |
| 1434 | ;; All members of the fileset must have the same backend | 1439 | (unless marked |
| 1435 | (let ((firstbackend (vc-backend (car marked)))) | 1440 | (error "No files have been selected.")) |
| 1436 | (dolist (f (cdr marked)) | 1441 | ;; All members of the fileset must have the same backend |
| 1437 | (unless (eq (vc-backend f) firstbackend) | 1442 | (setq backend (vc-backend (car marked))) |
| 1438 | (error "All members of a fileset must be under the same version-control system.")))) | 1443 | (dolist (f (cdr marked)) |
| 1439 | marked)) | 1444 | (unless (eq (vc-backend f) backend) |
| 1440 | ((eq major-mode 'vc-dir-mode) | 1445 | (error "All members of a fileset must be under the same version-control system."))) |
| 1441 | (or (vc-dir-marked-files) | 1446 | (cons backend marked))) |
| 1442 | (list (vc-dir-current-file)))) | 1447 | ((eq major-mode 'vc-dir-mode) |
| 1443 | ((vc-backend buffer-file-name) | 1448 | ;; FIXME: Maybe the backend should be stored in a buffer-local |
| 1444 | (list buffer-file-name)) | 1449 | ;; variable? |
| 1445 | ((and vc-parent-buffer (or (buffer-file-name vc-parent-buffer) | 1450 | (cons (vc-responsible-backend default-directory) |
| 1446 | (with-current-buffer vc-parent-buffer | 1451 | (or (vc-dir-marked-files) |
| 1447 | (or vc-dired-mode (eq major-mode 'vc-dir-mode))))) | 1452 | (list (vc-dir-current-file))))) |
| 1448 | (progn | 1453 | ((setq backend (vc-backend buffer-file-name)) |
| 1449 | (set-buffer vc-parent-buffer) | 1454 | (cons backend (list buffer-file-name))) |
| 1450 | (vc-deduce-fileset))) | 1455 | ((and vc-parent-buffer (or (buffer-file-name vc-parent-buffer) |
| 1451 | ;; This is guarded by an enabling arg so users won't potentially | 1456 | (with-current-buffer vc-parent-buffer |
| 1452 | ;; shoot themselves in the foot by modifying a fileset they can't | 1457 | (or vc-dired-mode (eq major-mode 'vc-dir-mode))))) |
| 1453 | ;; verify by eyeball. Allow it for nondestructive commands like | 1458 | (progn |
| 1454 | ;; making diffs, or possibly for destructive ones that have | 1459 | (set-buffer vc-parent-buffer) |
| 1455 | ;; confirmation prompts. | 1460 | (vc-deduce-fileset))) |
| 1456 | ((and allow-directory-wildcard | 1461 | ;; This is guarded by an enabling arg so users won't potentially |
| 1457 | ;; I think this is a misfeature. For now, I'll leave it in, but | 1462 | ;; shoot themselves in the foot by modifying a fileset they can't |
| 1458 | ;; I'll disable it anywhere else than in dired buffers. --Stef | 1463 | ;; verify by eyeball. Allow it for nondestructive commands like |
| 1459 | (and (derived-mode-p 'dired-mode) | 1464 | ;; making diffs, or possibly for destructive ones that have |
| 1460 | (equal buffer-file-name nil) | 1465 | ;; confirmation prompts. |
| 1461 | (equal list-buffers-directory default-directory))) | 1466 | ((and allow-directory-wildcard |
| 1462 | (progn | 1467 | ;; I think this is a misfeature. For now, I'll leave it in, but |
| 1463 | (message "All version-controlled files below %s selected." | 1468 | ;; I'll disable it anywhere else than in dired buffers. --Stef |
| 1464 | default-directory) | 1469 | (and (derived-mode-p 'dired-mode) |
| 1465 | (list default-directory))) | 1470 | (equal buffer-file-name nil) |
| 1466 | ((and allow-unregistered (not (vc-registered buffer-file-name))) | 1471 | (equal list-buffers-directory default-directory))) |
| 1467 | (list buffer-file-name)) | 1472 | (progn |
| 1468 | (t (error "No fileset is available here.")))) | 1473 | (message "All version-controlled files below %s selected." |
| 1474 | default-directory) | ||
| 1475 | (cons | ||
| 1476 | (vc-responsible-backend default-directory) | ||
| 1477 | (list default-directory)))) | ||
| 1478 | ((and allow-unregistered (not (vc-registered buffer-file-name))) | ||
| 1479 | (cons (vc-responsible-backend | ||
| 1480 | (file-name-directory (buffer-file-name))) | ||
| 1481 | (list buffer-file-name))) | ||
| 1482 | (t (error "No fileset is available here."))))) | ||
| 1469 | 1483 | ||
| 1470 | (defun vc-ensure-vc-buffer () | 1484 | (defun vc-ensure-vc-buffer () |
| 1471 | "Make sure that the current buffer visits a version-controlled file." | 1485 | "Make sure that the current buffer visits a version-controlled file." |
| @@ -1564,16 +1578,19 @@ with the logmessage as change commentary. A writable file is retained. | |||
| 1564 | If the repository file is changed, you are asked if you want to | 1578 | If the repository file is changed, you are asked if you want to |
| 1565 | merge in the changes into your working copy." | 1579 | merge in the changes into your working copy." |
| 1566 | (interactive "P") | 1580 | (interactive "P") |
| 1567 | (let* ((files (vc-deduce-fileset nil t)) | 1581 | (let* ((vc-fileset (vc-deduce-fileset nil t)) |
| 1582 | (files (cdr vc-fileset)) | ||
| 1568 | (state (vc-state (car files))) | 1583 | (state (vc-state (car files))) |
| 1569 | (model (vc-checkout-model (car files))) | 1584 | (model (vc-checkout-model (car files))) |
| 1570 | revision) | 1585 | revision) |
| 1571 | ;; Verify that the fileset is homogeneous | 1586 | ;; Verify that the fileset is homogeneous |
| 1572 | (dolist (file (cdr files)) | 1587 | (dolist (file (cdr files)) |
| 1573 | (unless (vc-compatible-state (vc-state file) state) | 1588 | ;; Ignore directories, they are compatible with anything. |
| 1574 | (error "Fileset is in a mixed-up state")) | 1589 | (unless (file-directory-p file) |
| 1575 | (unless (eq (vc-checkout-model file) model) | 1590 | (unless (vc-compatible-state (vc-state file) state) |
| 1576 | (error "Fileset has mixed checkout models"))) | 1591 | (error "Fileset is in a mixed-up state")) |
| 1592 | (unless (eq (vc-checkout-model file) model) | ||
| 1593 | (error "Fileset has mixed checkout models")))) | ||
| 1577 | ;; Check for buffers in the fileset not matching the on-disk contents. | 1594 | ;; Check for buffers in the fileset not matching the on-disk contents. |
| 1578 | (dolist (file files) | 1595 | (dolist (file files) |
| 1579 | (let ((visited (get-file-buffer file))) | 1596 | (let ((visited (get-file-buffer file))) |
| @@ -1708,7 +1725,8 @@ merge in the changes into your working copy." | |||
| 1708 | (when (not (equal buffer-file-name file)) | 1725 | (when (not (equal buffer-file-name file)) |
| 1709 | (find-file-other-window file)) | 1726 | (find-file-other-window file)) |
| 1710 | (if (save-window-excursion | 1727 | (if (save-window-excursion |
| 1711 | (vc-diff-internal nil (list file) (vc-working-revision file) nil) | 1728 | (vc-diff-internal nil (cons (car vc-fileset) (list file)) |
| 1729 | (vc-working-revision file) nil) | ||
| 1712 | (goto-char (point-min)) | 1730 | (goto-char (point-min)) |
| 1713 | (let ((inhibit-read-only t)) | 1731 | (let ((inhibit-read-only t)) |
| 1714 | (insert | 1732 | (insert |
| @@ -2035,8 +2053,10 @@ the buffer contents as a comment." | |||
| 2035 | (mapc | 2053 | (mapc |
| 2036 | (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t)) | 2054 | (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t)) |
| 2037 | log-fileset)) | 2055 | log-fileset)) |
| 2038 | (when (or vc-dired-mode (eq major-mode 'vc-dir-mode)) | 2056 | (when vc-dired-mode |
| 2039 | (dired-move-to-filename)) | 2057 | (dired-move-to-filename)) |
| 2058 | (when (eq major-mode 'vc-dir-mode) | ||
| 2059 | (vc-dir-move-to-goal-column)) | ||
| 2040 | (run-hooks after-hook 'vc-finish-logentry-hook))) | 2060 | (run-hooks after-hook 'vc-finish-logentry-hook))) |
| 2041 | 2061 | ||
| 2042 | ;;; Additional entry points for examining version histories | 2062 | ;;; Additional entry points for examining version histories |
| @@ -2114,11 +2134,12 @@ the buffer contents as a comment." | |||
| 2114 | (defvar vc-diff-added-files nil | 2134 | (defvar vc-diff-added-files nil |
| 2115 | "If non-nil, diff added files by comparing them to /dev/null.") | 2135 | "If non-nil, diff added files by comparing them to /dev/null.") |
| 2116 | 2136 | ||
| 2117 | (defun vc-diff-internal (async files rev1 rev2 &optional verbose) | 2137 | (defun vc-diff-internal (async vc-fileset rev1 rev2 &optional verbose) |
| 2118 | "Report diffs between two revisions of a fileset. | 2138 | "Report diffs between two revisions of a fileset. |
| 2119 | Diff output goes to the *vc-diff* buffer. The function | 2139 | Diff output goes to the *vc-diff* buffer. The function |
| 2120 | returns t if the buffer had changes, nil otherwise." | 2140 | returns t if the buffer had changes, nil otherwise." |
| 2121 | (let* ((messages (cons (format "Finding changes in %s..." | 2141 | (let* ((files (cdr vc-fileset)) |
| 2142 | (messages (cons (format "Finding changes in %s..." | ||
| 2122 | (vc-delistify files)) | 2143 | (vc-delistify files)) |
| 2123 | (format "No changes between %s and %s" | 2144 | (format "No changes between %s and %s" |
| 2124 | (or rev1 "working revision") | 2145 | (or rev1 "working revision") |
| @@ -2157,7 +2178,7 @@ returns t if the buffer had changes, nil otherwise." | |||
| 2157 | (append (vc-switches nil 'diff) '("/dev/null")))))) | 2178 | (append (vc-switches nil 'diff) '("/dev/null")))))) |
| 2158 | (setq files (nreverse filtered)))) | 2179 | (setq files (nreverse filtered)))) |
| 2159 | (let ((vc-disable-async-diff (not async))) | 2180 | (let ((vc-disable-async-diff (not async))) |
| 2160 | (vc-call diff files rev1 rev2 "*vc-diff*")) | 2181 | (vc-call-backend (car vc-fileset) 'diff files rev1 rev2 "*vc-diff*")) |
| 2161 | (set-buffer "*vc-diff*") | 2182 | (set-buffer "*vc-diff*") |
| 2162 | (if (and (zerop (buffer-size)) | 2183 | (if (and (zerop (buffer-size)) |
| 2163 | (not (get-buffer-process (current-buffer)))) | 2184 | (not (get-buffer-process (current-buffer)))) |
| @@ -2182,7 +2203,8 @@ returns t if the buffer had changes, nil otherwise." | |||
| 2182 | (defun vc-version-diff (files rev1 rev2) | 2203 | (defun vc-version-diff (files rev1 rev2) |
| 2183 | "Report diffs between revisions of the fileset in the repository history." | 2204 | "Report diffs between revisions of the fileset in the repository history." |
| 2184 | (interactive | 2205 | (interactive |
| 2185 | (let* ((files (vc-deduce-fileset t)) | 2206 | (let* ((vc-fileset (vc-deduce-fileset t)) |
| 2207 | (files (cdr vc-fileset)) | ||
| 2186 | (first (car files)) | 2208 | (first (car files)) |
| 2187 | (completion-table | 2209 | (completion-table |
| 2188 | (vc-call revision-completion-table files)) | 2210 | (vc-call revision-completion-table files)) |
| @@ -2223,9 +2245,10 @@ returns t if the buffer had changes, nil otherwise." | |||
| 2223 | (when (string= rev1 "") (setq rev1 nil)) | 2245 | (when (string= rev1 "") (setq rev1 nil)) |
| 2224 | (when (string= rev2 "") (setq rev2 nil)) | 2246 | (when (string= rev2 "") (setq rev2 nil)) |
| 2225 | (list files rev1 rev2)))) | 2247 | (list files rev1 rev2)))) |
| 2226 | (if (and (not rev1) rev2) | 2248 | (when (and (not rev1) rev2) |
| 2227 | (error "Not a valid revision range.")) | 2249 | (error "Not a valid revision range.")) |
| 2228 | (vc-diff-internal t files rev1 rev2 (interactive-p))) | 2250 | (vc-diff-internal |
| 2251 | t (cons (car (vc-deduce-fileset t)) files) rev1 rev2 (interactive-p))) | ||
| 2229 | 2252 | ||
| 2230 | ;; (defun vc-contains-version-controlled-file (dir) | 2253 | ;; (defun vc-contains-version-controlled-file (dir) |
| 2231 | ;; "Return t if DIR contains a version-controlled file, nil otherwise." | 2254 | ;; "Return t if DIR contains a version-controlled file, nil otherwise." |
| @@ -2249,9 +2272,8 @@ saving the buffer." | |||
| 2249 | (interactive (list current-prefix-arg t)) | 2272 | (interactive (list current-prefix-arg t)) |
| 2250 | (if historic | 2273 | (if historic |
| 2251 | (call-interactively 'vc-version-diff) | 2274 | (call-interactively 'vc-version-diff) |
| 2252 | (let* ((files (vc-deduce-fileset t))) | 2275 | (when buffer-file-name (vc-buffer-sync not-urgent)) |
| 2253 | (when buffer-file-name (vc-buffer-sync not-urgent)) | 2276 | (vc-diff-internal t (vc-deduce-fileset t) nil nil (interactive-p)))) |
| 2254 | (vc-diff-internal t files nil nil (interactive-p))))) | ||
| 2255 | 2277 | ||
| 2256 | 2278 | ||
| 2257 | ;;;###autoload | 2279 | ;;;###autoload |
| @@ -3268,13 +3290,24 @@ If a prefix argument is given, move by that many lines." | |||
| 3268 | (funcall mark-unmark-function)))) | 3290 | (funcall mark-unmark-function)))) |
| 3269 | (funcall mark-unmark-function))) | 3291 | (funcall mark-unmark-function))) |
| 3270 | 3292 | ||
| 3293 | (defun vc-dir-parent-marked-p (arg) | ||
| 3294 | ;; Return t if any of the children of arg is marked. | ||
| 3295 | nil) | ||
| 3296 | |||
| 3297 | (defun vc-dir-children-marked-p (arg) | ||
| 3298 | ;; Return t if any of the children of arg is marked. | ||
| 3299 | nil) | ||
| 3300 | |||
| 3271 | (defun vc-dir-mark-file () | 3301 | (defun vc-dir-mark-file () |
| 3272 | ;; Mark the current file and move to the next line. | 3302 | ;; Mark the current file and move to the next line. |
| 3273 | (let* ((crt (ewoc-locate vc-ewoc)) | 3303 | (let* ((crt (ewoc-locate vc-ewoc)) |
| 3274 | (file (ewoc-data crt))) | 3304 | (file (ewoc-data crt)) |
| 3275 | (setf (vc-dir-fileinfo->marked file) t) | 3305 | (isdir (vc-dir-fileinfo->directory file))) |
| 3276 | (ewoc-invalidate vc-ewoc crt) | 3306 | (when (or (and isdir (not (vc-dir-children-marked-p crt))) |
| 3277 | (vc-dir-next-line 1))) | 3307 | (and (not isdir) (not (vc-dir-parent-marked-p crt)))) |
| 3308 | (setf (vc-dir-fileinfo->marked file) t) | ||
| 3309 | (ewoc-invalidate vc-ewoc crt) | ||
| 3310 | (vc-dir-next-line 1)))) | ||
| 3278 | 3311 | ||
| 3279 | (defun vc-dir-mark () | 3312 | (defun vc-dir-mark () |
| 3280 | "Mark the current file or all files in the region. | 3313 | "Mark the current file or all files in the region. |
| @@ -3508,8 +3541,9 @@ allowed and simply skipped)." | |||
| 3508 | "List the change log of the current fileset in a window. | 3541 | "List the change log of the current fileset in a window. |
| 3509 | If WORKING-REVISION is non-nil, leave the point at that revision." | 3542 | If WORKING-REVISION is non-nil, leave the point at that revision." |
| 3510 | (interactive) | 3543 | (interactive) |
| 3511 | (let* ((files (vc-deduce-fileset)) | 3544 | (let* ((vc-fileset (vc-deduce-fileset)) |
| 3512 | (backend (vc-backend files)) | 3545 | (files (cdr vc-fileset)) |
| 3546 | (backend (car vc-fileset)) | ||
| 3513 | (working-revision (or working-revision (vc-working-revision (car files))))) | 3547 | (working-revision (or working-revision (vc-working-revision (car files))))) |
| 3514 | ;; Don't switch to the output buffer before running the command, | 3548 | ;; Don't switch to the output buffer before running the command, |
| 3515 | ;; so that any buffer-local settings in the vc-controlled | 3549 | ;; so that any buffer-local settings in the vc-controlled |
| @@ -3538,7 +3572,8 @@ If WORKING-REVISION is non-nil, leave the point at that revision." | |||
| 3538 | This asks for confirmation if the buffer contents are not identical | 3572 | This asks for confirmation if the buffer contents are not identical |
| 3539 | to the working revision (except for keyword expansion)." | 3573 | to the working revision (except for keyword expansion)." |
| 3540 | (interactive) | 3574 | (interactive) |
| 3541 | (let* ((files (vc-deduce-fileset))) | 3575 | (let* ((vc-fileset (vc-deduce-fileset)) |
| 3576 | (files (cdr vc-fileset))) | ||
| 3542 | ;; If any of the files is visited by the current buffer, make | 3577 | ;; If any of the files is visited by the current buffer, make |
| 3543 | ;; sure buffer is saved. If the user says `no', abort since | 3578 | ;; sure buffer is saved. If the user says `no', abort since |
| 3544 | ;; we cannot show the changes and ask for confirmation to | 3579 | ;; we cannot show the changes and ask for confirmation to |
| @@ -3552,7 +3587,7 @@ to the working revision (except for keyword expansion)." | |||
| 3552 | (when (vc-up-to-date-p file) | 3587 | (when (vc-up-to-date-p file) |
| 3553 | (unless (yes-or-no-p (format "%s seems up-to-date. Revert anyway? " file)) | 3588 | (unless (yes-or-no-p (format "%s seems up-to-date. Revert anyway? " file)) |
| 3554 | (error "Revert canceled")))) | 3589 | (error "Revert canceled")))) |
| 3555 | (when (vc-diff-internal vc-allow-async-revert files nil nil) | 3590 | (when (vc-diff-internal vc-allow-async-revert vc-fileset nil nil) |
| 3556 | (unless (yes-or-no-p (format "Discard changes in %s? " (vc-delistify files))) | 3591 | (unless (yes-or-no-p (format "Discard changes in %s? " (vc-delistify files))) |
| 3557 | (error "Revert canceled")) | 3592 | (error "Revert canceled")) |
| 3558 | (delete-windows-on "*vc-diff*") | 3593 | (delete-windows-on "*vc-diff*") |
| @@ -3568,8 +3603,9 @@ to the working revision (except for keyword expansion)." | |||
| 3568 | This may be either a file-level or a repository-level operation, | 3603 | This may be either a file-level or a repository-level operation, |
| 3569 | depending on the underlying version-control system." | 3604 | depending on the underlying version-control system." |
| 3570 | (interactive) | 3605 | (interactive) |
| 3571 | (let* ((files (vc-deduce-fileset)) | 3606 | (let* ((vc-fileset (vc-deduce-fileset)) |
| 3572 | (backend (vc-backend files)) | 3607 | (files (cdr vc-fileset)) |
| 3608 | (backend (car vc-fileset)) | ||
| 3573 | (granularity (vc-call-backend backend 'revision-granularity))) | 3609 | (granularity (vc-call-backend backend 'revision-granularity))) |
| 3574 | (unless (vc-find-backend-function backend 'rollback) | 3610 | (unless (vc-find-backend-function backend 'rollback) |
| 3575 | (error "Rollback is not supported in %s" backend)) | 3611 | (error "Rollback is not supported in %s" backend)) |
| @@ -3594,7 +3630,7 @@ depending on the underlying version-control system." | |||
| 3594 | (message "Finding changes...") | 3630 | (message "Finding changes...") |
| 3595 | (let* ((tip (vc-working-revision (car files))) | 3631 | (let* ((tip (vc-working-revision (car files))) |
| 3596 | (previous (vc-call previous-revision (car files) tip))) | 3632 | (previous (vc-call previous-revision (car files) tip))) |
| 3597 | (vc-diff-internal nil files previous tip)) | 3633 | (vc-diff-internal nil vc-fileset previous tip)) |
| 3598 | ;; Display changes | 3634 | ;; Display changes |
| 3599 | (unless (yes-or-no-p "Discard these revisions? ") | 3635 | (unless (yes-or-no-p "Discard these revisions? ") |
| 3600 | (error "Rollback canceled")) | 3636 | (error "Rollback canceled")) |
| @@ -3622,25 +3658,28 @@ replaces the work file with the latest revision on its branch. If the file | |||
| 3622 | contains changes, and the backend supports merging news, then any recent | 3658 | contains changes, and the backend supports merging news, then any recent |
| 3623 | changes from the current branch are merged into the working file." | 3659 | changes from the current branch are merged into the working file." |
| 3624 | (interactive) | 3660 | (interactive) |
| 3625 | (dolist (file (vc-deduce-fileset)) | 3661 | (let* ((vc-fileset (vc-deduce-fileset)) |
| 3626 | (when (let ((buf (get-file-buffer file))) | 3662 | (files (cdr vc-fileset)) |
| 3627 | (and buf (buffer-modified-p buf))) | 3663 | (backend (car vc-fileset))) |
| 3628 | (error "Please kill or save all modified buffers before updating.")) | 3664 | (dolist (file files) |
| 3629 | (if (vc-up-to-date-p file) | 3665 | (when (let ((buf (get-file-buffer file))) |
| 3630 | (vc-checkout file nil t) | 3666 | (and buf (buffer-modified-p buf))) |
| 3631 | (if (eq (vc-checkout-model file) 'locking) | 3667 | (error "Please kill or save all modified buffers before updating.")) |
| 3632 | (if (eq (vc-state file) 'edited) | 3668 | (if (vc-up-to-date-p file) |
| 3633 | (error "%s" | 3669 | (vc-checkout file nil t) |
| 3670 | (if (eq (vc-checkout-model file) 'locking) | ||
| 3671 | (if (eq (vc-state file) 'edited) | ||
| 3672 | (error "%s" | ||
| 3673 | (substitute-command-keys | ||
| 3674 | "File is locked--type \\[vc-revert] to discard changes")) | ||
| 3675 | (error "Unexpected file state (%s) -- type %s" | ||
| 3676 | (vc-state file) | ||
| 3634 | (substitute-command-keys | 3677 | (substitute-command-keys |
| 3635 | "File is locked--type \\[vc-revert] to discard changes")) | 3678 | "\\[vc-next-action] to correct"))) |
| 3636 | (error "Unexpected file state (%s) -- type %s" | 3679 | (if (not (vc-find-backend-function backend 'merge-news)) |
| 3637 | (vc-state file) | 3680 | (error "Sorry, merging news is not implemented for %s" |
| 3638 | (substitute-command-keys | 3681 | backend) |
| 3639 | "\\[vc-next-action] to correct"))) | 3682 | (vc-maybe-resolve-conflicts file (vc-call merge-news file)))))))) |
| 3640 | (if (not (vc-find-backend-function (vc-backend file) 'merge-news)) | ||
| 3641 | (error "Sorry, merging news is not implemented for %s" | ||
| 3642 | (vc-backend file)) | ||
| 3643 | (vc-maybe-resolve-conflicts file (vc-call merge-news file))))))) | ||
| 3644 | 3683 | ||
| 3645 | (defun vc-version-backup-file (file &optional rev) | 3684 | (defun vc-version-backup-file (file &optional rev) |
| 3646 | "Return name of backup file for revision REV of FILE. | 3685 | "Return name of backup file for revision REV of FILE. |
| @@ -3730,8 +3769,8 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. | |||
| 3730 | (or (memq new-backend (memq old-backend vc-handled-backends)) | 3769 | (or (memq new-backend (memq old-backend vc-handled-backends)) |
| 3731 | (y-or-n-p "Final transfer? ")))) | 3770 | (y-or-n-p "Final transfer? ")))) |
| 3732 | (comment nil)) | 3771 | (comment nil)) |
| 3733 | (if (eq old-backend new-backend) | 3772 | (when (eq old-backend new-backend) |
| 3734 | (error "%s is the current backend of %s" new-backend file)) | 3773 | (error "%s is the current backend of %s" new-backend file)) |
| 3735 | (if registered | 3774 | (if registered |
| 3736 | (set-file-modes file (logior (file-modes file) 128)) | 3775 | (set-file-modes file (logior (file-modes file) 128)) |
| 3737 | ;; `registered' might have switched under us. | 3776 | ;; `registered' might have switched under us. |
| @@ -3750,8 +3789,8 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. | |||
| 3750 | (if unmodified-file | 3789 | (if unmodified-file |
| 3751 | (copy-file unmodified-file file | 3790 | (copy-file unmodified-file file |
| 3752 | 'ok-if-already-exists 'keep-date) | 3791 | 'ok-if-already-exists 'keep-date) |
| 3753 | (if (y-or-n-p "Get base revision from master? ") | 3792 | (when (y-or-n-p "Get base revision from master? ") |
| 3754 | (vc-revert-file file)))) | 3793 | (vc-revert-file file)))) |
| 3755 | (vc-call-backend new-backend 'receive-file file rev)) | 3794 | (vc-call-backend new-backend 'receive-file file rev)) |
| 3756 | (when modified-file | 3795 | (when modified-file |
| 3757 | (vc-switch-backend file new-backend) | 3796 | (vc-switch-backend file new-backend) |
| @@ -3787,8 +3826,8 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. | |||
| 3787 | (catch 'found | 3826 | (catch 'found |
| 3788 | ;; If possible, keep the master file in the same directory. | 3827 | ;; If possible, keep the master file in the same directory. |
| 3789 | (dolist (f masters) | 3828 | (dolist (f masters) |
| 3790 | (if (and f (string= (file-name-directory (expand-file-name f)) dir)) | 3829 | (when (and f (string= (file-name-directory (expand-file-name f)) dir)) |
| 3791 | (throw 'found f))) | 3830 | (throw 'found f))) |
| 3792 | ;; If not, just use the first possible place. | 3831 | ;; If not, just use the first possible place. |
| 3793 | (dolist (f masters) | 3832 | (dolist (f masters) |
| 3794 | (and f (or (not (setq dir (file-name-directory f))) | 3833 | (and f (or (not (setq dir (file-name-directory f))) |
| @@ -4505,8 +4544,11 @@ revisions after." | |||
| 4505 | (if (not prev-rev) | 4544 | (if (not prev-rev) |
| 4506 | (message "Cannot diff from any revision prior to %s" rev-at-line) | 4545 | (message "Cannot diff from any revision prior to %s" rev-at-line) |
| 4507 | (save-window-excursion | 4546 | (save-window-excursion |
| 4508 | (vc-diff-internal nil (list vc-annotate-parent-file) | 4547 | (vc-diff-internal |
| 4509 | prev-rev rev-at-line)) | 4548 | nil |
| 4549 | (cons (vc-backend vc-annotate-parent-file) | ||
| 4550 | (list vc-annotate-parent-file)) | ||
| 4551 | prev-rev rev-at-line)) | ||
| 4510 | (switch-to-buffer "*vc-diff*")))))) | 4552 | (switch-to-buffer "*vc-diff*")))))) |
| 4511 | 4553 | ||
| 4512 | (defun vc-annotate-warp-revision (revspec) | 4554 | (defun vc-annotate-warp-revision (revspec) |