Mercurial > emacs
comparison lisp/vc.el @ 91304:c938ab6810a4
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-308
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 02 Jan 2008 04:13:39 +0000 |
parents | 56a72e2bd635 4146f1cc135e |
children | 606f2d163a64 |
comparison
equal
deleted
inserted
replaced
91303:1ae1f4066439 | 91304:c938ab6810a4 |
---|---|
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 properties. |
167 ;; Two properties are required: `vc-backend' and `vc-state'. (Note: | |
168 ;; in older versions this method was not required to recurse into | |
167 ;; subdirectories.) | 169 ;; subdirectories.) |
168 ;; | 170 ;; |
169 ;; * working-revision (file) | 171 ;; * working-revision (file) |
170 ;; | 172 ;; |
171 ;; Return the working revision of FILE. This is the revision fetched | 173 ;; Return the working revision of FILE. This is the revision fetched |
1344 (unless not-urgent | 1346 (unless not-urgent |
1345 (error "Aborted"))))) | 1347 (error "Aborted"))))) |
1346 | 1348 |
1347 (defvar vc-dired-window-configuration) | 1349 (defvar vc-dired-window-configuration) |
1348 | 1350 |
1351 (defun vc-compatible-state (p q) | |
1352 "Controls which states can be in the same commit." | |
1353 (or | |
1354 (eq p q) | |
1355 (and (member p '(edited added removed)) (member q '(edited added removed))))) | |
1356 | |
1349 ;; Here's the major entry point. | 1357 ;; Here's the major entry point. |
1350 | 1358 |
1351 ;;;###autoload | 1359 ;;;###autoload |
1352 (defun vc-next-action (verbose) | 1360 (defun vc-next-action (verbose) |
1353 "Do the next logical version control operation on the current fileset. | 1361 "Do the next logical version control operation on the current fileset. |
1384 (state (vc-state (car files))) | 1392 (state (vc-state (car files))) |
1385 (model (vc-checkout-model (car files))) | 1393 (model (vc-checkout-model (car files))) |
1386 revision) | 1394 revision) |
1387 ;; Verify that the fileset is homogenous | 1395 ;; Verify that the fileset is homogenous |
1388 (dolist (file (cdr files)) | 1396 (dolist (file (cdr files)) |
1389 (if (not (eq (vc-state file) state)) | 1397 (if (not (vc-compatible-state (vc-state file) state)) |
1390 (error "Fileset is in a mixed-up state")) | 1398 (error "Fileset is in a mixed-up state")) |
1391 (if (not (eq (vc-checkout-model file) model)) | 1399 (if (not (eq (vc-checkout-model file) model)) |
1392 (error "Fileset has mixed checkout models"))) | 1400 (error "Fileset has mixed checkout models"))) |
1393 ;; Check for buffers in the fileset not matching the on-disk contents. | 1401 ;; Check for buffers in the fileset not matching the on-disk contents. |
1394 (dolist (file files) | 1402 (dolist (file files) |
1434 (dolist (file files) (vc-checkout file t))) | 1442 (dolist (file files) (vc-checkout file t))) |
1435 (t | 1443 (t |
1436 ;; do nothing | 1444 ;; do nothing |
1437 (message "Fileset is up-to-date")))) | 1445 (message "Fileset is up-to-date")))) |
1438 ;; Files have local changes | 1446 ;; Files have local changes |
1439 ((eq state 'edited) | 1447 ((vc-compatible-state state 'edited) |
1440 (let ((ready-for-commit files)) | 1448 (let ((ready-for-commit files)) |
1441 ;; If files are edited but read-only, give user a chance to correct | 1449 ;; If files are edited but read-only, give user a chance to correct |
1442 (dolist (file files) | 1450 (dolist (file files) |
1443 (if (not (file-writable-p file)) | 1451 (if (not (file-writable-p file)) |
1444 (progn | 1452 (progn |
2347 (let ((backend (vc-responsible-backend default-directory))) | 2355 (let ((backend (vc-responsible-backend default-directory))) |
2348 ;; check `backend' can really handle `default-directory'. | 2356 ;; check `backend' can really handle `default-directory'. |
2349 (if (and (vc-call-backend backend 'responsible-p default-directory) | 2357 (if (and (vc-call-backend backend 'responsible-p default-directory) |
2350 (vc-find-backend-function backend 'dir-state)) | 2358 (vc-find-backend-function backend 'dir-state)) |
2351 (vc-call-backend backend 'dir-state default-directory))) | 2359 (vc-call-backend backend 'dir-state default-directory))) |
2352 (let (filename (inhibit-read-only t)) | 2360 (let (filename |
2361 (inhibit-read-only t) | |
2362 (buffer-undo-list t)) | |
2353 (goto-char (point-min)) | 2363 (goto-char (point-min)) |
2354 (while (not (eobp)) | 2364 (while (not (eobp)) |
2355 (cond | 2365 (cond |
2356 ;; subdir header line | 2366 ;; subdir header line |
2357 ((dired-get-subdir) | 2367 ((dired-get-subdir) |
2381 ((string-match "\\`\\.\\.?\\'" (file-name-nondirectory filename)) | 2391 ((string-match "\\`\\.\\.?\\'" (file-name-nondirectory filename)) |
2382 (dired-kill-line)) | 2392 (dired-kill-line)) |
2383 (t | 2393 (t |
2384 (vc-dired-reformat-line nil) | 2394 (vc-dired-reformat-line nil) |
2385 (forward-line 1)))) | 2395 (forward-line 1)))) |
2386 ;; try to head off calling the expensive state query - | 2396 ;; Try to head off calling the expensive state query - |
2387 ;; ignore object files, TeX intermediate files, and so forth. | 2397 ;; ignore object files, TeX intermediate files, and so forth. |
2388 ((vc-dired-ignorable-p filename) | 2398 ((vc-dired-ignorable-p filename) |
2389 (dired-kill-line)) | 2399 (dired-kill-line)) |
2390 ;; ordinary file -- call the (possibly expensive) state query | 2400 ;; Ordinary file -- call the (possibly expensive) state query |
2391 (t | 2401 ;; |
2392 (let ((backend (vc-backend filename))) | 2402 ;; First case: unregistered or unknown. (Unknown shouldn't happen here) |
2393 (cond | 2403 ((member (vc-state filename) '(nil unregistered)) |
2394 ;; Not registered | 2404 (if vc-dired-terse-mode |
2395 ((not backend) | 2405 (dired-kill-line) |
2396 (if vc-dired-terse-mode | 2406 (vc-dired-reformat-line "?") |
2397 (dired-kill-line) | 2407 (forward-line 1))) |
2398 (vc-dired-reformat-line "?") | 2408 ;; Either we're in non-terse mode or it's out of date |
2399 (forward-line 1))) | 2409 ((not (and vc-dired-terse-mode (vc-up-to-date-p filename))) |
2400 ;; Either we're in non-terse mode or it's out of date | 2410 (vc-dired-reformat-line (vc-call dired-state-info filename)) |
2401 ((not (and vc-dired-terse-mode (vc-up-to-date-p filename))) | 2411 (forward-line 1)) |
2402 (vc-dired-reformat-line (vc-call dired-state-info filename)) | 2412 ;; Remaining cases are under version control but uninteresting |
2403 (forward-line 1)) | 2413 (t |
2404 ;; Remaining cases are under version control but uninteresting | 2414 (dired-kill-line)))) |
2405 (t | |
2406 (dired-kill-line))))))) | |
2407 ;; any other line | 2415 ;; any other line |
2408 (t (forward-line 1)))) | 2416 (t (forward-line 1)))) |
2409 (vc-dired-purge)) | 2417 (vc-dired-purge)) |
2410 (message "Getting version information... done") | 2418 (message "Getting version information... done") |
2411 (save-restriction | 2419 (save-restriction |
3074 ((stringp state) (concat "(" state ")")) | 3082 ((stringp state) (concat "(" state ")")) |
3075 ((eq state 'edited) (concat "(" (vc-user-login-name file) ")")) | 3083 ((eq state 'edited) (concat "(" (vc-user-login-name file) ")")) |
3076 ((eq state 'needs-merge) "(merge)") | 3084 ((eq state 'needs-merge) "(merge)") |
3077 ((eq state 'needs-patch) "(patch)") | 3085 ((eq state 'needs-patch) "(patch)") |
3078 ((eq state 'added) "(added)") | 3086 ((eq state 'added) "(added)") |
3087 ((eq state 'removed) "(removed)") | |
3079 ((eq state 'ignored) "(ignored)") ;; dired-hook filters this out | 3088 ((eq state 'ignored) "(ignored)") ;; dired-hook filters this out |
3080 ((eq state 'unregistered) "?") | 3089 ((eq state 'unregistered) "?") |
3081 ((eq state 'unlocked-changes) "(stale)") | 3090 ((eq state 'unlocked-changes) "(stale)") |
3082 ((not state) "(unknown)"))) | 3091 ((not state) "(unknown)"))) |
3083 (buffer | 3092 (buffer |