]> git.eshelyaron.com Git - emacs.git/commitdiff
Add support for vc-log-incoming, improve vc-log-outgoing for Git.
authorDan Nicolaescu <dann@ics.uci.edu>
Tue, 1 Jun 2010 10:40:09 +0000 (03:40 -0700)
committerDan Nicolaescu <dann@ics.uci.edu>
Tue, 1 Jun 2010 10:40:09 +0000 (03:40 -0700)
* lisp/vc-git.el (vc-git-compute-remote): New function.
(vc-git-log-outgoing): Use it instead of hard coding a value.
(vc-git-log-incoming): New function.

lisp/ChangeLog
lisp/vc-git.el

index d7b6bcd9cb2133b5b25090861135a62c176d4664..a2c62a84a8ec77e048a68640cce8ac84fa114091 100644 (file)
@@ -1,5 +1,10 @@
 2010-06-01  Dan Nicolaescu  <dann@ics.uci.edu>
 
+       Add support for vc-log-incoming, improve vc-log-outgoing for Git.
+       * vc-git.el (vc-git-compute-remote): New function.
+       (vc-git-log-outgoing): Use it instead of hard coding a value.
+       (vc-git-log-incoming): New function.
+
        Improve state updating for VC tag commands.
        * vc.el (vc-create-tag, vc-retrieve-tag): Call vc-resynch-buffer
        to update the state of all buffers in the directory.
index 7b740734892ac34d53c055b01d98bcdeda527452..4f67e1b06792e3ae865e6e843b37c1ed255c76de 100644 (file)
@@ -606,14 +606,38 @@ for the --graph option."
                (when start-revision (list start-revision))
                '("--")))))))
 
+(defun vc-git-compute-remote ()
+  (let ((str (with-output-to-string
+              (with-current-buffer standard-output
+                (vc-git--out-ok "symbolic-ref" "HEAD"))))
+       branch remote)
+    (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+       (progn
+         (setq branch (match-string 2 str))
+         (setq remote
+               (with-output-to-string
+                 (with-current-buffer standard-output
+                   (vc-git--out-ok "config"
+                                   (concat "branch." branch ".remote")))))
+         (when (string-match "\\([^\n]+\\)" remote)
+           (setq remote (match-string 1 remote)))))))
+
+
 (defun vc-git-log-outgoing (buffer remote-location)
   (interactive)
   (vc-git-command
    buffer 0 nil
    "log" (if (string= remote-location "")
-            ;; FIXME: this hardcodes the location, it should compute
-            ;; it properly.
-            "origin/master..HEAD"
+            (concat (vc-git-compute-remote) "..HEAD")
+          remote-location)))
+
+
+(defun vc-git-log-incoming (buffer remote-location)
+  (interactive)
+  (vc-git-command
+   buffer 0 nil
+   "log" (if (string= remote-location "")
+            (concat "HEAD.." (vc-git-compute-remote))
           remote-location)))
 
 (defvar log-view-message-re)