diff options
| author | Dan Nicolaescu | 2009-12-08 15:56:57 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2009-12-08 15:56:57 +0000 |
| commit | e2f3c6923a614b73e0c73bcb22ba78db7b5e01be (patch) | |
| tree | f4f8eb409e62d0b95eac2a1b23d6057f68ffedd3 | |
| parent | cf6d035204914b0e7a84566f04835b996cf6ab6c (diff) | |
| download | emacs-e2f3c6923a614b73e0c73bcb22ba78db7b5e01be.tar.gz emacs-e2f3c6923a614b73e0c73bcb22ba78db7b5e01be.zip | |
Add support for stashing a snapshot of the current tree.
* vc-git.el (vc-git-stash-snapshot): New function.
(vc-git-stash-map, vc-git-extra-menu-map): Add a mapping for it.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/vc-git.el | 19 |
2 files changed, 23 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 67f5bab1d81..269e28a63e9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-12-08 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | Add support for stashing a snapshot of the current tree. | ||
| 4 | * vc-git.el (vc-git-stash-snapshot): New function. | ||
| 5 | (vc-git-stash-map, vc-git-extra-menu-map): Add a mapping for it. | ||
| 6 | |||
| 1 | 2009-12-08 Jose E. Marchesi <jemarch@gnu.org> | 7 | 2009-12-08 Jose E. Marchesi <jemarch@gnu.org> |
| 2 | 8 | ||
| 3 | * play/gomoku.el (gomoku-mode-map): Remap `move-(beginning|end)-of-line' | 9 | * play/gomoku.el (gomoku-mode-map): Remap `move-(beginning|end)-of-line' |
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 635c9d7cef9..69e861434ba 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el | |||
| @@ -414,6 +414,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 414 | (define-key map "\C-m" 'vc-git-stash-show-at-point) | 414 | (define-key map "\C-m" 'vc-git-stash-show-at-point) |
| 415 | (define-key map "A" 'vc-git-stash-apply-at-point) | 415 | (define-key map "A" 'vc-git-stash-apply-at-point) |
| 416 | (define-key map "P" 'vc-git-stash-pop-at-point) | 416 | (define-key map "P" 'vc-git-stash-pop-at-point) |
| 417 | (define-key map "S" 'vc-git-stash-snapshot) | ||
| 417 | map)) | 418 | map)) |
| 418 | 419 | ||
| 419 | (defvar vc-git-stash-menu-map | 420 | (defvar vc-git-stash-menu-map |
| @@ -756,8 +757,11 @@ or BRANCH^ (where \"^\" can be repeated)." | |||
| 756 | (define-key map [git-grep] | 757 | (define-key map [git-grep] |
| 757 | '(menu-item "Git grep..." vc-git-grep | 758 | '(menu-item "Git grep..." vc-git-grep |
| 758 | :help "Run the `git grep' command")) | 759 | :help "Run the `git grep' command")) |
| 760 | (define-key map [git-sn] | ||
| 761 | '(menu-item "Stash a snapshot" vc-git-stash-snapshot | ||
| 762 | :help "Stash the current state of the tree and keep the current state")) | ||
| 759 | (define-key map [git-st] | 763 | (define-key map [git-st] |
| 760 | '(menu-item "Stash..." vc-git-stash | 764 | '(menu-item "Create Stash..." vc-git-stash |
| 761 | :help "Stash away changes")) | 765 | :help "Stash away changes")) |
| 762 | (define-key map [git-ss] | 766 | (define-key map [git-ss] |
| 763 | '(menu-item "Show Stash..." vc-git-stash-show | 767 | '(menu-item "Show Stash..." vc-git-stash-show |
| @@ -863,6 +867,17 @@ This command shares argument histories with \\[rgrep] and \\[grep]." | |||
| 863 | (vc-git-command "*vc-git-stash*" 0 nil "stash" "pop" "-q" name) | 867 | (vc-git-command "*vc-git-stash*" 0 nil "stash" "pop" "-q" name) |
| 864 | (vc-resynch-buffer (vc-git-root default-directory) t t)) | 868 | (vc-resynch-buffer (vc-git-root default-directory) t t)) |
| 865 | 869 | ||
| 870 | (defun vc-git-stash-snapshot () | ||
| 871 | "Create a stash with the current tree state." | ||
| 872 | (interactive) | ||
| 873 | (vc-git--call nil "stash" "save" | ||
| 874 | (let ((ct (current-time))) | ||
| 875 | (concat | ||
| 876 | (format-time-string "Snapshot on %Y-%m-%d" ct) | ||
| 877 | (format-time-string " at %H:%M" ct)))) | ||
| 878 | (vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" "stash@{0}") | ||
| 879 | (vc-resynch-buffer (vc-git-root default-directory) t t)) | ||
| 880 | |||
| 866 | (defun vc-git-stash-list () | 881 | (defun vc-git-stash-list () |
| 867 | (delete | 882 | (delete |
| 868 | "" | 883 | "" |
| @@ -882,7 +897,7 @@ This command shares argument histories with \\[rgrep] and \\[grep]." | |||
| 882 | (defun vc-git-stash-delete-at-point () | 897 | (defun vc-git-stash-delete-at-point () |
| 883 | (interactive) | 898 | (interactive) |
| 884 | (let ((stash (vc-git-stash-get-at-point (point)))) | 899 | (let ((stash (vc-git-stash-get-at-point (point)))) |
| 885 | (when (y-or-n-p (format "Remove stash %s ?" stash)) | 900 | (when (y-or-n-p (format "Remove stash %s ? " stash)) |
| 886 | (vc-git--run-command-string nil "stash" "drop" (format "stash@%s" stash)) | 901 | (vc-git--run-command-string nil "stash" "drop" (format "stash@%s" stash)) |
| 887 | (vc-dir-refresh)))) | 902 | (vc-dir-refresh)))) |
| 888 | 903 | ||