diff --git a/magit.el b/magit.el index af15e0f9..c7dfa13b 100644 --- a/magit.el +++ b/magit.el @@ -1293,6 +1293,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) @@ -2332,6 +2333,23 @@ merge will be squashed." ;; git svn commands +(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 %s could not be mapped to a commit" rev)))) + (defun magit-svn-rebase () (interactive) (magit-run-git-async "svn" "rebase")) diff --git a/magit.texi b/magit.texi index f6b721d7..19f7fbbd 100644 --- a/magit.texi +++ b/magit.texi @@ -638,4 +638,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