'value', '#value' => TRUE, ); $form['repository_information']['update_method'] = array( '#type' => 'radios', '#title' => t('Update method'), '#description' => t('Automatic log retrieval requires cron.'), '#default_value' => isset($repository) ? $repository['git_specific']['update_method'] : VERSIONCONTROL_GIT_UPDATE_CRON, '#weight' => 9, '#options' => array( VERSIONCONTROL_GIT_UPDATE_CRON => t('Automatic log retrieval.'), VERSIONCONTROL_GIT_UPDATE_XGIT => t('Use external script to insert data.'), ), ); $form['repository_information']['use_file'] = array( '#type' => 'checkbox', '#title' => t('Use log file'), '#description' => t('Use a log file to store response when calling Git from the command line. If not used than the response will be stored in an array.'), '#default_value' => variable_get('versioncontrol_git_log_use_file', 1), '#weight' => 10, ); } /** * Implementation of hook_versioncontrol_extract_repository_data(): * Extract Git specific repository additions from the repository * editing/adding form's submitted values. */ function versioncontrol_git_versioncontrol_extract_repository_data($form_values) { if (!isset($form_values['versioncontrol_git'])) { return array(); } return array( 'git_specific' => array( 'update_method' => $form_values['update_method'], ), 'use_file' => $form_values['use_file'], // Temporary location. ); } /** * Implementation of hook_versioncontrol_alter_repository_list(): * Add Git specific columns into the list of Git repositories. * By changing the @p $header and @p $rows_by_repo_id arguments, * the repository list can be customized accordingly. * * @param $vcs * The unique string identifier for the version control system that * the passed repository list covers. * @param $repositories * An array of repositories of the given version control system. * Array keys are the repository ids, and array values are the * repository arrays like returned from versioncontrol_get_repository(). * @param $header * A list of columns that will be passed to theme('table'). * @param $rows_by_repo_id * An array of existing table rows, with repository ids as array keys. * Each row already includes the generic column values, and for each row * there is a repository with the same repository id given in the * @p $repositories parameter. */ function versioncontrol_git_versioncontrol_alter_repository_list($vcs, $repositories, &$header, &$rows_by_repo_id) { if ($vcs != 'git') { return; } $header[] = t('Update method'); $header[] = t('Last updated'); foreach ($rows_by_repo_id as $repo_id => $row) { if ($repositories[$repo_id]['git_specific']['update_method'] == VERSIONCONTROL_GIT_UPDATE_XGIT) { $rows_by_repo_id[$repo_id][] = t('external script'); } if ($repositories[$repo_id]['git_specific']['update_method'] == VERSIONCONTROL_GIT_UPDATE_CRON) { $rows_by_repo_id[$repo_id][] = t('logs (!fetch)', array( '!fetch' => l(t('fetch now'), 'admin/project/versioncontrol-repositories/update/git/'. $repo_id) )); } $rows_by_repo_id[$repo_id][] = $repositories[$repo_id]['git_specific']['updated'] ? format_date($repositories[$repo_id]['git_specific']['updated'], 'small') : t('never'); } }