From 35f3cce022958dafe779f1f55389ef780ebc3ca5 Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Fri, 24 Mar 2017 12:04:10 +0100 Subject: [PATCH] migrations: skip repos that cannot be fetched On systems where users do not allow everybody to fetch their repo, you need to be able skip certain repos. Currently, if you cannot authorize yourself to read a migrated repo, abapGit exits. With this patch applied, failed authorization attempts are notified to the user and the repo is skipped. Signed-off-by: Jakub Filak --- src/zabapgit_migrations.prog.abap | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/zabapgit_migrations.prog.abap b/src/zabapgit_migrations.prog.abap index 30cd12307..b99db4d51 100644 --- a/src/zabapgit_migrations.prog.abap +++ b/src/zabapgit_migrations.prog.abap @@ -35,7 +35,8 @@ CLASS lcl_migrations IMPLEMENTATION. DATA: lt_repos TYPE lcl_repo_srv=>ty_repo_tt, lv_shown TYPE abap_bool, - lo_dot_abapgit TYPE REF TO lcl_dot_abapgit. + lo_dot_abapgit TYPE REF TO lcl_dot_abapgit, + lx_exception TYPE REF TO lcx_exception. FIELD-SYMBOLS: LIKE LINE OF lt_repos. @@ -56,7 +57,23 @@ CLASS lcl_migrations IMPLEMENTATION. txt2 = 'Login to remote repositories if needed'. lv_shown = abap_true. ENDIF. - ->refresh( ). + + " Skip repos that cannot be fetched. + " Particuarly useful on systems where users do not allow + " everybody to fetch their repos. + TRY. + ->refresh( ). + CATCH lcx_exception INTO lx_exception. + CALL FUNCTION 'POPUP_TO_INFORM' + EXPORTING + titel = 'Migration has failed' + txt1 = lx_exception->mv_text + txt2 = 'Please do not use the ''' && ->get_name( ) && ''' repository until migrated.' + txt3 = 'You will be prompted to migrate the repository every time you run abapGit.' + txt4 = 'You can safely remove the repository in its ''Advanced -> Remove'' menu.'. + CONTINUE. + ENDTRY. + lo_dot_abapgit = ->find_remote_dot_abapgit( ). IF lo_dot_abapgit IS INITIAL. * .abapgit.xml is not in the remote repo yet