Merge pull request #787 from bigld/master

#752 delete online repo record if error during cloning
This commit is contained in:
Lars Hvam 2017-06-17 10:22:35 +02:00 committed by GitHub
commit ef2cf18015
2 changed files with 33 additions and 4 deletions

View File

@ -147,6 +147,9 @@ CLASS lcl_repo_online DEFINITION INHERITING FROM lcl_repo FINAL.
initialize
RAISING lcx_exception,
actualize_head_branch
RAISING lcx_exception,
delete_initial_online_repo
importing iv_commit type flag
RAISING lcx_exception.
ENDCLASS. "lcl_repo_online DEFINITION

View File

@ -72,6 +72,8 @@ CLASS lcl_repo_online IMPLEMENTATION.
METHOD refresh.
DATA: lx_exception TYPE REF TO lcx_exception.
super->refresh( iv_drop_cache ).
reset_status( ).
@ -80,11 +82,21 @@ CLASS lcl_repo_online IMPLEMENTATION.
iv_total = 1
iv_text = 'Remote files' ) ##NO_TEXT.
TRY.
lcl_git_porcelain=>pull( EXPORTING io_repo = me
IMPORTING et_files = mt_remote
et_objects = mt_objects
ev_branch = mv_branch ).
CATCH lcx_exception INTO lx_exception.
delete_initial_online_repo( abap_true ).
RAISE EXCEPTION lx_exception.
ENDTRY.
mo_branches = lcl_git_transport=>branches( get_url( ) ).
actualize_head_branch( ).
@ -295,6 +307,20 @@ CLASS lcl_repo_online IMPLEMENTATION.
ENDMETHOD. " rebuild_local_checksums.
METHOD delete_initial_online_repo.
IF me->is_offline( ) = abap_false AND me->get_sha1_local( ) IS INITIAL.
lcl_app=>repo_srv( )->delete( me ).
IF iv_commit = abap_true.
COMMIT WORK.
ENDIF.
ENDIF.
ENDMETHOD. " delete_initial_online_repo
ENDCLASS. "lcl_repo_online IMPLEMENTATION
*----------------------------------------------------------------------*