diff options
| author | Eric S. Raymond | 2008-01-01 11:17:37 +0000 |
|---|---|---|
| committer | Eric S. Raymond | 2008-01-01 11:17:37 +0000 |
| commit | c59a24425bd684d22213781c70c2a8a5b01b3aa0 (patch) | |
| tree | 97ec447f66bf5380df9c202b847b7aab420ee13f | |
| parent | 1fb7205b0189dc6a7a51566d9bb8a18caad4598b (diff) | |
| download | emacs-c59a24425bd684d22213781c70c2a8a5b01b3aa0.tar.gz emacs-c59a24425bd684d22213781c70c2a8a5b01b3aa0.zip | |
* vc.el (vc-dired-hook): Speed tuning. Replace a vc-backend call
with vc-state.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc-svn.el | 26 | ||||
| -rw-r--r-- | lisp/vc.el | 34 |
3 files changed, 36 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 29eff1f1d2a..582cfb115fc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-01-01 Eric S. Raymond <esr@snark.thyrsus.com> | ||
| 2 | |||
| 3 | * vc.el (vc-dired-hook): Speed tuning. Replace a vc-backend call | ||
| 4 | with vc-state. | ||
| 5 | |||
| 1 | 2007-12-31 Tom Tromey <address@hidden> | 6 | 2007-12-31 Tom Tromey <address@hidden> |
| 2 | 7 | ||
| 3 | * emacs-lisp/elp.el (elp-results): Use header-line-format for | 8 | * emacs-lisp/elp.el (elp-results): Use header-line-format for |
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index c1261c5d0a4..96bc1284f76 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el | |||
| @@ -536,6 +536,10 @@ and that it passes `vc-svn-global-switches' to it before FLAGS." | |||
| 536 | nil) | 536 | nil) |
| 537 | (message "There are unresolved conflicts in this file"))) | 537 | (message "There are unresolved conflicts in this file"))) |
| 538 | 538 | ||
| 539 | (defun vc-file-setprop2 (f p v) | ||
| 540 | (message (format "On file %s. setting property %s to %s" f p v)) | ||
| 541 | (sit-for 2)) | ||
| 542 | |||
| 539 | (defun vc-svn-parse-status (&optional filename) | 543 | (defun vc-svn-parse-status (&optional filename) |
| 540 | "Parse output of \"svn status\" command in the current buffer. | 544 | "Parse output of \"svn status\" command in the current buffer. |
| 541 | Set file properties accordingly. Unless FILENAME is non-nil, parse only | 545 | Set file properties accordingly. Unless FILENAME is non-nil, parse only |
| @@ -544,7 +548,7 @@ information about FILENAME and return its status." | |||
| 544 | (goto-char (point-min)) | 548 | (goto-char (point-min)) |
| 545 | (while (re-search-forward | 549 | (while (re-search-forward |
| 546 | ;; Ignore the files with status X. | 550 | ;; Ignore the files with status X. |
| 547 | "^[ ACDGIMR!?~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t) | 551 | "^\\? +|^[ ACDGIMR!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t) |
| 548 | ;; If the username contains spaces, the output format is ambiguous, | 552 | ;; If the username contains spaces, the output format is ambiguous, |
| 549 | ;; so don't trust the output's filename unless we have to. | 553 | ;; so don't trust the output's filename unless we have to. |
| 550 | (setq file (or filename | 554 | (setq file (or filename |
| @@ -552,37 +556,37 @@ information about FILENAME and return its status." | |||
| 552 | (buffer-substring (point) (line-end-position))))) | 556 | (buffer-substring (point) (line-end-position))))) |
| 553 | (setq status (char-after (line-beginning-position))) | 557 | (setq status (char-after (line-beginning-position))) |
| 554 | (if (eq status ??) | 558 | (if (eq status ??) |
| 555 | (vc-file-setprop file 'vc-state 'unregistered) | 559 | (vc-file-setprop2 file 'vc-state 'unregistered) |
| 556 | ;; `vc-BACKEND-registered' must not set vc-backend, | 560 | ;; `vc-BACKEND-registered' must not set vc-backend, |
| 557 | ;; which is instead set in vc-registered. | 561 | ;; which is instead set in vc-registered. |
| 558 | (unless filename (vc-file-setprop file 'vc-backend 'SVN)) | 562 | (unless filename (vc-file-setprop2 file 'vc-backend 'SVN)) |
| 559 | ;; Use the last-modified revision, so that searching in vc-print-log | 563 | ;; Use the last-modified revision, so that searching in vc-print-log |
| 560 | ;; output works. | 564 | ;; output works. |
| 561 | (vc-file-setprop file 'vc-working-revision (match-string 3)) | 565 | (vc-file-setprop2 file 'vc-working-revision (match-string 3)) |
| 562 | ;; Remember Svn's own status. | 566 | ;; Remember Svn's own status. |
| 563 | (vc-file-setprop file 'vc-svn-status status) | 567 | (vc-file-setprop2 file 'vc-svn-status status) |
| 564 | (vc-file-setprop | 568 | (vc-file-setprop2 |
| 565 | file 'vc-state | 569 | file 'vc-state |
| 566 | (cond | 570 | (cond |
| 567 | ((eq status ?\ ) | 571 | ((eq status ?\ ) |
| 568 | (if (eq (char-after (match-beginning 1)) ?*) | 572 | (if (eq (char-after (match-beginning 1)) ?*) |
| 569 | 'needs-patch | 573 | 'needs-patch |
| 570 | (vc-file-setprop file 'vc-checkout-time | 574 | (vc-file-setprop2 file 'vc-checkout-time |
| 571 | (nth 5 (file-attributes file))) | 575 | (nth 5 (file-attributes file))) |
| 572 | 'up-to-date)) | 576 | 'up-to-date)) |
| 573 | ((eq status ?A) | 577 | ((eq status ?A) |
| 574 | ;; If the file was actually copied, (match-string 2) is "-". | 578 | ;; If the file was actually copied, (match-string 2) is "-". |
| 575 | (vc-file-setprop file 'vc-working-revision "0") | 579 | (vc-file-setprop2 file 'vc-working-revision "0") |
| 576 | (vc-file-setprop file 'vc-checkout-time 0) | 580 | (vc-file-setprop2 file 'vc-checkout-time 0) |
| 577 | 'added) | 581 | 'added) |
| 578 | ((memq status '(?M ?C)) | 582 | ((memq status '(?M ?C)) |
| 579 | (if (eq (char-after (match-beginning 1)) ?*) | 583 | (if (eq (char-after (match-beginning 1)) ?*) |
| 580 | 'needs-merge | 584 | 'needs-merge |
| 581 | 'edited)) | 585 | 'edited)) |
| 582 | ((eq status ?I) | 586 | ((eq status ?I) |
| 583 | (vc-file-setprop file 'vc-state 'ignored)) | 587 | (vc-file-setprop2 file 'vc-state 'ignored)) |
| 584 | ((eq status ?R) | 588 | ((eq status ?R) |
| 585 | (vc-file-setprop file 'vc-state 'removed)) | 589 | (vc-file-setprop2 file 'vc-state 'removed)) |
| 586 | (t 'edited))))) | 590 | (t 'edited))))) |
| 587 | (if filename (vc-file-getprop filename 'vc-state)))) | 591 | (if filename (vc-file-getprop filename 'vc-state)))) |
| 588 | 592 | ||
diff --git a/lisp/vc.el b/lisp/vc.el index 621802cf4a9..ddcb53a0cb6 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -2393,27 +2393,25 @@ Called by dired after any portion of a vc-dired buffer has been read in." | |||
| 2393 | (t | 2393 | (t |
| 2394 | (vc-dired-reformat-line nil) | 2394 | (vc-dired-reformat-line nil) |
| 2395 | (forward-line 1)))) | 2395 | (forward-line 1)))) |
| 2396 | ;; try to head off calling the expensive state query - | 2396 | ;; Try to head off calling the expensive state query - |
| 2397 | ;; ignore object files, TeX intermediate files, and so forth. | 2397 | ;; ignore object files, TeX intermediate files, and so forth. |
| 2398 | ((vc-dired-ignorable-p filename) | 2398 | ((vc-dired-ignorable-p filename) |
| 2399 | (dired-kill-line)) | 2399 | (dired-kill-line)) |
| 2400 | ;; ordinary file -- call the (possibly expensive) state query | 2400 | ;; Ordinary file -- call the (possibly expensive) state query |
| 2401 | (t | 2401 | ;; |
| 2402 | (let ((backend (vc-backend filename))) | 2402 | ;; First case: unregistered or unknown. (Unknown shouldn't happen here) |
| 2403 | (cond | 2403 | ((member (vc-state filename) '(nil unregistered)) |
| 2404 | ;; Not registered | 2404 | (if vc-dired-terse-mode |
| 2405 | ((not backend) | 2405 | (dired-kill-line) |
| 2406 | (if vc-dired-terse-mode | 2406 | (vc-dired-reformat-line "?") |
| 2407 | (dired-kill-line) | 2407 | (forward-line 1))) |
| 2408 | (vc-dired-reformat-line "?") | 2408 | ;; Either we're in non-terse mode or it's out of date |
| 2409 | (forward-line 1))) | 2409 | ((not (and vc-dired-terse-mode (vc-up-to-date-p filename))) |
| 2410 | ;; Either we're in non-terse mode or it's out of date | 2410 | (vc-dired-reformat-line (vc-call dired-state-info filename)) |
| 2411 | ((not (and vc-dired-terse-mode (vc-up-to-date-p filename))) | 2411 | (forward-line 1)) |
| 2412 | (vc-dired-reformat-line (vc-call dired-state-info filename)) | 2412 | ;; Remaining cases are under version control but uninteresting |
| 2413 | (forward-line 1)) | 2413 | (t |
| 2414 | ;; Remaining cases are under version control but uninteresting | 2414 | (dired-kill-line)))) |
| 2415 | (t | ||
| 2416 | (dired-kill-line))))))) | ||
| 2417 | ;; any other line | 2415 | ;; any other line |
| 2418 | (t (forward-line 1)))) | 2416 | (t (forward-line 1)))) |
| 2419 | (vc-dired-purge)) | 2417 | (vc-dired-purge)) |