emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100496: Add support for vc-log-incom


From: Dan Nicolaescu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100496: Add support for vc-log-incoming, improve vc-log-outgoing for Git.
Date: Tue, 01 Jun 2010 03:40:09 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100496
committer: Dan Nicolaescu <address@hidden>
branch nick: trunk
timestamp: Tue 2010-06-01 03:40:09 -0700
message:
  Add support for vc-log-incoming, improve vc-log-outgoing for Git.
  * 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.
modified:
  lisp/ChangeLog
  lisp/vc-git.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-06-01 09:37:49 +0000
+++ b/lisp/ChangeLog    2010-06-01 10:40:09 +0000
@@ -1,5 +1,10 @@
 2010-06-01  Dan Nicolaescu  <address@hidden>
 
+       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.

=== modified file 'lisp/vc-git.el'
--- a/lisp/vc-git.el    2010-04-21 02:05:24 +0000
+++ b/lisp/vc-git.el    2010-06-01 10:40:09 +0000
@@ -606,14 +606,38 @@
                (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)


reply via email to

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