r105939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105938‎ | r105939 | r105940 >
Date:22:17, 12 December 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
List of new revisions per path
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.i18n.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/RepoStats.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRepoStatsView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/RepoStats.php
@@ -16,7 +16,7 @@
1717 $fixmes,
1818 $new;
1919
20 - public $fixmesPerPath;
 20+ public $fixmesPerPath, $newPerPath;
2121
2222 /**
2323 * @param CodeRepository $repo
@@ -74,15 +74,26 @@
7575 $this->states[$row->cr_status] = $row->revs;
7676 }
7777
 78+ $repoName = $this->repo->getName();
 79+
7880 $this->fixmes = $this->getAuthorStatusCounts( 'fixme' );
7981 $this->new = $this->getAuthorStatusCounts( 'new' );
 82+
8083 $this->fixmesPerPath = array();
8184 global $wgCodeReviewFixmePerPath;
82 - if ( isset( $wgCodeReviewFixmePerPath[ $this->repo->getName() ] ) ) {
83 - foreach( $wgCodeReviewFixmePerPath[ $this->repo->getName() ] as $path ) {
 85+ if ( isset( $wgCodeReviewFixmePerPath[ $repoName ] ) ) {
 86+ foreach( $wgCodeReviewFixmePerPath[ $repoName ] as $path ) {
8487 $this->fixmesPerPath[$path] = $this->getPathFixmes( $path );
8588 }
8689 }
 90+
 91+ $this->newPerPath = array();
 92+ global $wgCodeRevieNewPerPath;
 93+ if ( isset( $wgCodeRevieNewPerPath[ $repoName ] ) ) {
 94+ foreach( $wgCodeRevieNewPerPath[ $repoName ] as $path ) {
 95+ $this->newPerPath[$path] = $this->getPathNews( $path );
 96+ }
 97+ }
8798 wfProfileOut( __METHOD__ );
8899 }
89100
@@ -111,10 +122,27 @@
112123 }
113124
114125 /**
115 - * @param $path path to get fixmes for
 126+ * @param $path array|string path to get fixmes for
116127 * @return array
117128 */
118129 private function getPathFixmes( $path ) {
 130+ return $this->getStatusPath( $path, 'fixme' );
 131+ }
 132+
 133+ /**
 134+ * @param $path array|string path to get fixmes for
 135+ * @return array
 136+ */
 137+ private function getPathNews( $path ) {
 138+ return $this->getStatusPath( $path, 'new' );
 139+ }
 140+
 141+ /**
 142+ * @param $path array|string
 143+ * @param $status string
 144+ * @return array
 145+ */
 146+ private function getStatusPath( $path, $status ) {
119147 $array = array();
120148 $dbr = wfGetDB( DB_SLAVE );
121149 $res = $dbr->select(
@@ -123,7 +151,7 @@
124152 array(
125153 'cr_repo_id' => $this->repo->getId(),
126154 'cp_path' => $path,
127 - 'cr_status' => 'fixme',
 155+ 'cr_status' => $status,
128156 ),
129157 __METHOD__,
130158 array(
@@ -140,4 +168,4 @@
141169 }
142170 return $array;
143171 }
144 -}
\ No newline at end of file
 172+}
Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -207,6 +207,8 @@
208208 'code-stats-fixme-breakdown-path' => 'Breakdown of fixme revisions per path',
209209 'code-stats-fixme-path' => 'Fixme revisions for path: $1',
210210 'code-stats-new-breakdown' => 'Breakdown of new revisions per author',
 211+ 'code-stats-new-breakdown-path' => 'Breakdown of new revisions per path',
 212+ 'code-stats-new-path' => 'New revisions for path: $1',
211213 'code-stats-count' => 'Number of revisions',
212214
213215 'code-tooltip-withsummary' => 'r$1 [$2] by $3 - $4',
Index: trunk/extensions/CodeReview/ui/CodeRepoStatsView.php
@@ -56,6 +56,15 @@
5757 $this->writeAuthorTable( 'fixme', $fixmes, array( 'path' => $path ) );
5858 }
5959 }
 60+
 61+ if ( !empty( $stats->newPerPath ) ) {
 62+ $wgOut->wrapWikiMsg( "<h3 id=\"stats-new-path\">$1</h3>", 'code-stats-new-breakdown-path' );
 63+
 64+ foreach ( $stats->newPerPath as $path => $news ) {
 65+ $wgOut->wrapWikiMsg( "<h4 id=\"stats-new-path\">$1</h4>", array( 'code-stats-new-path', $path ) );
 66+ $this->writeAuthorTable( 'fixme', $news, array( 'path' => $path ) );
 67+ }
 68+ }
6069 }
6170
6271 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r105940Followup r105939, didn't press savereedy22:20, 12 December 2011
r105942Typos, ffs. r105939, r105940reedy22:24, 12 December 2011

Comments

#Comment by Hashar (talk | contribs)   22:24, 12 December 2011

Looks good to me, just had to manually clear my cache to make them appear.

Tagging for 1.18wmf1

#Comment by Reedy (talk | contribs)   22:37, 12 December 2011

Yup, always the case, cached for 6 hours at default, 1 hour on production :)

Unfortunately, it won't go directly from here, it's got some dependencies. I'm likely to just push trunk CR out to mw.org again

Status & tagging log