diff options
| author | Dan Nicolaescu | 2009-12-28 22:46:08 -0800 |
|---|---|---|
| committer | Dan Nicolaescu | 2009-12-28 22:46:08 -0800 |
| commit | 460f6e7ced30ef7dbbf05284f0ca28f94e613c71 (patch) | |
| tree | 641713054763038debc2b4d94e4f1e7712a0b9fe | |
| parent | 5ce6e4f452e31c2eebc12e6f1e7146d2352f22e2 (diff) | |
| download | emacs-460f6e7ced30ef7dbbf05284f0ca28f94e613c71.tar.gz emacs-460f6e7ced30ef7dbbf05284f0ca28f94e613c71.zip | |
Make vc-dir work on subdirectories of the bzr root.
* vc-bzr.el (vc-bzr-after-dir-status): Add new argument. Return
file names relative to it.
(vc-bzr-dir-status, vc-bzr-dir-status-files): Pass the bzr root
relative directory to vc-bzr-after-dir-status.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/vc-bzr.el | 26 |
2 files changed, 26 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7407e60efb4..6661ee7d768 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-12-29 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | Make vc-dir work on subdirectories of the bzr root. | ||
| 4 | * vc-bzr.el (vc-bzr-after-dir-status): Add new argument. Return | ||
| 5 | file names relative to it. | ||
| 6 | (vc-bzr-dir-status, vc-bzr-dir-status-files): Pass the bzr root | ||
| 7 | relative directory to vc-bzr-after-dir-status. | ||
| 8 | |||
| 1 | 2009-12-28 Tassilo Horn <tassilo@member.fsf.org> | 9 | 2009-12-28 Tassilo Horn <tassilo@member.fsf.org> |
| 2 | 10 | ||
| 3 | * font-lock.el (font-lock-refresh-defaults): New function, which | 11 | * font-lock.el (font-lock-refresh-defaults): New function, which |
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index 99b910e9f94..fff4eca57fa 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el | |||
| @@ -639,7 +639,7 @@ stream. Standard error output is discarded." | |||
| 639 | 'face 'font-lock-comment-face))))) | 639 | 'face 'font-lock-comment-face))))) |
| 640 | 640 | ||
| 641 | ;; FIXME: this needs testing, it's probably incomplete. | 641 | ;; FIXME: this needs testing, it's probably incomplete. |
| 642 | (defun vc-bzr-after-dir-status (update-function) | 642 | (defun vc-bzr-after-dir-status (update-function relative-dir) |
| 643 | (let ((status-str nil) | 643 | (let ((status-str nil) |
| 644 | (translation '(("+N " . added) | 644 | (translation '(("+N " . added) |
| 645 | ("-D " . removed) | 645 | ("-D " . removed) |
| @@ -687,16 +687,17 @@ stream. Standard error output is discarded." | |||
| 687 | (setf (nth 1 entry) 'conflict)))) | 687 | (setf (nth 1 entry) 'conflict)))) |
| 688 | ((eq translated 'renamed) | 688 | ((eq translated 'renamed) |
| 689 | (re-search-forward "R \\(.*\\) => \\(.*\\)$" (line-end-position) t) | 689 | (re-search-forward "R \\(.*\\) => \\(.*\\)$" (line-end-position) t) |
| 690 | (let ((new-name (match-string 2)) | 690 | (let ((new-name (file-relative-name (match-string 2) relative-dir)) |
| 691 | (old-name (match-string 1))) | 691 | (old-name (file-relative-name (match-string 1) relative-dir))) |
| 692 | (push (list new-name 'edited | 692 | (push (list new-name 'edited |
| 693 | (vc-bzr-create-extra-fileinfo old-name)) result))) | 693 | (vc-bzr-create-extra-fileinfo old-name)) result))) |
| 694 | ;; do nothing for non existent files | 694 | ;; do nothing for non existent files |
| 695 | ((eq translated 'not-found)) | 695 | ((eq translated 'not-found)) |
| 696 | (t | 696 | (t |
| 697 | (push (list (buffer-substring-no-properties | 697 | (push (list (file-relative-name |
| 698 | (+ (point) 4) | 698 | (buffer-substring-no-properties |
| 699 | (line-end-position)) | 699 | (+ (point) 4) |
| 700 | (line-end-position)) relative-dir) | ||
| 700 | translated) result))) | 701 | translated) result))) |
| 701 | (forward-line)) | 702 | (forward-line)) |
| 702 | (funcall update-function result))) | 703 | (funcall update-function result))) |
| @@ -705,13 +706,22 @@ stream. Standard error output is discarded." | |||
| 705 | "Return a list of conses (file . state) for DIR." | 706 | "Return a list of conses (file . state) for DIR." |
| 706 | (vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S") | 707 | (vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S") |
| 707 | (vc-exec-after | 708 | (vc-exec-after |
| 708 | `(vc-bzr-after-dir-status (quote ,update-function)))) | 709 | `(vc-bzr-after-dir-status (quote ,update-function) |
| 710 | ;; "bzr status" results are relative to | ||
| 711 | ;; the bzr root directory, NOT to the | ||
| 712 | ;; directory "bzr status" was invoked in. | ||
| 713 | ;; Ugh. | ||
| 714 | ;; We pass the relative directory here so | ||
| 715 | ;; that `vc-bzr-after-dir-status' can | ||
| 716 | ;; frob the results accordingly. | ||
| 717 | (file-relative-name ,dir (vc-bzr-root ,dir))))) | ||
| 709 | 718 | ||
| 710 | (defun vc-bzr-dir-status-files (dir files default-state update-function) | 719 | (defun vc-bzr-dir-status-files (dir files default-state update-function) |
| 711 | "Return a list of conses (file . state) for DIR." | 720 | "Return a list of conses (file . state) for DIR." |
| 712 | (apply 'vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S" files) | 721 | (apply 'vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S" files) |
| 713 | (vc-exec-after | 722 | (vc-exec-after |
| 714 | `(vc-bzr-after-dir-status (quote ,update-function)))) | 723 | `(vc-bzr-after-dir-status (quote ,update-function) |
| 724 | (file-relative-name ,dir (vc-bzr-root ,dir))))) | ||
| 715 | 725 | ||
| 716 | (defvar vc-bzr-shelve-map | 726 | (defvar vc-bzr-shelve-map |
| 717 | (let ((map (make-sparse-keymap))) | 727 | (let ((map (make-sparse-keymap))) |