Show the git revision and git branch in the debug toolbar if available.
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 28 Mar 2012 10:43:35 +0000 (12:43 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 28 Mar 2012 19:37:30 +0000 (21:37 +0200)
The git version is displayed for consistency with other locations where the MediaWiki version is displayed and I always the branch on which I am :)

Change-Id: Icf041eabe49f03350536f212753e46f8e3468614

includes/debug/Debug.php
resources/mediawiki/mediawiki.debug.js

index e8ad526..418eede 100644 (file)
@@ -258,6 +258,8 @@ class MWDebug {
                $debugInfo = array(
                        'mwVersion' => $wgVersion,
                        'phpVersion' => PHP_VERSION,
+                       'gitRevision' => GitInfo::headSHA1(),
+                       'gitBranch' => GitInfo::currentBranch(),
                        'time' => microtime( true ) - $wgRequestTime,
                        'log' => self::$log,
                        'debugLog' => self::$debug,
index a2bfbcb..2afcbc6 100644 (file)
 
                        paneTriggerBitDiv( 'includes', 'PHP includes', this.data.includes.length );
 
+                       var gitInfo = '';
+                       if ( this.data.gitRevision != false ) {
+                               gitInfo = ' (' + this.data.gitRevision.substring( 0, 7 ) + ')';
+                       }
+
                        bitDiv( 'mwversion' )
                                .append( $( '<a href="//www.mediawiki.org/"></a>' ).text( 'MediaWiki' ) )
-                               .append( ': ' + this.data.mwVersion );
+                               .append( ': ' + this.data.mwVersion + gitInfo );
+
+                       if ( this.data.gitBranch != false ) {
+                               bitDiv( 'gitbranch' ).text( 'Git branch: ' + this.data.gitBranch );
+                       }
 
                        bitDiv( 'phpversion' )
                                .append( $( '<a href="//www.php.net/"></a>' ).text( 'PHP' ) )