Skip to content

Commit 1e2fb7f

Browse files
Anthony Demurtasdregad
authored andcommitted
The default branch "master" is now configurable
1 parent f6ef9da commit 1e2fb7f

File tree

6 files changed

+22
-2
lines changed

6 files changed

+22
-2
lines changed

Source/Source.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ function config() {
8383
'bugfix_message' => 'Fix committed to $1 branch.',
8484
'bugfix_message_view_status' => VS_PUBLIC,
8585

86+
'default_branch' => 'master',
87+
8688
'remote_checkin' => OFF,
8789
'checkin_urls' => serialize( array( 'localhost' ) ),
8890

Source/lang/strings_english.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ $s_plugin_Source_bugfix_message = 'Bug Fixed Message Template';
100100
$s_plugin_Source_bugfix_message_info = 'Use $1 for branch, $2 for revision, $3 for timestamp, $4 for commit message, $5 for repository name, or $6 for changeset ID.';
101101
$s_plugin_Source_bugfix_message_view_status = 'Bug Fixed Message View State';
102102
$s_plugin_Source_bugfix_message_view_status_info = 'Note: if the changeset\'s author/committer does not have <em>private_bugnote_threshold</em>, the note will be Public regardless of this setting.';
103+
$s_plugin_Source_default_branch = 'Default branch';
104+
$s_plugin_Source_default_branch_info = 'Branch by default when creating a repository.';
103105
$s_plugin_Source_reset = 'Reset to default';
104106
$s_plugin_Source_menu_links = 'Main Menu Links';
105107
$s_plugin_Source_show_repo_link = 'Repositories';

Source/lang/strings_french.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ $s_plugin_Source_bugfix_message = 'Modèle de message de résolution';
9898
$s_plugin_Source_bugfix_message_info = 'Utilisez $1 pour la branche, $2 pour la révision, $3 pour l\'horodatage, $4 pour le message de soumission, ou $5 pour le nom du dépôt.';
9999
$s_plugin_Source_bugfix_message_view_status = 'Type de message de résolution';
100100
$s_plugin_Source_bugfix_message_view_status_info = 'Note: si l\'auteur du jeu de changement n\'a pas le niveau <em>private_bugnote_threshold</em>, la note sera Publique quel que soit la valeur de cette option.';
101+
$s_plugin_Source_default_branch = 'Branche par défaut';
102+
$s_plugin_Source_default_branch_info = 'Branche par defaut lors de la création d\'un dépôt.';
101103
$s_plugin_Source_reset = 'Réinitialiser';
102104
$s_plugin_Source_menu_links = 'Liens du menu principal';
103105
$s_plugin_Source_show_repo_link = 'Dépôts';

Source/pages/manage_config.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
$f_bugfix_message = gpc_get_string( 'bugfix_message' );
4040
$f_bugfix_message_view_status = gpc_get_int( 'bugfix_message_view_status', VS_PUBLIC );
4141

42+
$f_default_branch = gpc_get_string( 'default_branch' );
43+
4244
function check_urls( $t_urls_in ) {
4345
$t_urls_in = explode( "\n", $t_urls_in );
4446
$t_urls_out = array();
@@ -119,6 +121,8 @@ function maybe_set_option( $name, $value ) {
119121
maybe_set_option( 'bugfix_message', $f_bugfix_message );
120122
maybe_set_option( 'bugfix_message_view_status', $f_bugfix_message_view_status );
121123

124+
maybe_set_option( 'default_branch', $f_default_branch );
125+
122126
maybe_set_option( 'remote_checkin', $f_remote_checkin );
123127
maybe_set_option( 'checkin_urls', serialize( $t_checkin_urls ) );
124128
maybe_set_option( 'remote_imports', $f_remote_imports );

Source/pages/manage_config_page.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@
259259
</tr>
260260

261261
<tr class="spacer"></tr>
262+
<tr>
263+
<td class="category"><?php echo plugin_lang_get( 'default_branch' ) ?></td>
264+
<td>
265+
<input name="default_branch" type="text" class="input-sm" size="50" value="<?php echo string_attribute( plugin_config_get( 'default_branch' ) ) ?>"/>
266+
<br>
267+
<span class="small"><?php echo plugin_lang_get( 'default_branch_info' ) ?></span>
268+
</td>
269+
</tr>
270+
271+
<tr class="spacer" />
262272
<tr>
263273
<td class="category"><?php echo plugin_lang_get( 'api_key' ) ?></td>
264274
<td>

SourceGitlab/SourceGitlab.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function update_repo_form( $p_repo ) {
115115
if ( isset( $p_repo->info['master_branch'] ) ) {
116116
$t_master_branch = $p_repo->info['master_branch'];
117117
} else {
118-
$t_master_branch = 'master';
118+
$t_master_branch = config_get('plugin_Source_default_branch', 'master');
119119
}
120120
?>
121121
<tr>
@@ -249,7 +249,7 @@ public function import_full( $p_repo ) {
249249

250250
$t_branch = $p_repo->info['master_branch'];
251251
if ( is_blank( $t_branch ) ) {
252-
$t_branch = 'master';
252+
$t_branch = config_get('plugin_Source_default_branch', 'master');
253253
}
254254

255255
# if we're not allowed everything, populate an array of what we are allowed

0 commit comments

Comments
 (0)