Revision: 43641
Author: skizzerz
Date: 2008-11-17 21:37:27 +0000 (Mon, 17 Nov 2008)
Log Message:
-----------
* Add user and password globals so that those using SubversionShell and closed
svn can see diffs
Modified Paths:
--------------
trunk/extensions/CodeReview/CodeReview.php
trunk/extensions/CodeReview/Subversion.php
Modified: trunk/extensions/CodeReview/CodeReview.php
===================================================================
--- trunk/extensions/CodeReview/CodeReview.php 2008-11-17 21:28:42 UTC (rev
43640)
+++ trunk/extensions/CodeReview/CodeReview.php 2008-11-17 21:37:27 UTC (rev
43641)
@@ -101,5 +101,11 @@
// The name of a repo which represents the code running on this wiki, used to
highlight active revisions
$wgWikiSVN = 'MediaWiki';
+// If you are running a closed svn, fill the following two lines with the
username and password
+// of a user allowed to access it. Otherwise, leave it false.
+// This is only necessary if using the shell method to access Subversion
+$wgSubversionUser = false;
+$wgSubversionPassword = false;
+
// Leave this off by default until it works right
$wgCodeReviewENotif = false;
Modified: trunk/extensions/CodeReview/Subversion.php
===================================================================
--- trunk/extensions/CodeReview/Subversion.php 2008-11-17 21:28:42 UTC (rev
43640)
+++ trunk/extensions/CodeReview/Subversion.php 2008-11-17 21:37:27 UTC (rev
43641)
@@ -98,7 +98,8 @@
if( $rev )
$path .= "@$rev";
$command = sprintf(
- "svn cat %s",
+ "svn cat %s %s",
+ $this->getExtraArgs(),
wfEscapeShellArg( $this->mRepo . $path ) );
return wfShellExec( $command );
@@ -106,9 +107,10 @@
function getDiff( $path, $rev1, $rev2 ) {
$command = sprintf(
- "svn diff -r%d:%d %s",
+ "svn diff -r%d:%d %s %s",
intval( $rev1 ),
intval( $rev2 ),
+ $this->getExtraArgs(),
wfEscapeShellArg( $this->mRepo . $path ) );
return wfShellExec( $command );
@@ -116,9 +118,10 @@
function getLog( $path, $startRev=null, $endRev=null ) {
$command = sprintf(
- "svn log -v -r%s:%s --non-interactive %s",
+ "svn log -v -r%s:%s --non-interactive %s %s",
wfEscapeShellArg( $this->_rev( $startRev, 'BASE' ) ),
wfEscapeShellArg( $this->_rev( $endRev, 'HEAD' ) ),
+ $this->getExtraArgs(),
wfEscapeShellArg( $this->mRepo . $path ) );
$lines = explode( "\n", wfShellExec( $command ) );
@@ -210,8 +213,9 @@
function getDirList( $path, $rev = null ) {
$command = sprintf(
- "svn list --xml -r%s --non-interactive %s",
+ "svn list --xml -r%s --non-interactive %s %s",
wfEscapeShellArg( $this->_rev( $rev, 'HEAD' ) ),
+ $this->getExtraArgs(),
wfEscapeShellArg( $this->mRepo . $path ) );
$document = new DOMDocument();
@@ -252,6 +256,18 @@
}
return $result;
}
+
+ /**
+ * Returns a string of extra arguments to be passed into the shell
commands
+ */
+ private function getExtraArgs() {
+ global $wgSubversionUser, $wgSubversionPassword;
+ if($wgSubversionUser && $wgSubversionPassword) {
+ return '--username ' .
wfEscapeShellArg($wgSubversionUser)
+ . ' --password ' .
wfEscapeShellArg($wgSubversionPassword);
+ }
+ return '';
+ }
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs