From ee01adf1f39fd60b5f93a9109578ef1a89f8d7ab Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Wed, 28 Oct 2009 19:54:11 +0000 Subject: [PATCH] `magit-get-svn-ref' now emulates the git-svn way of remote fetching. * magit.el (magit-get-svn-ref): Parse log output for the remote svn url. --- magit.el | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/magit.el b/magit.el index a911950d..4b133bcf 100644 --- a/magit.el +++ b/magit.el @@ -2193,12 +2193,20 @@ in log buffer." (not (null (magit-get-svn-ref)))) (defun magit-get-svn-ref () - (cond ((magit-ref-exists-p "refs/remotes/git-svn") - "refs/remotes/git-svn") - ((magit-ref-exists-p "refs/remotes/trunk") - "refs/remotes/trunk") - (t - nil))) + "Get the best guess remote ref for the current git-svn based +branch." + (let* ((info (magit-get "svn-remote" "svn" "fetch")) + (refs)) + (when info + (concat + (file-name-directory (cadr (split-string info ":"))) + (with-temp-buffer + ;; grab the git-svn-id information, this is how git-svn.perl + ;; does it :/ + (insert (magit-git-string "log" "--first-parent")) + (goto-char (point-min)) + (when (re-search-forward "git-svn-id: .+/\\(.+?\\)@" nil t) + (match-string 1))))))) ;;; Resetting