From 17a5a3014db451821e4bfaeb84980de7ac650be1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 13 Dec 2004 06:30:40 +0000 Subject: [PATCH] =?utf8?q?(vc-svn-repository-hostname):=20Adjust=20to=20ne?= =?utf8?q?w=20format.=20Reported=20by=20Ville=20Skytt=EF=BF=BDscop@xemacs.?= =?utf8?q?org>.=20(vc-svn-annotate-current-time,=20vc-svn-annotate-time-of?= =?utf8?q?-rev)=20(vc-svn-annotate-time,=20vc-svn-annotate-extract-revisio?= =?utf8?q?n-at-line)=20(vc-svn-annotate-command,=20vc-svn-annotate-re):=20?= =?utf8?q?Support=20for=20svn=20annotate.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lisp/ChangeLog | 8 ++++++++ lisp/vc-svn.el | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 866339b7ca5..b5cc31b9363 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2004-12-13 Stefan Monnier + + * vc-svn.el (vc-svn-repository-hostname): Adjust to new format. + Reported by Ville Skytt,Ad(B . + (vc-svn-annotate-current-time, vc-svn-annotate-time-of-rev) + (vc-svn-annotate-time, vc-svn-annotate-extract-revision-at-line) + (vc-svn-annotate-command, vc-svn-annotate-re): Support for svn annotate. + 2004-12-12 Juri Linkov * files.el (find-file-other-window, find-file-other-frame): diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el index fafb5eff7cd..cbb951d60b7 100644 --- a/lisp/vc-svn.el +++ b/lisp/vc-svn.el @@ -447,10 +447,14 @@ and that it passes `vc-svn-global-switches' to it before FLAGS." (vc-insert-file (expand-file-name ".svn/entries" dirname))) (goto-char (point-min)) (when (re-search-forward - (concat "name=\"svn:this_dir\"[\n\t ]*" - "\\([-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?" + ;; Old `svn' used name="svn:dir", newer use just name="". + (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*" + "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?" "url=\"\\([^\"]+\\)\"") nil t) - (match-string 2)))) + ;; This is not a hostname but a URL. This may actually be considered + ;; as a feature since it allows vc-svn-stay-local to specify different + ;; behavior for different modules on the same server. + (match-string 1)))) (defun vc-svn-parse-status (localp) "Parse output of \"svn status\" command in the current buffer. @@ -505,6 +509,30 @@ essential information." (and (string-match "^[0-9]" tag) (not (string-match "[^0-9]" tag)))) +;; Support for `svn annotate' + +(defun vc-svn-annotate-command (file buf &optional rev) + (vc-svn-command buf 0 file "annotate" (if rev (concat "-r" rev)))) + +(defun vc-svn-annotate-time-of-rev (rev) + ;; Arbitrarily assume 10 commmits per day. + (/ (string-to-number rev) 10.0)) + +(defun vc-svn-annotate-current-time () + (vc-svn-annotate-time-of-rev vc-annotate-parent-rev)) + +(defconst vc-svn-annotate-re "[ \t]*\\([0-9]+\\)[ \t]+[^\t ]+ ") + +(defun vc-svn-annotate-time () + (when (looking-at vc-svn-annotate-re) + (goto-char (match-end 0)) + (vc-svn-annotate-time-of-rev (match-string 1)))) + +(defun vc-svn-annotate-extract-revision-at-line () + (save-excursion + (beginning-of-line) + (if (looking-at vc-svn-annotate-re) (match-string 1)))) + (provide 'vc-svn) ;; arch-tag: 02f10c68-2b4d-453a-90fc-1eee6cfb268d -- 2.39.5