Hashar has uploaded a new change for review. https://gerrit.wikimedia.org/r/131768
Change subject: Api: expose git branch in siteinfo ...................................................................... Api: expose git branch in siteinfo For browsertesting, I need a reliable way to determine the branch in use on a target wiki. One could parse the generator name forged whn querying the siteinfo, but that yields: MediaWiki 1.24alpha instead of master MediaWiki 1.24wmf2 instead of wmf/1.24wmf2 I am not really willing to reverse engineer the version to figure out the branch, instead just expose it over the API. Bug: 62509 Change-Id: If3db8f480ce0d590522741d40fb8e43b753efb41 --- M includes/api/ApiQuerySiteinfo.php M includes/specials/SpecialVersion.php 2 files changed, 11 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/68/131768/1 diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index b0e9bd2..636d798 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -180,6 +180,8 @@ $git = SpecialVersion::getGitHeadSha1( $GLOBALS['IP'] ); if ( $git ) { $data['git-hash'] = $git; + $data['git-branch'] = + SpecialVersion::getGitCurrentBranch( $GLOBALS['IP'] ); } else { $svn = SpecialVersion::getSvnRevision( $GLOBALS['IP'] ); if ( $svn ) { diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index e61d17a..41847dc 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -1114,6 +1114,15 @@ } /** + * @param string $dir Directory of the git checkout + * @return bool|string Branch currently checked out + */ + public static function getGitCurrentBranch( $dir ) { + $repo = new GitInfo( $dir ); + return $repo->getCurrentBranch(); + } + + /** * Get the list of entry points and their URLs * @return string Wikitext */ -- To view, visit https://gerrit.wikimedia.org/r/131768 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If3db8f480ce0d590522741d40fb8e43b753efb41 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Hashar <has...@free.fr> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits