Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php |
— | — | @@ -1,12 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class CodeRevisionCommitter extends CodeRevisionView { |
5 | | - |
6 | | - function __construct( $repoName, $rev ) { |
7 | | - // Parent should set $this->mRepo, $this->mRev, $this->mReplyTarget |
8 | | - parent::__construct( $repoName, $rev ); |
9 | | - } |
10 | | - |
11 | 5 | function execute() { |
12 | 6 | global $wgRequest, $wgOut, $wgUser; |
13 | 7 | |
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php |
— | — | @@ -3,13 +3,29 @@ |
4 | 4 | // Special:Code/MediaWiki/40696 |
5 | 5 | class CodeRevisionView extends CodeView { |
6 | 6 | |
7 | | - function __construct( $repoName, $rev, $replyTarget = null ) { |
| 7 | + /** |
| 8 | + * @param string|CodeRepository $repo |
| 9 | + * @param string|CodeRevision $rev |
| 10 | + * @param null $replyTarget |
| 11 | + * |
| 12 | + */ |
| 13 | + function __construct( $repo, $rev, $replyTarget = null ) { |
8 | 14 | global $wgRequest; |
9 | 15 | parent::__construct(); |
10 | | - $this->mRepo = CodeRepository::newFromName( $repoName ); |
11 | | - $this->mRevId = intval( ltrim( $rev, 'r' ) ); |
12 | | - $this->mRev = $this->mRepo ? |
13 | | - $this->mRepo->getRevision( $this->mRevId ) : null; |
| 16 | + $this->mRepo = ( $repo instanceof CodeRepository ) |
| 17 | + ? $repo |
| 18 | + : CodeRepository::newFromName( $repo ); |
| 19 | + |
| 20 | + if ( $rev instanceof CodeRevision ) { |
| 21 | + $this->mRevId = $rev->getId(); |
| 22 | + $this->mRev = $rev; |
| 23 | + } else { |
| 24 | + $this->mRevId = intval( ltrim( $rev, 'r' ) ); |
| 25 | + $this->mRev = $this->mRepo |
| 26 | + ? $this->mRepo->getRevision( $this->mRevId ) |
| 27 | + : null; |
| 28 | + } |
| 29 | + |
14 | 30 | $this->mPreviewText = false; |
15 | 31 | # Search path for navigation links |
16 | 32 | $this->mPath = htmlspecialchars( trim( $wgRequest->getVal( 'path' ) ) ); |