Mercurial > emacs
comparison lisp/vc.el @ 87477:b5060e79eb98
* vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
and 'unregistered states.
* vc-hooks.el (vc-state): Added 'removed state to documentation.
* vc-hg (vc-hg-parse-status): Recognize 'added, 'removed, and
'up-to-date state. Deal with the possibility that C for clean
might change to "=" in the next point release.
* vc-git.el (vc-git-parse-status): Recognize 'removed.
* vc.el (header comment): Better description of new dir-state.
(vc-compatible-state): Defines which states are mutually
compatible; usable with 'edited as a test for which can be committed on.
(vc-dired-hook): Turn off undo in the VC-Dired buffer, a speed tweak.
(vc-default-dired-state-info): Display 'removed state.
* vc-bzr.el (vc-bzr-dir-state): Recognize 'added.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Sat, 29 Dec 2007 13:20:49 +0000 |
parents | 71fc7b1db920 |
children | de46129c1767 |
comparison
equal
deleted
inserted
replaced
87476:6455e422c87c | 87477:b5060e79eb98 |
---|---|
157 ;; than the implementation of `state'. For a list of possible values, | 157 ;; than the implementation of `state'. For a list of possible values, |
158 ;; see the doc string of `vc-state'. | 158 ;; see the doc string of `vc-state'. |
159 ;; | 159 ;; |
160 ;; - dir-state (dir) | 160 ;; - dir-state (dir) |
161 ;; | 161 ;; |
162 ;; If provided, this function is used to find the version control state | 162 ;; If provided, this function is used to find the version control |
163 ;; of all files in DIR, and all subdirecties of DIR, in a fast way. | 163 ;; state of as many files as possible in DIR, and all subdirecties |
164 ;; The function should not return anything, but rather store the files' | 164 ;; of DIR, in a fast way; it is used to avoid expensive indivitual |
165 ;; states into the corresponding `vc-state' properties. (Note: in | 165 ;; vc-state calls. The function should not return anything, but |
166 ;; older versions this method was not required to recurse into | 166 ;; rather store the files' states into the corresponding `vc-state' |
167 ;; subdirectories.) | 167 ;; properties. (Note: in older versions this method was not |
168 ;; required to recurse into subdirectories.) | |
168 ;; | 169 ;; |
169 ;; * working-revision (file) | 170 ;; * working-revision (file) |
170 ;; | 171 ;; |
171 ;; Return the working revision of FILE. This is the revision fetched | 172 ;; Return the working revision of FILE. This is the revision fetched |
172 ;; by the last checkout or upate, not necessarily the same thing as the | 173 ;; by the last checkout or upate, not necessarily the same thing as the |
1344 (unless not-urgent | 1345 (unless not-urgent |
1345 (error "Aborted"))))) | 1346 (error "Aborted"))))) |
1346 | 1347 |
1347 (defvar vc-dired-window-configuration) | 1348 (defvar vc-dired-window-configuration) |
1348 | 1349 |
1350 (defun vc-compatible-state (p q) | |
1351 "Controls which states can be in the same commit." | |
1352 (or | |
1353 (eq p q) | |
1354 (and (member p '(edited added removed)) (member q '(edited added removed))))) | |
1355 | |
1349 ;; Here's the major entry point. | 1356 ;; Here's the major entry point. |
1350 | 1357 |
1351 ;;;###autoload | 1358 ;;;###autoload |
1352 (defun vc-next-action (verbose) | 1359 (defun vc-next-action (verbose) |
1353 "Do the next logical version control operation on the current fileset. | 1360 "Do the next logical version control operation on the current fileset. |
1384 (state (vc-state (car files))) | 1391 (state (vc-state (car files))) |
1385 (model (vc-checkout-model (car files))) | 1392 (model (vc-checkout-model (car files))) |
1386 revision) | 1393 revision) |
1387 ;; Verify that the fileset is homogenous | 1394 ;; Verify that the fileset is homogenous |
1388 (dolist (file (cdr files)) | 1395 (dolist (file (cdr files)) |
1389 (if (not (eq (vc-state file) state)) | 1396 (if (not (vc-compatible-state (vc-state file) state)) |
1390 (error "Fileset is in a mixed-up state")) | 1397 (error "Fileset is in a mixed-up state")) |
1391 (if (not (eq (vc-checkout-model file) model)) | 1398 (if (not (eq (vc-checkout-model file) model)) |
1392 (error "Fileset has mixed checkout models"))) | 1399 (error "Fileset has mixed checkout models"))) |
1393 ;; Check for buffers in the fileset not matching the on-disk contents. | 1400 ;; Check for buffers in the fileset not matching the on-disk contents. |
1394 (dolist (file files) | 1401 (dolist (file files) |
1434 (dolist (file files) (vc-checkout file t))) | 1441 (dolist (file files) (vc-checkout file t))) |
1435 (t | 1442 (t |
1436 ;; do nothing | 1443 ;; do nothing |
1437 (message "Fileset is up-to-date")))) | 1444 (message "Fileset is up-to-date")))) |
1438 ;; Files have local changes | 1445 ;; Files have local changes |
1439 ((eq state 'edited) | 1446 ((vc-compatible-state state 'edited) |
1440 (let ((ready-for-commit files)) | 1447 (let ((ready-for-commit files)) |
1441 ;; If files are edited but read-only, give user a chance to correct | 1448 ;; If files are edited but read-only, give user a chance to correct |
1442 (dolist (file files) | 1449 (dolist (file files) |
1443 (if (not (file-writable-p file)) | 1450 (if (not (file-writable-p file)) |
1444 (progn | 1451 (progn |
2347 (let ((backend (vc-responsible-backend default-directory))) | 2354 (let ((backend (vc-responsible-backend default-directory))) |
2348 ;; check `backend' can really handle `default-directory'. | 2355 ;; check `backend' can really handle `default-directory'. |
2349 (if (and (vc-call-backend backend 'responsible-p default-directory) | 2356 (if (and (vc-call-backend backend 'responsible-p default-directory) |
2350 (vc-find-backend-function backend 'dir-state)) | 2357 (vc-find-backend-function backend 'dir-state)) |
2351 (vc-call-backend backend 'dir-state default-directory))) | 2358 (vc-call-backend backend 'dir-state default-directory))) |
2352 (let (filename (inhibit-read-only t)) | 2359 (let (filename |
2360 (inhibit-read-only t) | |
2361 (buffer-undo-list t)) | |
2353 (goto-char (point-min)) | 2362 (goto-char (point-min)) |
2354 (while (not (eobp)) | 2363 (while (not (eobp)) |
2355 (cond | 2364 (cond |
2356 ;; subdir header line | 2365 ;; subdir header line |
2357 ((dired-get-subdir) | 2366 ((dired-get-subdir) |
3074 ((stringp state) (concat "(" state ")")) | 3083 ((stringp state) (concat "(" state ")")) |
3075 ((eq state 'edited) (concat "(" (vc-user-login-name file) ")")) | 3084 ((eq state 'edited) (concat "(" (vc-user-login-name file) ")")) |
3076 ((eq state 'needs-merge) "(merge)") | 3085 ((eq state 'needs-merge) "(merge)") |
3077 ((eq state 'needs-patch) "(patch)") | 3086 ((eq state 'needs-patch) "(patch)") |
3078 ((eq state 'added) "(added)") | 3087 ((eq state 'added) "(added)") |
3088 ((eq state 'removed) "(removed)") | |
3079 ((eq state 'ignored) "(ignored)") ;; dired-hook filters this out | 3089 ((eq state 'ignored) "(ignored)") ;; dired-hook filters this out |
3080 ((eq state 'unregistered) "?") | 3090 ((eq state 'unregistered) "?") |
3081 ((eq state 'unlocked-changes) "(stale)") | 3091 ((eq state 'unlocked-changes) "(stale)") |
3082 ((not state) "(unknown)"))) | 3092 ((not state) "(unknown)"))) |
3083 (buffer | 3093 (buffer |