Mercurial > emacs
comparison lisp/vc-git.el @ 106472:6e0f1038bc44
Support showing a single log entry from vc-annotate.
* vc.el (print-log): Add a new argument: START-REVISION.
(vc-print-log-internal): Add a new optional argument and
pass it to the backend.
(vc-print-log, vc-print-root-log): Adjust callers.
* vc-annotate.el (vc-annotate-show-log-revision-at-line): If a
buffer already displays the requested log entry, use it.
Otherwise display only the log entry in question.
* vc-svn.el (vc-svn-print-log):
* vc-mtn.el (log-view-file-re):
* vc-hg.el (vc-hg-state):
* vc-git.el (vc-git-print-log): Add support for new argument START-REVISION.
(vc-git-show-log-entry): Return t on success.
* vc-bzr.el (vc-bzr-print-log): Add support new argument START-REVISION.
(vc-bzr-show-log-entry): Return t on success.
* vc-rcs.el (vc-rcs-print-log):
* vc-sccs.el (vc-sccs-print-log):
* vc-cvs.el (vc-cvs-print-log): Add new argument, ignore it.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Mon, 07 Dec 2009 09:02:11 +0000 |
parents | 67d9cb4f16c3 |
children | 88a0c109936e |
comparison
equal
deleted
inserted
replaced
106471:9fe246ccb486 | 106472:6e0f1038bc44 |
---|---|
75 ;; by git, so it's probably | 75 ;; by git, so it's probably |
76 ;; not a good idea. | 76 ;; not a good idea. |
77 ;; - merge-news (file) see `merge' | 77 ;; - merge-news (file) see `merge' |
78 ;; - steal-lock (file &optional revision) NOT NEEDED | 78 ;; - steal-lock (file &optional revision) NOT NEEDED |
79 ;; HISTORY FUNCTIONS | 79 ;; HISTORY FUNCTIONS |
80 ;; * print-log (files buffer &optional shortlog limit) OK | 80 ;; * print-log (files buffer &optional shortlog start-revision limit) OK |
81 ;; - log-view-mode () OK | 81 ;; - log-view-mode () OK |
82 ;; - show-log-entry (revision) OK | 82 ;; - show-log-entry (revision) OK |
83 ;; - comment-history (file) ?? | 83 ;; - comment-history (file) ?? |
84 ;; - update-changelog (files) COULD BE SUPPORTED | 84 ;; - update-changelog (files) COULD BE SUPPORTED |
85 ;; * diff (file &optional rev1 rev2 buffer) OK | 85 ;; * diff (file &optional rev1 rev2 buffer) OK |
538 (vc-git-command nil 0 file "reset" "-q" "--") | 538 (vc-git-command nil 0 file "reset" "-q" "--") |
539 (vc-git-command nil nil file "checkout" "-q" "--"))) | 539 (vc-git-command nil nil file "checkout" "-q" "--"))) |
540 | 540 |
541 ;;; HISTORY FUNCTIONS | 541 ;;; HISTORY FUNCTIONS |
542 | 542 |
543 (defun vc-git-print-log (files buffer &optional shortlog limit) | 543 (defun vc-git-print-log (files buffer &optional shortlog start-revision limit) |
544 "Get change log associated with FILES." | 544 "Get change log associated with FILES." |
545 (let ((coding-system-for-read git-commits-coding-system)) | 545 (let ((coding-system-for-read git-commits-coding-system)) |
546 ;; `vc-do-command' creates the buffer, but we need it before running | 546 ;; `vc-do-command' creates the buffer, but we need it before running |
547 ;; the command. | 547 ;; the command. |
548 (vc-setup-buffer buffer) | 548 (vc-setup-buffer buffer) |
557 '("log") | 557 '("log") |
558 (when shortlog | 558 (when shortlog |
559 '("--graph" "--decorate" | 559 '("--graph" "--decorate" |
560 "--date=short" "--pretty=format:%d%h %ad %s" "--abbrev-commit")) | 560 "--date=short" "--pretty=format:%d%h %ad %s" "--abbrev-commit")) |
561 (when limit (list "-n" (format "%s" limit))) | 561 (when limit (list "-n" (format "%s" limit))) |
562 (when start-revision (list start-revision)) | |
562 '("--"))))))) | 563 '("--"))))))) |
563 | 564 |
564 (defvar log-view-message-re) | 565 (defvar log-view-message-re) |
565 (defvar log-view-file-re) | 566 (defvar log-view-file-re) |
566 (defvar log-view-font-lock-keywords) | 567 (defvar log-view-font-lock-keywords) |
613 (defun vc-git-show-log-entry (revision) | 614 (defun vc-git-show-log-entry (revision) |
614 "Move to the log entry for REVISION. | 615 "Move to the log entry for REVISION. |
615 REVISION may have the form BRANCH, BRANCH~N, | 616 REVISION may have the form BRANCH, BRANCH~N, |
616 or BRANCH^ (where \"^\" can be repeated)." | 617 or BRANCH^ (where \"^\" can be repeated)." |
617 (goto-char (point-min)) | 618 (goto-char (point-min)) |
618 (when revision | 619 (let (found) |
619 (search-forward (format "\ncommit %s" revision) nil t | 620 (when revision |
620 (cond ((string-match "~\\([0-9]\\)$" revision) | 621 (setq found |
621 (1+ (string-to-number (match-string 1 revision)))) | 622 (search-forward (format "\ncommit %s" revision) nil t |
622 ((string-match "\\^+$" revision) | 623 (cond ((string-match "~\\([0-9]\\)$" revision) |
623 (1+ (length (match-string 0 revision)))) | 624 (1+ (string-to-number (match-string 1 revision)))) |
624 (t nil)))) | 625 ((string-match "\\^+$" revision) |
625 (beginning-of-line)) | 626 (1+ (length (match-string 0 revision)))) |
627 (t nil))))) | |
628 (beginning-of-line) | |
629 found)) | |
626 | 630 |
627 (defun vc-git-diff (files &optional rev1 rev2 buffer) | 631 (defun vc-git-diff (files &optional rev1 rev2 buffer) |
628 "Get a difference report using Git between two revisions of FILES." | 632 "Get a difference report using Git between two revisions of FILES." |
629 (let (process-file-side-effects) | 633 (let (process-file-side-effects) |
630 (apply #'vc-git-command (or buffer "*vc-diff*") 1 files | 634 (apply #'vc-git-command (or buffer "*vc-diff*") 1 files |