comparison lisp/vc-git.el @ 108891:3e41dbf56aa2

vc-log-incoming/vc-log-outgoing fixes for Git. * lisp/vc-git.el (vc-git-log-view-mode): Fix font lock for incoming/outgoing logs. (vc-git-log-outgoing, vc-git-log-incoming): Use @{upstream} instead of vc-git-compute-remote. (vc-git-compute-remote): Remove.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sat, 05 Jun 2010 02:56:22 -0700
parents b008fff91985
children c05344a913c8
comparison
equal deleted inserted replaced
108890:d9257436d2b1 108891:3e41dbf56aa2
604 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit")) 604 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit"))
605 (when limit (list "-n" (format "%s" limit))) 605 (when limit (list "-n" (format "%s" limit)))
606 (when start-revision (list start-revision)) 606 (when start-revision (list start-revision))
607 '("--"))))))) 607 '("--")))))))
608 608
609 (defun vc-git-compute-remote ()
610 (let ((str (with-output-to-string
611 (with-current-buffer standard-output
612 (vc-git--out-ok "symbolic-ref" "HEAD"))))
613 branch remote)
614 (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
615 (progn
616 (setq branch (match-string 2 str))
617 (setq remote
618 (with-output-to-string
619 (with-current-buffer standard-output
620 (vc-git--out-ok "config"
621 (concat "branch." branch ".remote")))))
622 (when (string-match "\\([^\n]+\\)" remote)
623 (setq remote (match-string 1 remote)))))))
624
625 (defun vc-git-log-outgoing (buffer remote-location) 609 (defun vc-git-log-outgoing (buffer remote-location)
626 (interactive) 610 (interactive)
627 (vc-git-command 611 (vc-git-command
628 buffer 0 nil 612 buffer 0 nil
629 "log" 613 "log"
630 "--no-color" "--graph" "--decorate" "--date=short" 614 "--no-color" "--graph" "--decorate" "--date=short"
631 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit" 615 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit"
632 (concat (if (string= remote-location "") 616 (concat (if (string= remote-location "")
633 (vc-git-compute-remote) 617 "@{upstream}"
634 remote-location) 618 remote-location)
635 "..HEAD"))) 619 "..HEAD")))
636 620
637 (defun vc-git-log-incoming (buffer remote-location) 621 (defun vc-git-log-incoming (buffer remote-location)
638 (interactive) 622 (interactive)
639 (vc-git-command nil 0 nil "fetch") 623 (vc-git-command nil 0 nil "fetch")
640 (vc-git-command 624 (vc-git-command
641 buffer 0 nil 625 buffer 0 nil
642 "log" 626 "log"
643 "--no-color" "--graph" "--decorate" "--date=short" 627 "--no-color" "--graph" "--decorate" "--date=short"
644 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit" 628 "--pretty=tformat:%d%h %ad %s" "--abbrev-commit"
645 (concat "HEAD.." (if (string= remote-location "") 629 (concat "HEAD.." (if (string= remote-location "")
646 (vc-git-compute-remote) 630 "@{upstream}"
647 remote-location)))) 631 remote-location))))
648 632
649 (defvar log-view-message-re) 633 (defvar log-view-message-re)
650 (defvar log-view-file-re) 634 (defvar log-view-file-re)
651 (defvar log-view-font-lock-keywords) 635 (defvar log-view-font-lock-keywords)
655 (require 'add-log) ;; We need the faces add-log. 639 (require 'add-log) ;; We need the faces add-log.
656 ;; Don't have file markers, so use impossible regexp. 640 ;; Don't have file markers, so use impossible regexp.
657 (set (make-local-variable 'log-view-file-re) "\\`a\\`") 641 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
658 (set (make-local-variable 'log-view-per-file-logs) nil) 642 (set (make-local-variable 'log-view-per-file-logs) nil)
659 (set (make-local-variable 'log-view-message-re) 643 (set (make-local-variable 'log-view-message-re)
660 (if (eq vc-log-view-type 'short) 644 (if (not (eq vc-log-view-type 'long))
661 "^\\(?:[*/\\| ]+ \\)?\\(?: ([^)]+)\\)?\\([0-9a-z]+\\) \\([-a-z0-9]+\\) \\(.*\\)" 645 "^\\(?:[*/\\| ]+ \\)?\\(?: ([^)]+)\\)?\\([0-9a-z]+\\) \\([-a-z0-9]+\\) \\(.*\\)"
662 "^commit *\\([0-9a-z]+\\)")) 646 "^commit *\\([0-9a-z]+\\)"))
663 (set (make-local-variable 'log-view-font-lock-keywords) 647 (set (make-local-variable 'log-view-font-lock-keywords)
664 (if (eq vc-log-view-type 'short) 648 (if (not (eq vc-log-view-type 'long))
665 '( 649 '(
666 ;; Same as log-view-message-re, except that we don't 650 ;; Same as log-view-message-re, except that we don't
667 ;; want the shy group for the tag name. 651 ;; want the shy group for the tag name.
668 ("^\\(?:[*/\\| ]+ \\)?\\( ([^)]+)\\)?\\([0-9a-z]+\\) \\([-a-z0-9]+\\) \\(.*\\)" 652 ("^\\(?:[*/\\| ]+ \\)?\\( ([^)]+)\\)?\\([0-9a-z]+\\) \\([-a-z0-9]+\\) \\(.*\\)"
669 (1 'highlight nil lax) 653 (1 'highlight nil lax)