emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Dan Nicolaescu
Subject: [Emacs-diffs] emacs/lisp ChangeLog vc-git.el
Date: Thu, 23 Jul 2009 06:42:55 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   09/07/23 06:42:55

Modified files:
        lisp           : ChangeLog vc-git.el 

Log message:
        (vc-git--run-command-string): Accept a nil FILE argument.
        (vc-git-stash-list): New function.
        (vc-git-dir-extra-headers): Use it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15852&r2=1.15853
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/vc-git.el?cvsroot=emacs&r1=1.83&r2=1.84

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15852
retrieving revision 1.15853
diff -u -b -r1.15852 -r1.15853
--- ChangeLog   23 Jul 2009 05:41:24 -0000      1.15852
+++ ChangeLog   23 Jul 2009 06:42:50 -0000      1.15853
@@ -8,6 +8,9 @@
        (vc-git-checkin): Use it.
        (vc-git-toggle-signoff): New function.
        (vc-git-extra-menu-map): Bind it to menu.
+       (vc-git--run-command-string): Accept a nil FILE argument.
+       (vc-git-stash-list): New function.
+       (vc-git-dir-extra-headers): Use it.
 
 2009-07-23  Glenn Morris  <address@hidden>
 

Index: vc-git.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- vc-git.el   23 Jul 2009 05:17:30 -0000      1.83
+++ vc-git.el   23 Jul 2009 06:42:54 -0000      1.84
@@ -400,13 +400,21 @@
 (defun vc-git-dir-extra-headers (dir)
   (let ((str (with-output-to-string
                (with-current-buffer standard-output
-                 (vc-git--out-ok "symbolic-ref" "HEAD")))))
+                 (vc-git--out-ok "symbolic-ref" "HEAD"))))
+       (stash (vc-git-stash-list)))
+    ;; FIXME: maybe use a different face when nothing is stashed.
+    (when (string= stash "") (setq stash "Nothing stashed"))
     (concat
      (propertize "Branch     : " 'face 'font-lock-type-face)
      (propertize 
       (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
          (match-string 2 str)
        "not (detached HEAD)")
+       'face 'font-lock-variable-name-face)
+     "\n"
+     (propertize "Stash      : " 'face 'font-lock-type-face)
+     (propertize
+      stash
        'face 'font-lock-variable-name-face))))
 
 ;;; STATE-CHANGING FUNCTIONS
@@ -709,6 +717,13 @@
        (if (eq next-error-last-buffer (current-buffer))
            (setq default-directory dir))))))
 
+(defun vc-git-stash-list ()
+  (replace-regexp-in-string
+   "\n" "\n             "
+   (replace-regexp-in-string
+    "^stash@" "" (vc-git--run-command-string nil "stash" "list"))))
+
+
 ;;; Internal commands
 
 (defun vc-git-root (file)
@@ -733,13 +748,16 @@
   (zerop (apply 'vc-git--call '(t nil) command args)))
 
 (defun vc-git--run-command-string (file &rest args)
-  "Run a git command on FILE and return its output as string."
+  "Run a git command on FILE and return its output as string.
+FILE can be nil."
   (let* ((ok t)
          (str (with-output-to-string
                 (with-current-buffer standard-output
                   (unless (apply 'vc-git--out-ok
+                                (if file
                                  (append args (list (file-relative-name
-                                                     file))))
+                                                        file)))
+                                  args))
                     (setq ok nil))))))
     (and ok str)))
 




reply via email to

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