emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/vc-git.el


From: Dan Nicolaescu
Subject: [Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/vc-git.el
Date: Thu, 03 Dec 2009 04:08:13 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   09/12/03 04:08:12

Modified files:
        etc            : NEWS 
        lisp           : ChangeLog vc-git.el 

Log message:
        Support applying stashes.  Improve UI.
        * vc-git.el (vc-git-dir-extra-headers): Add tooltips.
        (vc-git-stash-apply, vc-git-stash-pop)
        (vc-git-stash-apply-at-point, vc-git-stash-pop-at-point)
        (vc-git-stash-menu): New functions.
        (vc-git-stash-menu-map): New variable.
        (vc-git-stash-map): Add bindings to popup a menu and to apply stashes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/etc/NEWS?cvsroot=emacs&r1=1.2132&r2=1.2133
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16806&r2=1.16807
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/vc-git.el?cvsroot=emacs&r1=1.101&r2=1.102

Patches:
Index: etc/NEWS
===================================================================
RCS file: /cvsroot/emacs/emacs/etc/NEWS,v
retrieving revision 1.2132
retrieving revision 1.2133
diff -u -b -r1.2132 -r1.2133
--- etc/NEWS    1 Dec 2009 04:04:33 -0000       1.2132
+++ etc/NEWS    3 Dec 2009 04:08:08 -0000       1.2133
@@ -264,7 +264,7 @@
 Signed-off-by line when committing.
 
 **** Support for operating with stashes has been added to vc-dir: the stash 
list is
-displayed in the *vc-dir* header, stashes can be created, removed and
+displayed in the *vc-dir* header, stashes can be created, removed, applied and
 their content displayed.
 
 **** vc-dir displays the stash status

Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16806
retrieving revision 1.16807
diff -u -b -r1.16806 -r1.16807
--- lisp/ChangeLog      3 Dec 2009 03:11:14 -0000       1.16806
+++ lisp/ChangeLog      3 Dec 2009 04:08:09 -0000       1.16807
@@ -1,3 +1,13 @@
+2009-12-03  Dan Nicolaescu  <address@hidden>
+
+       Support applying stashes.  Improve UI.
+       * vc-git.el (vc-git-dir-extra-headers): Add tooltips.
+       (vc-git-stash-apply, vc-git-stash-pop)
+       (vc-git-stash-apply-at-point, vc-git-stash-pop-at-point)
+       (vc-git-stash-menu): New functions.
+       (vc-git-stash-menu-map): New variable.
+       (vc-git-stash-map): Add bindings to popup a menu and to apply stashes.
+
 2009-12-03  Glenn Morris  <address@hidden>
 
        * vc.el (log-view-vc-backend, log-view-vc-fileset): Declare.

Index: lisp/vc-git.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -b -r1.101 -r1.102
--- lisp/vc-git.el      30 Nov 2009 21:21:38 -0000      1.101
+++ lisp/vc-git.el      3 Dec 2009 04:08:12 -0000       1.102
@@ -405,9 +405,31 @@
 
 (defvar vc-git-stash-map
   (let ((map (make-sparse-keymap)))
+    ;; Turn off vc-dir marking
+    (define-key map [mouse-2] 'ignore)
+
+    (define-key map [down-mouse-3] 'vc-git-stash-menu)
     (define-key map "\C-k" 'vc-git-stash-delete-at-point)
     (define-key map "=" 'vc-git-stash-show-at-point)
     (define-key map "\C-m" 'vc-git-stash-show-at-point)
+    (define-key map "A" 'vc-git-stash-apply-at-point)
+    (define-key map "P" 'vc-git-stash-pop-at-point)
+    map))
+
+(defvar vc-git-stash-menu-map
+  (let ((map (make-sparse-keymap "Git Stash")))
+    (define-key map [de]
+      '(menu-item "Delete stash" vc-git-stash-delete-at-point
+                 :help "Delete the current stash"))
+    (define-key map [ap]
+      '(menu-item "Apply stash" vc-git-stash-apply-at-point
+                 :help "Apply the current stash and keep it in the stash 
list"))
+    (define-key map [po]
+      '(menu-item "Apply and remove stash (pop)" vc-git-stash-pop-at-point
+                 :help "Apply the current stash and remove it"))
+    (define-key map [sh]
+      '(menu-item "Show stash" vc-git-stash-show-at-point
+                 :help "Show the contents of the current stash"))
     map))
 
 (defun vc-git-dir-extra-headers (dir)
@@ -415,6 +437,7 @@
                (with-current-buffer standard-output
                  (vc-git--out-ok "symbolic-ref" "HEAD"))))
        (stash (vc-git-stash-list))
+       (stash-help-echo "Use M-x vc-git-stash to create stashes.")
        branch remote remote-url)
     (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
        (progn
@@ -447,17 +470,21 @@
      "\n"
      (if stash
        (concat
-       (propertize "Stash      :\n" 'face 'font-lock-type-face)
+       (propertize "Stash      :\n" 'face 'font-lock-type-face
+                   'help-echo stash-help-echo)
        (mapconcat
         (lambda (x)
           (propertize x
                       'face 'font-lock-variable-name-face
                       'mouse-face 'highlight
+                      'help-echo "mouse-3: Show stash menu\nRET: Show 
stash\nA: Apply stash\nP: Apply and remove stash (pop)\nC-k: Delete stash"
                       'keymap vc-git-stash-map))
         stash "\n"))
        (concat
-       (propertize "Stash      : " 'face 'font-lock-type-face)
+       (propertize "Stash      : " 'face 'font-lock-type-face
+                   'help-echo stash-help-echo)
        (propertize "Nothing stashed"
+                   'help-echo stash-help-echo
                    'face 'font-lock-variable-name-face))))))
 
 ;;; STATE-CHANGING FUNCTIONS
@@ -816,6 +843,18 @@
   (setq buffer-read-only t)
   (pop-to-buffer (current-buffer)))
 
+(defun vc-git-stash-apply (name)
+  "Apply stash NAME."
+  (interactive "sApply stash: ")
+  (vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" name)
+  (vc-resynch-buffer (vc-git-root default-directory) t t))
+
+(defun vc-git-stash-pop (name)
+  "Pop stash NAME."
+  (interactive "sPop stash: ")
+  (vc-git-command "*vc-git-stash*" 0 nil "stash" "pop" "-q" name)
+  (vc-resynch-buffer (vc-git-root default-directory) t t))
+
 (defun vc-git-stash-list ()
   (delete
    ""
@@ -843,6 +882,18 @@
   (interactive)
   (vc-git-stash-show (format "address@hidden" (vc-git-stash-get-at-point 
(point)))))
 
+(defun vc-git-stash-apply-at-point ()
+  (interactive)
+  (vc-git-stash-apply (format "address@hidden" (vc-git-stash-get-at-point 
(point)))))
+
+(defun vc-git-stash-pop-at-point ()
+  (interactive)
+  (vc-git-stash-pop (format "address@hidden" (vc-git-stash-get-at-point 
(point)))))
+
+(defun vc-git-stash-menu (e)
+  (interactive "e")
+  (vc-dir-at-event e (popup-menu vc-git-stash-menu-map e)))
+
 
 ;;; Internal commands
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]