From 869c6059b64dbc5979837cef073da73ead349a90 Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Wed, 4 Nov 2009 21:46:06 +0000 Subject: [PATCH 1/2] Basic functionality, only asking for revision. --- magit.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/magit.el b/magit.el index a911950d..01af7fdf 100644 --- a/magit.el +++ b/magit.el @@ -1193,6 +1193,7 @@ Many Magit faces inherit from this one by default." (define-key map (kbd "e") 'magit-interactive-resolve-item) (define-key map (kbd "N r") 'magit-svn-rebase) (define-key map (kbd "N c") 'magit-svn-dcommit) + (define-key map (kbd "N f") 'magit-svn-find-rev) (define-key map (kbd "R") 'magit-rebase-step) (define-key map (kbd "r s") 'magit-rewrite-start) (define-key map (kbd "r t") 'magit-rewrite-stop) @@ -2181,6 +2182,17 @@ in log buffer." ;; git svn commands +(defun magit-svn-find-rev (rev) + (interactive "SVN revision: ") + (let* ((sha (magit-git-string "svn" "find-rev" + (concat "r" (number-to-string rev))))) + (if sha + (magit-show-commit + (magit-with-section sha 'commit + (magit-set-section-info sha) + sha)) + (error "Revision %d could not be mapped to a commit" rev)))) + (defun magit-svn-rebase () (interactive) (magit-run-git-async "svn" "rebase")) From 83992a9ec2e33dfb6ab0f7b5eff9ae7689180dbe Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Fri, 6 Nov 2009 14:52:33 +0000 Subject: [PATCH 2/2] `magit-svn-find-rev' now supports the prefix arg. * magit.el (magit-svn-find-rev): Prefix support for branch name. * magit.texi: Documenting magit-svn-find-rev. --- magit.el | 24 +++++++++++++++--------- magit.texi | 6 ++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/magit.el b/magit.el index 01af7fdf..f5287f1a 100644 --- a/magit.el +++ b/magit.el @@ -2182,16 +2182,22 @@ in log buffer." ;; git svn commands -(defun magit-svn-find-rev (rev) - (interactive "SVN revision: ") - (let* ((sha (magit-git-string "svn" "find-rev" - (concat "r" (number-to-string rev))))) +(defun magit-svn-find-rev (rev &optional branch) + (interactive + (list (read-input "SVN revision: ") + (if current-prefix-arg + (read-input "In branch: ")))) + (let* ((sha (apply 'magit-git-string + `("svn" + "find-rev" + ,(concat "r" rev) + ,@(when branch (list branch)))))) (if sha - (magit-show-commit - (magit-with-section sha 'commit - (magit-set-section-info sha) - sha)) - (error "Revision %d could not be mapped to a commit" rev)))) + (magit-show-commit + (magit-with-section sha 'commit + (magit-set-section-info sha) + sha)) + (error "Revision %s could not be mapped to a commit" rev)))) (defun magit-svn-rebase () (interactive) diff --git a/magit.texi b/magit.texi index 7fa1b500..8ae5dfd6 100644 --- a/magit.texi +++ b/magit.texi @@ -634,4 +634,10 @@ Magit shows them in a section called @emph{Unpulled changes}. Typing Typing @kbd{N r} runs @code{git svn rebase} and typing @kbd{N c} runs @code{git svn dcommit}. +@kbd{N f} will prompt you for a (numeric, Subversion) revision and +then search for a corresponding Git sha1 for the commit. This is +limited to the path of the remote Subversion repository. With a prefix +(@kbd{C-u N f} the user will also be prompted for a branch to search +in. + @bye