(vc-git-symbolic-commit): Allow nil to pass through.
(vc-git-previous-version): Use explicit parent argument.
(vc-git-next-version): Simplify.
(vc-git-annotate-command): Use `vc-do-command'.
(vc-git-annotate-extract-revision-at-line): Rename from
`vc-annotate-extract-revision-at-line'.
Signed-off-by: David Kastrup <dak@gnu.org>
---
contrib/emacs/vc-git.el | 76 +++++++++++++++++++++++++++--------------------
1 files changed, 44 insertions(+), 32 deletions(-)
diff --git a/contrib/emacs/vc-git.el b/contrib/emacs/vc-git.el
index 3637c8a..2a0a0fe 100644
--- a/contrib/emacs/vc-git.el
+++ b/contrib/emacs/vc-git.el
@@ -84,19 +84,20 @@
(defun vc-git-symbolic-commit (commit)
"Translate COMMIT string into symbolic form.
Returns nil if not possible."
- (with-temp-buffer
- (and
- (zerop
- (call-process "git" nil '(t nil) nil "name-rev"
- commit))
- (goto-char (point-max))
- (bolp)
- (zerop (forward-line -1))
- (bobp)
- (progn
- (search-forward " " nil t)
- (not (eolp)))
- (buffer-substring-no-properties (point) (1- (point-max))))))
+ (and commit
+ (with-temp-buffer
+ (and
+ (zerop
+ (call-process "git" nil '(t nil) nil "name-rev"
+ commit))
+ (goto-char (point-max))
+ (bolp)
+ (zerop (forward-line -1))
+ (bobp)
+ (progn
+ (search-forward " " nil t)
+ (not (eolp)))
+ (buffer-substring-no-properties (point) (1- (point-max)))))))
(defun vc-git-previous-version (file rev)
"git-specific version of `vc-previous-version'."
@@ -104,15 +105,13 @@ Returns nil if not possible."
(with-temp-buffer
(and
(zerop
- (call-process "git" nil '(t nil) nil "rev-list" "--abbrev"
- "--abbrev-commit" "-2" rev "--" (file-relative-name file)))
- (goto-char (point-max))
- (bolp)
- (zerop (forward-line -1))
- (not (bobp))
- (buffer-substring-no-properties
- (point)
- (1- (point-max)))))))
+ (call-process "git" nil '(t nil) nil "rev-list"
+ "--abbrev"
+ "--abbrev-commit" "-1" "--parents" rev "--"
+ (file-relative-name file)))
+ (goto-char (point-min))
+ (search-forward-regexp " \\([^ \n]*\\)" nil t)
+ (match-string 1)))))
(defun vc-git-next-version (file rev)
"git-specific version of `vc-next-version'."
@@ -121,8 +120,9 @@ Returns nil if not possible."
(and
(zerop
(call-process "git" nil '(t nil) nil "rev-list" "--abbrev"
- "--abbrev-commit"
+ "--abbrev-commit" "--remove-empty"
"HEAD" "--not" rev "--" (file-relative-name file)))
+ (goto-char (point-min))
(goto-char (point-max))
(bolp)
(zerop (forward-line -1))
@@ -174,24 +174,36 @@ Returns nil if not possible."
(vc-git--run-command-string file "ls-files" "-z" "--full-name" "--")
0 -1))
(coding-system-for-read 'no-conversion)
- (coding-system-for-write 'no-conversion))
+ coding-system-for-write)
(with-temp-file destfile
- (eq 0 (call-process "git" nil t nil "cat-file" "blob"
- (concat (or rev "HEAD") ":" fullname)))))
+ (prog1
+ (eq 0 (call-process "git" nil t nil "cat-file" "blob"
+ (concat (or rev "HEAD") ":" fullname)))
+ (setq coding-system-for-write 'no-conversion))))
(vc-git--run-command file "checkout" (or rev "HEAD"))))
-(defun vc-git-annotate-command (file buf &optional rev)
- (let ((name (file-relative-name file)))
- (if rev
- (call-process "git" nil buf nil "blame" rev "--" name)
- (call-process "git" nil buf nil "blame" "--" name))))
+(defun vc-git-annotate-command (file buffer &optional version)
+ "Execute \"git blame\" on FILE, inserting the contents in BUFFER.
+Optional arg VERSION is a version to annotate from."
+ (vc-do-command buffer
+ 'async
+ "git" file "blame"
+ (or version "HEAD")
+ "--"))
+
+;;(defun vc-git-annotate-command (file buf &optional rev)
+;; (let ((name (file-relative-name file)))
+;; (vc-setup-buffer buf)
+;; (if rev
+;; (call-process "git" nil buf nil "blame" rev "--" name)
+;; (call-process "git" nil buf nil "blame" "--" name))))
(defun vc-git-annotate-time ()
(and (re-search-forward "[0-9a-f]+ (.* \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\) +[0-9]+)" nil t)
(vc-annotate-convert-time
(apply #'encode-time (mapcar (lambda (match) (string-to-number (match-string match))) '(6 5 4 3 2 1 7))))))
-(defun vc-annotate-extract-revision-at-line ()
+(defun vc-git-annotate-extract-revision-at-line ()
(save-excursion
(move-beginning-of-line 1)
(and (looking-at "[0-9a-f]+")
--
1.4.4.2
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Andrew Morton | Re: 2.6.24-rc6-mm1 |
| Glauber de Oliveira Costa | [PATCH 8/19] modify write_ldt function |
| Steven Rostedt | Re: Major regression on hackbench with SLUB |
| Satyam Sharma | Re: 2.6.23-rc4-mm1 |
git: | |
| Chris Ortman | [FEATURE REQUEST] git-svn format-patch |
| Bill Lear | Meaning of "fatal: protocol error: bad line length character"? |
| Scott Chacon | Git Community Book |
| Catalin Marinas | Re: [ANNOUNCE] pg - A patch porcelain for GIT |
| Richard Stallman | Real men don't attack straw men |
| frantisek holop | nptd regression in 4.2 |
| Kevin | uvm_mapent_alloc: out of static map entries on 4.3 i386 |
| Vim Visual | GRAPE cluster supercomputer + OpenBSD |
| John Stoffel | Re: [PATCH] LogFS take three |
| hooanon05 | [PATCH 62/67] aufs magic sysrq handler |
| Chris Mason | Re: [PATCH][RFC] fast file mapping for loop |
| Chris Mason | Re: [ANNOUNCE] Btrfs v0.12 released |
