diff options
author | Dan Nicolaescu <dann@ics.uci.edu> | 2009-08-26 07:01:09 +0000 |
---|---|---|
committer | Dan Nicolaescu <dann@ics.uci.edu> | 2009-08-26 07:01:09 +0000 |
commit | 2ddf440db15a2a683e10c9fb43a69b457872b41f (patch) | |
tree | 1423e491ddc4c0cf67621b94934317d92ea1feeb /lisp | |
parent | b91f07620f3a6fb4041b82c867de3b1d6138d9a4 (diff) | |
download | emacs-2ddf440db15a2a683e10c9fb43a69b457872b41f.tar.gz emacs-2ddf440db15a2a683e10c9fb43a69b457872b41f.tar.bz2 emacs-2ddf440db15a2a683e10c9fb43a69b457872b41f.zip |
(vc-git-stash, vc-git-stash-show): New functions.
(vc-git-extra-menu-map): Bind them.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 2 | ||||
-rw-r--r-- | lisp/vc-git.el | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed131c8f34e..1408e8ef075 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,8 @@ 2009-08-26 Dan Nicolaescu <dann@ics.uci.edu> * vc-git.el (vc-git-register): Use "git add" for directories. + (vc-git-stash, vc-git-stash-show): New functions. + (vc-git-extra-menu-map): Bind them. * vc-dir.el (vc-dir-node-directory, vc-dir-update): Get the parent directory correctly in case the item is a directory itself. diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 1d7da4b5c4a..3be88e1f80a 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el @@ -662,6 +662,12 @@ or BRANCH^ (where \"^\" can be repeated)." (define-key map [git-grep] '(menu-item "Git grep..." vc-git-grep :help "Run the `git grep' command")) + (define-key map [git-st] + '(menu-item "Stash..." vc-git-stash + :help "Stash away changes")) + (define-key map [git-ss] + '(menu-item "Show Stash..." vc-git-stash-show + :help "Show stash contents")) (define-key map [git-sig] '(menu-item "Add Signed-off-by on commit" vc-git-toggle-signoff :help "Add Add Signed-off-by when commiting (i.e. add the -s flag)" @@ -730,6 +736,24 @@ This command shares argument histories with \\[rgrep] and \\[grep]." (if (eq next-error-last-buffer (current-buffer)) (setq default-directory dir)))))) +(defun vc-git-stash (name) + "Create a stash." + (interactive "sStash name: ") + (let ((root (vc-git-root default-directory))) + (when root + (vc-git--call nil "stash" "save" name) + (vc-resynch-buffer root t t)))) + +(defun vc-git-stash-show (name) + "Show the contents of stash NAME." + (interactive "sStash name: ") + (vc-setup-buffer "*vc-git-stash*") + (vc-git-command "*vc-git-stash*" 'async nil "stash" "show" "-p" name) + (set-buffer "*vc-git-stash*") + (diff-mode) + (setq buffer-read-only t) + (pop-to-buffer (current-buffer))) + (defun vc-git-stash-list () (replace-regexp-in-string "\n" "\n " |