Jump to content

Manual:$wgGitRepositoryViewers

From mediawiki.org
This page is a translated version of the page Manual:$wgGitRepositoryViewers and the translation is 40% complete.
保守スクリプトの設定: $wgGitRepositoryViewers
Git リポジトリ URL から gitweb インターフェイス URL へのマップ
導入されたバージョン:1.20.0 (Gerrit change 6776; git #8bab490d)
除去されたバージョン:使用中
許容される値:(配列)
既定値:(下記参照)

詳細

Maps Git repository URLs to viewer URLs to provide links in Special:Version. Special:Version looks up git remote configuration and identifies a correct git remote entry for the branch of code that is currently being run.

This URL needs to be converted in to the gitweb interface URL (if available), so that git revision identifiers (in the form of SHA-1 hash) can be linked to the repository viewer.

This variable is an array of (key, value) pairs, the key is used to look up the git remote entry URL. The key is a pattern passed to preg_match() and preg_replace(), without the delimiters (which are #) and must match the whole URL.

The value is a pattern to obtain a correct URL for the gitweb interface. The value is the regular expression replacement for the key (it can contain $1, etc.). %h will be replaced by the short SHA-1 (7 first chars) and %H by the full SHA-1 of the HEAD revision.

既定値

MediaWiki バージョン:
1.31
$wgGitRepositoryViewers = [
	'https://(?:[a-z0-9_]+@)?gerrit.wikimedia.org/r/(?:p/)?(.*)' => 'https://gerrit.wikimedia.org/g/%R/+/%H',
	'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' => 'https://gerrit.wikimedia.org/g/%R/+/%H',
];
MediaWiki バージョン:
1.27 – 1.30
$wgGitRepositoryViewers = [
	'https://(?:[a-z0-9_]+@)?gerrit.wikimedia.org/r/(?:p/)?(.*)' =>
		'https://phabricator.wikimedia.org/r/revision/%R;%H',
	'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' =>
		'https://phabricator.wikimedia.org/r/revision/%R;%H',
];
MediaWiki バージョン:
1.24 – 1.26
$wgGitRepositoryViewers = array(
	'https://(?:[a-z0-9_]+@)?gerrit.wikimedia.org/r/(?:p/)?(.*)' =>
		'https://git.wikimedia.org/tree/%r/%H',
	'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' =>
		'https://git.wikimedia.org/tree/%r/%H',
);
MediaWiki バージョン:
1.23
$wgGitRepositoryViewers = array(
	'https://(?:[a-z0-9_]+@)?gerrit.wikimedia.org/r/(?:p/)?(.*)' =>
		'https://git.wikimedia.org/commit/%r/%H',
	'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' =>
		'https://git.wikimedia.org/commit/%r/%H',
);
MediaWiki バージョン:
1.22
$wgGitRepositoryViewers = array(
	'https://gerrit.wikimedia.org/r/p/(.*)' => 'https://git.wikimedia.org/commit/%r/%H',
	'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)'
		=> 'https://git.wikimedia.org/commit/%r/%H',
);
MediaWiki バージョン:
1.20 – 1.21
$wgGitRepositoryViewers = array(
	'https://gerrit.wikimedia.org/r/p/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H',
	'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H',
);

If you have the following entry in .ssh/config (as described in Setup SSH shortcut):

Host review
Hostname gerrit.wikimedia.org
Port 29418
User username

And if your git remote used to fetch MediaWiki is configured in the following way in .git/config:

[remote "review"]
	url = ssh://review/mediawiki/core.git
	fetch = +refs/heads/*:refs/remotes/review/*

then this entry in LocalSettings.php will make ssh://review/mediawiki/core.git URL to be recognized as pointing to the Wikimedia git repository:

$wgGitRepositoryViewers['ssh://(?:[a-z0-9_]+@)?review/(.*)'] = 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H';

GitHub

When using extensions that are maintained at GitHub, you can use this to link them.

$wgGitRepositoryViewers['https://github.com/(.*?)(.git)?'] = 'https://github.com/$1/commit/%H';