Commit 855a2294 authored by Dan Nicolaescu's avatar Dan Nicolaescu

Add support for shelving snapshots and for showing shelves.

* vc-bzr.el (vc-bzr-shelve-show, vc-bzr-shelve-show-at-point)
(vc-bzr-shelve-apply-and-keep-at-point, vc-bzr-shelve-snapshot):
New functions.
(vc-bzr-shelve-map, vc-bzr-shelve-menu-map)
(vc-bzr-extra-menu-map): Map them.
parent 00fe2df1
...@@ -36,6 +36,10 @@ so we will look at it and add it to the manual. ...@@ -36,6 +36,10 @@ so we will look at it and add it to the manual.
* Changes in Specialized Modes and Packages in Emacs 24.1 * Changes in Specialized Modes and Packages in Emacs 24.1
** VC and related modes
*** vc-dir for Bzr supports viewing shelve contents and shelving snapshots.
* New Modes and Packages in Emacs 24.1 * New Modes and Packages in Emacs 24.1
......
2010-03-12 Dan Nicolaescu <dann@ics.uci.edu>
Add support for shelving snapshots and for showing shelves.
* vc-bzr.el (vc-bzr-shelve-show, vc-bzr-shelve-show-at-point)
(vc-bzr-shelve-apply-and-keep-at-point, vc-bzr-shelve-snapshot):
New functions.
(vc-bzr-shelve-map, vc-bzr-shelve-menu-map)
(vc-bzr-extra-menu-map): Map them.
2010-03-11 Glenn Morris <rgm@gnu.org> 2010-03-11 Glenn Morris <rgm@gnu.org>
* cus-edit.el (customize-changed-options-previous-release): * cus-edit.el (customize-changed-options-previous-release):
......
...@@ -2269,7 +2269,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" . archive-mode) ...@@ -2269,7 +2269,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" . archive-mode)
("\\.dtd\\'" . sgml-mode) ("\\.dtd\\'" . sgml-mode)
("\\.ds\\(ss\\)?l\\'" . dsssl-mode) ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
("\\.js\\'" . js-mode) ; javascript-mode would be better ("\\.js\\'" . js-mode) ; javascript-mode would be better
("\\.[ds]?v\\'" . verilog-mode) ("\\.[ds]?vh?\\'" . verilog-mode)
;; .emacs or .gnus or .viper following a directory delimiter in ;; .emacs or .gnus or .viper following a directory delimiter in
;; Unix, MSDOG or VMS syntax. ;; Unix, MSDOG or VMS syntax.
("[]>:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode) ("[]>:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode)
......
...@@ -758,9 +758,11 @@ stream. Standard error output is discarded." ...@@ -758,9 +758,11 @@ stream. Standard error output is discarded."
(define-key map [down-mouse-3] 'vc-bzr-shelve-menu) (define-key map [down-mouse-3] 'vc-bzr-shelve-menu)
(define-key map "\C-k" 'vc-bzr-shelve-delete-at-point) (define-key map "\C-k" 'vc-bzr-shelve-delete-at-point)
;; (define-key map "=" 'vc-bzr-shelve-show-at-point) (define-key map "=" 'vc-bzr-shelve-show-at-point)
;; (define-key map "\C-m" 'vc-bzr-shelve-show-at-point) (define-key map "\C-m" 'vc-bzr-shelve-show-at-point)
(define-key map "A" 'vc-bzr-shelve-apply-and-keep-at-point)
(define-key map "P" 'vc-bzr-shelve-apply-at-point) (define-key map "P" 'vc-bzr-shelve-apply-at-point)
(define-key map "S" 'vc-bzr-shelve-snapshot)
map)) map))
(defvar vc-bzr-shelve-menu-map (defvar vc-bzr-shelve-menu-map
...@@ -768,16 +770,22 @@ stream. Standard error output is discarded." ...@@ -768,16 +770,22 @@ stream. Standard error output is discarded."
(define-key map [de] (define-key map [de]
'(menu-item "Delete shelf" vc-bzr-shelve-delete-at-point '(menu-item "Delete shelf" vc-bzr-shelve-delete-at-point
:help "Delete the current shelf")) :help "Delete the current shelf"))
(define-key map [ap]
'(menu-item "Apply and keep shelf" vc-bzr-shelve-apply-and-keep-at-point
:help "Apply the current shelf and keep it"))
(define-key map [po] (define-key map [po]
'(menu-item "Apply and remove shelf (pop)" vc-bzr-shelve-apply-at-point '(menu-item "Apply and remove shelf (pop)" vc-bzr-shelve-apply-at-point
:help "Apply the current shelf and remove it")) :help "Apply the current shelf and remove it"))
;; (define-key map [sh] (define-key map [sh]
;; '(menu-item "Show shelve" vc-bzr-shelve-show-at-point '(menu-item "Show shelve" vc-bzr-shelve-show-at-point
;; :help "Show the contents of the current shelve")) :help "Show the contents of the current shelve"))
map)) map))
(defvar vc-bzr-extra-menu-map (defvar vc-bzr-extra-menu-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map [bzr-sn]
'(menu-item "Shelve a snapshot" vc-bzr-shelve-snapshot
:help "Shelve the current state of the tree and keep the current state"))
(define-key map [bzr-sh] (define-key map [bzr-sh]
'(menu-item "Shelve..." vc-bzr-shelve '(menu-item "Shelve..." vc-bzr-shelve
:help "Shelve changes")) :help "Shelve changes"))
...@@ -864,16 +872,16 @@ stream. Standard error output is discarded." ...@@ -864,16 +872,16 @@ stream. Standard error output is discarded."
(vc-bzr-command "shelve" nil 0 nil "--all" "-m" name) (vc-bzr-command "shelve" nil 0 nil "--all" "-m" name)
(vc-resynch-buffer root t t)))) (vc-resynch-buffer root t t))))
;; (defun vc-bzr-shelve-show (name) (defun vc-bzr-shelve-show (name)
;; "Show the contents of shelve NAME." "Show the contents of shelve NAME."
;; (interactive "sShelve name: ") (interactive "sShelve name: ")
;; (vc-setup-buffer "*vc-bzr-shelve*") (vc-setup-buffer "*vc-bzr-shelve*")
;; ;; FIXME: how can you show the contents of a shelf? ;; FIXME: how can you show the contents of a shelf?
;; (vc-bzr-command "shelve" "*vc-bzr-shelve*" 'async nil name) (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 'async nil "--preview" name)
;; (set-buffer "*vc-bzr-shelve*") (set-buffer "*vc-bzr-shelve*")
;; (diff-mode) (diff-mode)
;; (setq buffer-read-only t) (setq buffer-read-only t)
;; (pop-to-buffer (current-buffer))) (pop-to-buffer (current-buffer)))
(defun vc-bzr-shelve-apply (name) (defun vc-bzr-shelve-apply (name)
"Apply shelve NAME and remove it afterwards." "Apply shelve NAME and remove it afterwards."
...@@ -881,6 +889,23 @@ stream. Standard error output is discarded." ...@@ -881,6 +889,23 @@ stream. Standard error output is discarded."
(vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" name) (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" name)
(vc-resynch-buffer (vc-bzr-root default-directory) t t)) (vc-resynch-buffer (vc-bzr-root default-directory) t t))
(defun vc-bzr-shelve-apply-and-keep (name)
"Apply shelve NAME and keep it afterwards."
(interactive "sApply (and keep) shelf: ")
(vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" "--keep" name)
(vc-resynch-buffer (vc-bzr-root default-directory) t t))
(defun vc-bzr-shelve-snapshot ()
"Create a stash with the current tree state."
(interactive)
(vc-bzr-command "shelve" nil 0 nil "--all" "-m"
(let ((ct (current-time)))
(concat
(format-time-string "Snapshot on %Y-%m-%d" ct)
(format-time-string " at %H:%M" ct))))
(vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" "--keep")
(vc-resynch-buffer (vc-bzr-root default-directory) t t))
(defun vc-bzr-shelve-list () (defun vc-bzr-shelve-list ()
(with-temp-buffer (with-temp-buffer
(vc-bzr-command "shelve" (current-buffer) 1 nil "--list" "-q") (vc-bzr-command "shelve" (current-buffer) 1 nil "--list" "-q")
...@@ -905,14 +930,18 @@ stream. Standard error output is discarded." ...@@ -905,14 +930,18 @@ stream. Standard error output is discarded."
(vc-bzr-command "unshelve" nil 0 nil "--delete-only" shelve) (vc-bzr-command "unshelve" nil 0 nil "--delete-only" shelve)
(vc-dir-refresh)))) (vc-dir-refresh))))
;; (defun vc-bzr-shelve-show-at-point () (defun vc-bzr-shelve-show-at-point ()
;; (interactive) (interactive)
;; (vc-bzr-shelve-show (vc-bzr-shelve-get-at-point (point)))) (vc-bzr-shelve-show (vc-bzr-shelve-get-at-point (point))))
(defun vc-bzr-shelve-apply-at-point () (defun vc-bzr-shelve-apply-at-point ()
(interactive) (interactive)
(vc-bzr-shelve-apply (vc-bzr-shelve-get-at-point (point)))) (vc-bzr-shelve-apply (vc-bzr-shelve-get-at-point (point))))
(defun vc-bzr-shelve-apply-and-keep-at-point ()
(interactive)
(vc-bzr-shelve-apply-and-keep (vc-bzr-shelve-get-at-point (point))))
(defun vc-bzr-shelve-menu (e) (defun vc-bzr-shelve-menu (e)
(interactive "e") (interactive "e")
(vc-dir-at-event e (popup-menu vc-bzr-shelve-menu-map e))) (vc-dir-at-event e (popup-menu vc-bzr-shelve-menu-map e)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment