diff --git a/Source/lang/strings_english.txt b/Source/lang/strings_english.txt index 948371f..b324856 100644 --- a/Source/lang/strings_english.txt +++ b/Source/lang/strings_english.txt @@ -66,6 +66,7 @@ $s_plugin_Source_na = 'N/A'; $s_plugin_Source_back = 'Back to Index'; +$s_plugin_Source_back_repo = 'Back to Repository'; $s_plugin_Source_import_full = 'Import Everything'; $s_plugin_Source_import_latest = 'Import Latest Data'; $s_plugin_Source_related_changesets = 'Related Changesets'; @@ -119,13 +120,15 @@ $s_plugin_Source_ensure_delete = 'Do you really want to delete the "%s" repository and all of its history?'; $s_plugin_Source_ensure_import_full = 'This will import to a new copy of your repository, and then destroy the old repository data, and may require use of shell access. Do you wish to continue?'; $s_plugin_Source_ensure_import_latest = 'This will attempt to import recent data for your repository, and may require use of shell access. Do you wish to continue?'; +$s_plugin_Source_import_results = 'Import Results'; $s_plugin_Source_import_stats = 'Imported %s changesets, %s files, and %s bug references.'; +$s_plugin_Source_import_repo_error = 'Import process produced an error.'; +$s_plugin_Source_ = ''; $s_plugin_Source_invalid_checkin_url = 'Invalid remote check-in address'; $s_plugin_Source_invalid_import_url = 'Invalid remote import address'; $s_plugin_Source_invalid_repo = 'Invalid repository name'; $s_plugin_Source_invalid_changeset = 'Changeset information could not be loaded'; -$s_plugin_Source_import_latest_failed = 'Importing latest repository data failed.'; $s_plugin_Source_import_full_failed = 'Full repository data importing failed.'; diff --git a/Source/pages/repo_import_latest.php b/Source/pages/repo_import_latest.php index 6c71119..4ce68f3 100644 --- a/Source/pages/repo_import_latest.php +++ b/Source/pages/repo_import_latest.php @@ -74,58 +74,99 @@ die( plugin_lang_get( 'invalid_import_url' ) ); } -$f_repo_id = gpc_get_string( 'id' ); +$f_repo_id = strtolower( gpc_get_string( 'id' ) ); -$t_repo = SourceRepo::load( $f_repo_id ); -$t_vcs = SourceVCS::repo( $t_repo ); +# Load an array of repositories to be imported +if ( $f_repo_id == 'all' ) { + $t_repos = SourceRepo::load_all(); -if ( !$t_remote ) { - html_page_top1(); - html_page_top2(); +} elseif ( is_numeric( $f_repo_id ) ) { + $t_repo_id = (int) $f_repo_id; + $t_repos = array( SourceRepo::load( $t_repo_id ) ); } -$t_pre_stats = $t_repo->stats(); +# Loop through all repos to be imported +foreach ( $t_repos as $t_repo ) { + $t_vcs = SourceVCS::repo( $t_repo ); -# keep checking for more changesets to import -$t_error = false; -while( true ) { - - # import the next batch of changesets - $t_changesets = $t_vcs->import_latest( $t_repo ); - - # check for errors - if ( !is_array( $t_changesets ) ) { - $t_error = true; - break; + if ( !$t_remote ) { + $t_repo->pre_stats = $t_repo->stats(); } - # if no more entries, we're done - if ( count( $t_changesets ) < 1 ) { - break; + # keep checking for more changesets to import + $t_repo->import_error = false; + while( true ) { + + # import the next batch of changesets + $t_changesets = $t_vcs->import_latest( $t_repo ); + + # check for errors + if ( !is_array( $t_changesets ) ) { + $t_repo->import_error = true; + break; + } + + # if no more entries, we're done + if ( count( $t_changesets ) < 1 ) { + break; + } + + Source_Process_Changesets( $t_changesets ); } - Source_Process_Changesets( $t_changesets ); + if ( !$t_remote ) { + $t_repo->post_stats = $t_repo->stats(); + } } -# only display results when the user is initiating the import +# Display output to the user if ( !$t_remote ) { + html_page_top(); - if ( $t_error ) { - echo '
', plugin_lang_get( 'import_latest_failed' ), '
'; +?> +
+ + + + + + + +> + + + + - print_bracket_link( plugin_page( 'repo_manage_page' ) . '&id=' . $t_repo->id, 'Return To Repository' ); - echo ''; + + + +
name ) ?> +import_error ) { + echo plugin_lang_get( 'import_latest_failed' ), '
'; } - $t_stats = $t_repo->stats(); - $t_stats['changesets'] -= $t_pre_stats['changesets']; - $t_stats['files'] -= $t_pre_stats['files']; - $t_stats['bugs'] -= $t_pre_stats['bugs']; + $t_stats = $t_repo->post_stats; + $t_stats['changesets'] -= $t_repo->pre_stats['changesets']; + $t_stats['files'] -= $t_repo->pre_stats['files']; + $t_stats['bugs'] -= $t_repo->pre_stats['bugs']; - echo '
'; - echo sprintf( plugin_lang_get( 'import_stats' ), $t_stats['changesets'], $t_stats['files'], $t_stats['bugs'] ), '
'; + echo sprintf( plugin_lang_get( 'import_stats' ), $t_stats['changesets'], $t_stats['files'], $t_stats['bugs'] ); +?> +
+id, plugin_lang_get( 'back_repo' ) ); + } +?> +
+ +