diff options
| author | Dan Nicolaescu | 2009-12-03 07:46:13 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2009-12-03 07:46:13 +0000 |
| commit | 4dfb3b9cd5fac23e5ffcde421102d5b4b1ba96ab (patch) | |
| tree | 54fe2c972424f2b9f12558c3ac629848046ff358 | |
| parent | 3f6bd7904e8a9a8c312089abcbf2f71ec11b5353 (diff) | |
| download | emacs-4dfb3b9cd5fac23e5ffcde421102d5b4b1ba96ab.tar.gz emacs-4dfb3b9cd5fac23e5ffcde421102d5b4b1ba96ab.zip | |
Add support for bzr shelve/unshelve.
* vc-bzr.el (vc-bzr-shelve-map, vc-bzr-shelve-menu-map)
(vc-bzr-extra-menu-map): New variables.
(vc-bzr-extra-menu, vc-bzr-extra-status-menu, vc-bzr-shelve)
(vc-bzr-shelve-apply, vc-bzr-shelve-list)
(vc-bzr-shelve-get-at-point, vc-bzr-shelve-delete-at-point)
(vc-bzr-shelve-apply-at-point, vc-bzr-shelve-menu): New functions.
(vc-bzr-dir-extra-headers): Display shelves.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/vc-bzr.el | 117 |
3 files changed, 129 insertions, 0 deletions
| @@ -269,6 +269,9 @@ their content displayed. | |||
| 269 | 269 | ||
| 270 | **** vc-dir displays the stash status | 270 | **** vc-dir displays the stash status |
| 271 | 271 | ||
| 272 | *** vc-bzr supports operating with shelves: the shelve list is | ||
| 273 | displayed in the *vc-dir* header, shelves can be created, removed and applied. | ||
| 274 | |||
| 272 | *** log-edit-strip-single-file-name controls whether or not single filenames | 275 | *** log-edit-strip-single-file-name controls whether or not single filenames |
| 273 | are stripped when copying text from the ChangeLog to the *VC-Log* buffer. | 276 | are stripped when copying text from the ChangeLog to the *VC-Log* buffer. |
| 274 | 277 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f6842769e69..73e4706853a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,14 @@ | |||
| 1 | 2009-12-03 Dan Nicolaescu <dann@ics.uci.edu> | 1 | 2009-12-03 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 2 | ||
| 3 | Add support for bzr shelve/unshelve. | ||
| 4 | * vc-bzr.el (vc-bzr-shelve-map, vc-bzr-shelve-menu-map) | ||
| 5 | (vc-bzr-extra-menu-map): New variables. | ||
| 6 | (vc-bzr-extra-menu, vc-bzr-extra-status-menu, vc-bzr-shelve) | ||
| 7 | (vc-bzr-shelve-apply, vc-bzr-shelve-list) | ||
| 8 | (vc-bzr-shelve-get-at-point, vc-bzr-shelve-delete-at-point) | ||
| 9 | (vc-bzr-shelve-apply-at-point, vc-bzr-shelve-menu): New functions. | ||
| 10 | (vc-bzr-dir-extra-headers): Display shelves. | ||
| 11 | |||
| 3 | * vc-bzr.el (vc-bzr-print-log): Deal with nil arguments better. | 12 | * vc-bzr.el (vc-bzr-print-log): Deal with nil arguments better. |
| 4 | 13 | ||
| 5 | 2009-12-03 Stefan Monnier <monnier@iro.umontreal.ca> | 14 | 2009-12-03 Stefan Monnier <monnier@iro.umontreal.ca> |
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el index 9f554b5bd92..1173d86842e 100644 --- a/lisp/vc-bzr.el +++ b/lisp/vc-bzr.el | |||
| @@ -704,11 +704,49 @@ stream. Standard error output is discarded." | |||
| 704 | (vc-exec-after | 704 | (vc-exec-after |
| 705 | `(vc-bzr-after-dir-status (quote ,update-function)))) | 705 | `(vc-bzr-after-dir-status (quote ,update-function)))) |
| 706 | 706 | ||
| 707 | (defvar vc-bzr-shelve-map | ||
| 708 | (let ((map (make-sparse-keymap))) | ||
| 709 | ;; Turn off vc-dir marking | ||
| 710 | (define-key map [mouse-2] 'ignore) | ||
| 711 | |||
| 712 | (define-key map [down-mouse-3] 'vc-bzr-shelve-menu) | ||
| 713 | (define-key map "\C-k" 'vc-bzr-shelve-delete-at-point) | ||
| 714 | ;; (define-key map "=" 'vc-bzr-shelve-show-at-point) | ||
| 715 | ;; (define-key map "\C-m" 'vc-bzr-shelve-show-at-point) | ||
| 716 | (define-key map "A" 'vc-bzr-shelve-apply-at-point) | ||
| 717 | map)) | ||
| 718 | |||
| 719 | (defvar vc-bzr-shelve-menu-map | ||
| 720 | (let ((map (make-sparse-keymap "Bzr Shelve"))) | ||
| 721 | (define-key map [de] | ||
| 722 | '(menu-item "Delete shelf" vc-bzr-shelve-delete-at-point | ||
| 723 | :help "Delete the current shelf")) | ||
| 724 | (define-key map [ap] | ||
| 725 | '(menu-item "Apply shelf" vc-bzr-shelve-apply-at-point | ||
| 726 | :help "Apply the current shelf")) | ||
| 727 | ;; (define-key map [sh] | ||
| 728 | ;; '(menu-item "Show shelve" vc-bzr-shelve-show-at-point | ||
| 729 | ;; :help "Show the contents of the current shelve")) | ||
| 730 | map)) | ||
| 731 | |||
| 732 | (defvar vc-bzr-extra-menu-map | ||
| 733 | (let ((map (make-sparse-keymap))) | ||
| 734 | (define-key map [bzr-sh] | ||
| 735 | '(menu-item "Shelve..." vc-bzr-shelve | ||
| 736 | :help "Shelve changes")) | ||
| 737 | map)) | ||
| 738 | |||
| 739 | (defun vc-bzr-extra-menu () vc-bzr-extra-menu-map) | ||
| 740 | |||
| 741 | (defun vc-bzr-extra-status-menu () vc-bzr-extra-menu-map) | ||
| 742 | |||
| 707 | (defun vc-bzr-dir-extra-headers (dir) | 743 | (defun vc-bzr-dir-extra-headers (dir) |
| 708 | (let* | 744 | (let* |
| 709 | ((str (with-temp-buffer | 745 | ((str (with-temp-buffer |
| 710 | (vc-bzr-command "info" t 0 dir) | 746 | (vc-bzr-command "info" t 0 dir) |
| 711 | (buffer-string))) | 747 | (buffer-string))) |
| 748 | (shelve (vc-bzr-shelve-list)) | ||
| 749 | (shelve-help-echo "Use M-x vc-bzr-shelve to create shelves") | ||
| 712 | (light-checkout | 750 | (light-checkout |
| 713 | (when (string-match ".+light checkout root: \\(.+\\)$" str) | 751 | (when (string-match ".+light checkout root: \\(.+\\)$" str) |
| 714 | (match-string 1 str))) | 752 | (match-string 1 str))) |
| @@ -734,6 +772,85 @@ stream. Standard error output is discarded." | |||
| 734 | (propertize "Checkout of branch : " 'face 'font-lock-type-face) | 772 | (propertize "Checkout of branch : " 'face 'font-lock-type-face) |
| 735 | (propertize light-checkout-branch 'face 'font-lock-variable-name-face) | 773 | (propertize light-checkout-branch 'face 'font-lock-variable-name-face) |
| 736 | "\n"))))) | 774 | "\n"))))) |
| 775 | (if shelve | ||
| 776 | (concat | ||
| 777 | (propertize "Shelves :\n" 'face 'font-lock-type-face | ||
| 778 | 'help-echo shelve-help-echo) | ||
| 779 | (mapconcat | ||
| 780 | (lambda (x) | ||
| 781 | (propertize x | ||
| 782 | 'face 'font-lock-variable-name-face | ||
| 783 | 'mouse-face 'highlight | ||
| 784 | 'help-echo "mouse-3: Show shelve menu\nA: Apply shelf\nC-k: Delete shelf" | ||
| 785 | 'keymap vc-bzr-shelve-map)) | ||
| 786 | shelve "\n")) | ||
| 787 | (concat | ||
| 788 | (propertize "Shelves : " 'face 'font-lock-type-face | ||
| 789 | 'help-echo shelve-help-echo) | ||
| 790 | (propertize "No shelved changes" | ||
| 791 | 'help-echo shelve-help-echo | ||
| 792 | 'face 'font-lock-variable-name-face)))))) | ||
| 793 | |||
| 794 | (defun vc-bzr-shelve (name) | ||
| 795 | "Create a shelve." | ||
| 796 | (interactive "sShelf name: ") | ||
| 797 | (let ((root (vc-bzr-root default-directory))) | ||
| 798 | (when root | ||
| 799 | (vc-bzr-command "shelve" nil 0 nil "--all" "-m" name) | ||
| 800 | (vc-resynch-buffer root t t)))) | ||
| 801 | |||
| 802 | ;; (defun vc-bzr-shelve-show (name) | ||
| 803 | ;; "Show the contents of shelve NAME." | ||
| 804 | ;; (interactive "sShelve name: ") | ||
| 805 | ;; (vc-setup-buffer "*vc-bzr-shelve*") | ||
| 806 | ;; ;; FIXME: how can you show the contents of a shelf? | ||
| 807 | ;; (vc-bzr-command "shelve" "*vc-bzr-shelve*" 'async nil name) | ||
| 808 | ;; (set-buffer "*vc-bzr-shelve*") | ||
| 809 | ;; (diff-mode) | ||
| 810 | ;; (setq buffer-read-only t) | ||
| 811 | ;; (pop-to-buffer (current-buffer))) | ||
| 812 | |||
| 813 | (defun vc-bzr-shelve-apply (name) | ||
| 814 | "Apply shelve NAME." | ||
| 815 | (interactive "sApply shelf: ") | ||
| 816 | (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" name) | ||
| 817 | (vc-resynch-buffer (vc-bzr-root default-directory) t t)) | ||
| 818 | |||
| 819 | (defun vc-bzr-shelve-list () | ||
| 820 | (with-temp-buffer | ||
| 821 | (vc-bzr-command "shelve" (current-buffer) 1 nil "--list" "-q") | ||
| 822 | (delete | ||
| 823 | "" | ||
| 824 | (split-string | ||
| 825 | (buffer-substring (point-min) (point-max)) | ||
| 826 | "\n")))) | ||
| 827 | |||
| 828 | (defun vc-bzr-shelve-get-at-point (point) | ||
| 829 | (save-excursion | ||
| 830 | (goto-char point) | ||
| 831 | (beginning-of-line) | ||
| 832 | (if (looking-at "^ +\\([0-9]+\\):") | ||
| 833 | (match-string 1) | ||
| 834 | (error "Cannot find shelf at point")))) | ||
| 835 | |||
| 836 | (defun vc-bzr-shelve-delete-at-point () | ||
| 837 | (interactive) | ||
| 838 | (let ((shelve (vc-bzr-shelve-get-at-point (point)))) | ||
| 839 | (when (y-or-n-p (format "Remove shelf %s ?" shelve)) | ||
| 840 | (vc-bzr-command "unshelve" nil 0 nil "--delete-only" shelve) | ||
| 841 | (vc-dir-refresh)))) | ||
| 842 | |||
| 843 | ;; (defun vc-bzr-shelve-show-at-point () | ||
| 844 | ;; (interactive) | ||
| 845 | ;; (vc-bzr-shelve-show (vc-bzr-shelve-get-at-point (point)))) | ||
| 846 | |||
| 847 | (defun vc-bzr-shelve-apply-at-point () | ||
| 848 | (interactive) | ||
| 849 | (vc-bzr-shelve-apply (vc-bzr-shelve-get-at-point (point)))) | ||
| 850 | |||
| 851 | (defun vc-bzr-shelve-menu (e) | ||
| 852 | (interactive "e") | ||
| 853 | (vc-dir-at-event e (popup-menu vc-bzr-shelve-menu-map e))) | ||
| 737 | 854 | ||
| 738 | ;;; Revision completion | 855 | ;;; Revision completion |
| 739 | 856 | ||