diff options
| author | Dan Nicolaescu | 2009-08-26 07:01:09 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2009-08-26 07:01:09 +0000 |
| commit | 2ddf440db15a2a683e10c9fb43a69b457872b41f (patch) | |
| tree | 1423e491ddc4c0cf67621b94934317d92ea1feeb | |
| parent | b91f07620f3a6fb4041b82c867de3b1d6138d9a4 (diff) | |
| download | emacs-2ddf440db15a2a683e10c9fb43a69b457872b41f.tar.gz emacs-2ddf440db15a2a683e10c9fb43a69b457872b41f.zip | |
(vc-git-stash, vc-git-stash-show): New functions.
(vc-git-extra-menu-map): Bind them.
| -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 @@ | |||
| 1 | 2009-08-26 Dan Nicolaescu <dann@ics.uci.edu> | 1 | 2009-08-26 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 2 | ||
| 3 | * vc-git.el (vc-git-register): Use "git add" for directories. | 3 | * vc-git.el (vc-git-register): Use "git add" for directories. |
| 4 | (vc-git-stash, vc-git-stash-show): New functions. | ||
| 5 | (vc-git-extra-menu-map): Bind them. | ||
| 4 | 6 | ||
| 5 | * vc-dir.el (vc-dir-node-directory, vc-dir-update): Get the parent | 7 | * vc-dir.el (vc-dir-node-directory, vc-dir-update): Get the parent |
| 6 | directory correctly in case the item is a directory itself. | 8 | 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)." | |||
| 662 | (define-key map [git-grep] | 662 | (define-key map [git-grep] |
| 663 | '(menu-item "Git grep..." vc-git-grep | 663 | '(menu-item "Git grep..." vc-git-grep |
| 664 | :help "Run the `git grep' command")) | 664 | :help "Run the `git grep' command")) |
| 665 | (define-key map [git-st] | ||
| 666 | '(menu-item "Stash..." vc-git-stash | ||
| 667 | :help "Stash away changes")) | ||
| 668 | (define-key map [git-ss] | ||
| 669 | '(menu-item "Show Stash..." vc-git-stash-show | ||
| 670 | :help "Show stash contents")) | ||
| 665 | (define-key map [git-sig] | 671 | (define-key map [git-sig] |
| 666 | '(menu-item "Add Signed-off-by on commit" vc-git-toggle-signoff | 672 | '(menu-item "Add Signed-off-by on commit" vc-git-toggle-signoff |
| 667 | :help "Add Add Signed-off-by when commiting (i.e. add the -s flag)" | 673 | :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]." | |||
| 730 | (if (eq next-error-last-buffer (current-buffer)) | 736 | (if (eq next-error-last-buffer (current-buffer)) |
| 731 | (setq default-directory dir)))))) | 737 | (setq default-directory dir)))))) |
| 732 | 738 | ||
| 739 | (defun vc-git-stash (name) | ||
| 740 | "Create a stash." | ||
| 741 | (interactive "sStash name: ") | ||
| 742 | (let ((root (vc-git-root default-directory))) | ||
| 743 | (when root | ||
| 744 | (vc-git--call nil "stash" "save" name) | ||
| 745 | (vc-resynch-buffer root t t)))) | ||
| 746 | |||
| 747 | (defun vc-git-stash-show (name) | ||
| 748 | "Show the contents of stash NAME." | ||
| 749 | (interactive "sStash name: ") | ||
| 750 | (vc-setup-buffer "*vc-git-stash*") | ||
| 751 | (vc-git-command "*vc-git-stash*" 'async nil "stash" "show" "-p" name) | ||
| 752 | (set-buffer "*vc-git-stash*") | ||
| 753 | (diff-mode) | ||
| 754 | (setq buffer-read-only t) | ||
| 755 | (pop-to-buffer (current-buffer))) | ||
| 756 | |||
| 733 | (defun vc-git-stash-list () | 757 | (defun vc-git-stash-list () |
| 734 | (replace-regexp-in-string | 758 | (replace-regexp-in-string |
| 735 | "\n" "\n " | 759 | "\n" "\n " |