| Index: trunk/extensions/CodeReview/CodeReview.php |
| — | — | @@ -115,12 +115,8 @@ |
| 116 | 116 | $wgGroupPermissions['svnadmins']['repoadmin'] = true; |
| 117 | 117 | |
| 118 | 118 | // Constants returned from CodeRepository::getDiff() when no diff can be calculated. |
| 119 | | -define("DIFFRESULT_BadRevision", 0); |
| 120 | | -define("DIFFRESULT_NothingToCompare", 1); |
| 121 | | -define("DIFFRESULT_TooManyPaths", 2); |
| 122 | | -define("DIFFRESULT_NoDataReturned", 3); |
| 123 | | -define("DIFFRESULT_NotInCache", 4); |
| 124 | 119 | |
| | 120 | + |
| 125 | 121 | // If you can't directly access the remote SVN repo, you can set this |
| 126 | 122 | // to an offsite proxy running this fun little proxy tool: |
| 127 | 123 | // http://svn.wikimedia.org/viewvc/mediawiki/trunk/tools/codereview-proxy/ |
| Index: trunk/extensions/CodeReview/backend/CodeRepository.php |
| — | — | @@ -5,6 +5,12 @@ |
| 6 | 6 | */ |
| 7 | 7 | class CodeRepository { |
| 8 | 8 | |
| | 9 | + const DIFFRESULT_BadRevision = 0; |
| | 10 | + const DIFFRESULT_NothingToCompare = 1; |
| | 11 | + const DIFFRESULT_TooManyPaths = 2; |
| | 12 | + const DIFFRESULT_NoDataReturned = 3; |
| | 13 | + const DIFFRESULT_NotInCache = 4; |
| | 14 | + |
| 9 | 15 | /** |
| 10 | 16 | * Local cache of Wiki user -> SVN user mappings |
| 11 | 17 | * @var Array |
| — | — | @@ -264,16 +270,16 @@ |
| 265 | 271 | // Check that a valid revision was specified. |
| 266 | 272 | $revision = $this->getRevision( $rev ); |
| 267 | 273 | if ( $revision == null ) { |
| 268 | | - $data = DIFFRESULT_BadRevision; |
| | 274 | + $data = self::DIFFRESULT_BadRevision; |
| 269 | 275 | } else { |
| 270 | 276 | // Check that there is at least one, and at most $wgCodeReviewMaxDiffPaths |
| 271 | 277 | // paths changed in this revision. |
| 272 | 278 | |
| 273 | 279 | $paths = $revision->getModifiedPaths(); |
| 274 | 280 | if ( !$paths->numRows() ) { |
| 275 | | - $data = DIFFRESULT_NothingToCompare; |
| | 281 | + $data = self::DIFFRESULT_NothingToCompare; |
| 276 | 282 | } elseif ( $wgCodeReviewMaxDiffPaths > 0 && $paths->numRows() > $wgCodeReviewMaxDiffPaths ) { |
| 277 | | - $data = DIFFRESULT_TooManyPaths; |
| | 283 | + $data = self::DIFFRESULT_TooManyPaths; |
| 278 | 284 | } |
| 279 | 285 | } |
| 280 | 286 | |
| — | — | @@ -323,7 +329,7 @@ |
| 324 | 330 | // If the calling code is forcing a cache check, report that it wasn't |
| 325 | 331 | // in the cache. |
| 326 | 332 | if ( $useCache === 'cached' ) { |
| 327 | | - $data = DIFFRESULT_NotInCache; |
| | 333 | + $data = self::DIFFRESULT_NotInCache; |
| 328 | 334 | |
| 329 | 335 | // Otherwise, retrieve the diff using SubversionAdaptor. |
| 330 | 336 | } else { |
| — | — | @@ -334,7 +340,7 @@ |
| 335 | 341 | // TODO: Currently we can't tell the difference between an SVN/connection |
| 336 | 342 | // failure and an empty diff. See if we can remedy this! |
| 337 | 343 | if ($data == "") { |
| 338 | | - $data = DIFFRESULT_NoDataReturned; |
| | 344 | + $data = self::DIFFRESULT_NoDataReturned; |
| 339 | 345 | } else { |
| 340 | 346 | // Otherwise, store the resulting diff to both the temporary cache and |
| 341 | 347 | // permanent DB storage. |
| Index: trunk/extensions/CodeReview/svnImport.php |
| — | — | @@ -156,17 +156,17 @@ |
| 157 | 157 | if ( is_integer( $diff ) ) { |
| 158 | 158 | $msg .= "Skipped: "; |
| 159 | 159 | switch ($diff) { |
| 160 | | - case DIFFRESULT_BadRevision: |
| | 160 | + case CodeRepository::DIFFRESULT_BadRevision: |
| 161 | 161 | $msg .= "Bad revision"; |
| 162 | 162 | break; |
| 163 | | - case DIFFRESULT_NothingToCompare: |
| | 163 | + case CodeRepository::DIFFRESULT_NothingToCompare: |
| 164 | 164 | $msg .= "Nothing to compare"; |
| 165 | 165 | break; |
| 166 | | - case DIFFRESULT_TooManyPaths: |
| | 166 | + case CodeRepository::DIFFRESULT_TooManyPaths: |
| 167 | 167 | $msg .= "Too many paths (\$wgCodeReviewMaxDiffPaths = " |
| 168 | 168 | . $wgCodeReviewMaxDiffPaths . ")"; |
| 169 | 169 | break; |
| 170 | | - case DIFFRESULT_NoDataReturned: |
| | 170 | + case CodeRepository::DIFFRESULT_NoDataReturned: |
| 171 | 171 | $msg .= "No data returned - no diff data, or connection lost."; |
| 172 | 172 | break; |
| 173 | 173 | default: |