Merge "Show the revision ID on error message when content is missing on difference...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 17 Sep 2013 17:20:22 +0000 (17:20 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 17 Sep 2013 17:20:22 +0000 (17:20 +0000)
1  2 
includes/diff/DifferenceEngine.php

@@@ -185,10 -185,14 +185,14 @@@ class DifferenceEngine extends ContextS
                $out = $this->getOutput();
  
                $missing = array();
-               if ( $this->mOldRev === null ) {
+               if ( $this->mOldRev === null ||
+                       ( $this->mOldRev && $this->mOldContent === null )
+               ) {
                        $missing[] = $this->deletedIdMarker( $this->mOldid );
                }
-               if ( $this->mNewRev === null ) {
+               if ( $this->mNewRev === null ||
+                       ( $this->mNewRev && $this->mNewContent === null )
+               ) {
                        $missing[] = $this->deletedIdMarker( $this->mNewid );
                }
  
        function loadText() {
                if ( $this->mTextLoaded == 2 ) {
                        return true;
 -              } else {
 -                      // Whether it succeeds or fails, we don't want to try again
 -                      $this->mTextLoaded = 2;
                }
  
 +              // Whether it succeeds or fails, we don't want to try again
 +              $this->mTextLoaded = 2;
 +
                if ( !$this->loadRevisionData() ) {
                        return false;
                }
 +
                if ( $this->mOldRev ) {
                        $this->mOldContent = $this->mOldRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
                        if ( $this->mOldContent === null ) {
                                return false;
                        }
                }
 +
                if ( $this->mNewRev ) {
                        $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
                        if ( $this->mNewContent === null ) {
                                return false;
                        }
                }
 +
                return true;
        }
  
        function loadNewText() {
                if ( $this->mTextLoaded >= 1 ) {
                        return true;
 -              } else {
 -                      $this->mTextLoaded = 1;
                }
 +
 +              $this->mTextLoaded = 1;
 +
                if ( !$this->loadRevisionData() ) {
                        return false;
                }
 +
                $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
 +
                return true;
        }
  }