*&---------------------------------------------------------------------*
*&  Include           ZABAPGIT_DEFINITIONS
*&---------------------------------------------------------------------*

TYPE-POOLS seop.

INTERFACE lif_defs.

  CONSTANTS: gc_xml_version  TYPE string VALUE 'v1.0.0',    "#EC NOTEXT
             gc_abap_version TYPE string VALUE 'v1.37.6'.   "#EC NOTEXT

  TYPES: ty_type    TYPE c LENGTH 6,
         ty_bitbyte TYPE c LENGTH 8,
         ty_sha1    TYPE c LENGTH 40.

  TYPES: BEGIN OF ty_file_signature,
           path     TYPE string,
           filename TYPE string,
           sha1     TYPE lif_defs=>ty_sha1,
         END OF ty_file_signature.

  TYPES: ty_file_signatures_tt TYPE STANDARD TABLE OF
           ty_file_signature WITH DEFAULT KEY.

  TYPES: ty_file_signatures_ts TYPE SORTED TABLE OF
           ty_file_signature WITH UNIQUE KEY path filename.

  TYPES: BEGIN OF ty_file.
      INCLUDE TYPE ty_file_signature.
  TYPES: data TYPE xstring,
         END OF ty_file.
  TYPES: ty_files_tt TYPE STANDARD TABLE OF ty_file WITH DEFAULT KEY.

  TYPES: ty_string_tt TYPE STANDARD TABLE OF string WITH DEFAULT KEY.

  TYPES: ty_icm_sinfo2_tt TYPE STANDARD TABLE OF icm_sinfo2 WITH DEFAULT KEY.

  TYPES:
    BEGIN OF ty_git_user,
      name  TYPE string,
      email TYPE string,
    END OF ty_git_user.

  TYPES:
    BEGIN OF ty_comment,
      committer TYPE ty_git_user,
      author    TYPE ty_git_user,
      comment   TYPE string,
    END OF ty_comment.

  TYPES: BEGIN OF ty_item,
           obj_type TYPE tadir-object,
           obj_name TYPE tadir-obj_name,
           devclass TYPE devclass,
         END OF ty_item,
         ty_items_tt TYPE STANDARD TABLE OF ty_item WITH DEFAULT KEY,
         ty_items_ts TYPE SORTED TABLE OF ty_item WITH UNIQUE KEY obj_type obj_name.

  TYPES: BEGIN OF ty_file_item,
           file TYPE lif_defs=>ty_file,
           item TYPE ty_item,
         END OF ty_file_item.
  TYPES: ty_files_item_tt TYPE STANDARD TABLE OF ty_file_item WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_metadata,
           class        TYPE string,
           version      TYPE string,
           late_deser   TYPE abap_bool,
           delete_tadir TYPE abap_bool,
           ddic         TYPE abap_bool,
         END OF ty_metadata.

  TYPES: BEGIN OF ty_web_asset,
           url     TYPE w3url,
           base64  TYPE string,
           content TYPE xstring,
         END OF ty_web_asset.
  TYPES  tt_web_assets TYPE STANDARD TABLE OF ty_web_asset WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_repo_file,
           path       TYPE string,
           filename   TYPE string,
           is_changed TYPE abap_bool,
           rstate     TYPE char1,
           lstate     TYPE char1,
         END OF ty_repo_file.
  TYPES  tt_repo_files TYPE STANDARD TABLE OF ty_repo_file WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_stage_files,
           local  TYPE lif_defs=>ty_files_item_tt,
           remote TYPE lif_defs=>ty_files_tt,
         END OF ty_stage_files.

  CONSTANTS: BEGIN OF gc_type,
               commit TYPE lif_defs=>ty_type VALUE 'commit', "#EC NOTEXT
               tree   TYPE lif_defs=>ty_type VALUE 'tree',  "#EC NOTEXT
               ref_d  TYPE lif_defs=>ty_type VALUE 'ref_d', "#EC NOTEXT
               blob   TYPE lif_defs=>ty_type VALUE 'blob',  "#EC NOTEXT
             END OF gc_type.

  TYPES: ty_chmod TYPE c LENGTH 6.

  TYPES: BEGIN OF ty_object,
           sha1 TYPE lif_defs=>ty_sha1,
           type TYPE lif_defs=>ty_type,
           data TYPE xstring,
         END OF ty_object.
  TYPES: ty_objects_tt TYPE STANDARD TABLE OF ty_object WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_tadir,
           pgmid    TYPE tadir-pgmid,
           object   TYPE tadir-object,
           obj_name TYPE tadir-obj_name,
           devclass TYPE tadir-devclass,
           korrnum  TYPE tadir-korrnum,
           path     TYPE string,
         END OF ty_tadir.
  TYPES: ty_tadir_tt TYPE STANDARD TABLE OF ty_tadir WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_result,
           obj_type TYPE tadir-object,
           obj_name TYPE tadir-obj_name,
           path     TYPE string,
           filename TYPE string,
           package  TYPE devclass,
           match    TYPE sap_bool,
           lstate   TYPE char1,
           rstate   TYPE char1,
         END OF ty_result.
  TYPES: ty_results_tt TYPE STANDARD TABLE OF ty_result WITH DEFAULT KEY.

  TYPES: ty_sval_tt TYPE STANDARD TABLE OF sval WITH DEFAULT KEY.

  TYPES: ty_seocompotx_tt TYPE STANDARD TABLE OF seocompotx WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_tpool.
      INCLUDE TYPE textpool.
  TYPES:   split TYPE c LENGTH 8.
  TYPES: END OF ty_tpool.

  TYPES: ty_tpool_tt TYPE STANDARD TABLE OF ty_tpool WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_sotr,
           header  TYPE sotr_head,
           entries TYPE sotr_text_tt,
         END OF ty_sotr.

  TYPES: ty_sotr_tt TYPE STANDARD TABLE OF ty_sotr WITH DEFAULT KEY.

  TYPES:
    BEGIN OF ty_transport_to_branch,
      branch_name TYPE string,
      commit_text TYPE string,
    END OF ty_transport_to_branch.

  CONSTANTS: BEGIN OF gc_state, " https://git-scm.com/docs/git-status
               unchanged TYPE char1 VALUE '',
               added     TYPE char1 VALUE 'A',
               modified  TYPE char1 VALUE 'M',
               deleted   TYPE char1 VALUE 'D', "For future use
               mixed     TYPE char1 VALUE '*',
             END OF gc_state.

  CONSTANTS: BEGIN OF gc_chmod,
               file       TYPE ty_chmod VALUE '100644',
               executable TYPE ty_chmod VALUE '100755',
               dir        TYPE ty_chmod VALUE '40000 ',
             END OF gc_chmod.

  CONSTANTS: BEGIN OF gc_event_state,
               not_handled         VALUE 0,
               re_render           VALUE 1,
               new_page            VALUE 2,
               go_back             VALUE 3,
               no_more_act         VALUE 4,
               new_page_w_bookmark VALUE 5,
               go_back_to_bookmark VALUE 6,
               new_page_replacing  VALUE 7,
             END OF gc_event_state.

  CONSTANTS: BEGIN OF gc_html_opt,
               strong   TYPE c VALUE 'E',
               cancel   TYPE c VALUE 'C',
               crossout TYPE c VALUE 'X',
             END OF gc_html_opt.

  CONSTANTS: BEGIN OF gc_action_type,
               sapevent  TYPE c VALUE 'E',
               url       TYPE c VALUE 'U',
               onclick   TYPE c VALUE 'C',
               separator TYPE c VALUE 'S',
               dummy     TYPE c VALUE '_',
             END OF gc_action_type.

  CONSTANTS: gc_crlf    TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf.
  CONSTANTS: gc_newline TYPE abap_char1 VALUE cl_abap_char_utilities=>newline.

  CONSTANTS: gc_english TYPE spras VALUE 'E'.

  CONSTANTS: gc_root_dir     TYPE string VALUE '/',
             gc_dot_abapgit  TYPE string VALUE '.abapgit.xml' ##NO_TEXT,
             gc_author_regex TYPE string VALUE '^([\\\w\s\.@\-_1-9]+) <(.*)> (\d{10})\s?.\d{4}$' ##NO_TEXT.

  CONSTANTS: BEGIN OF gc_action,
               repo_clone               TYPE string VALUE 'repo_clone',
               repo_refresh             TYPE string VALUE 'repo_refresh',
               repo_remove              TYPE string VALUE 'repo_remove',
               repo_settings            TYPE string VALUE 'repo_settings',
               repo_purge               TYPE string VALUE 'repo_purge',
               repo_newoffline          TYPE string VALUE 'repo_newoffline',
               repo_remote_attach       TYPE string VALUE 'repo_remote_attach',
               repo_remote_detach       TYPE string VALUE 'repo_remote_detach',
               repo_remote_change       TYPE string VALUE 'repo_remote_change',
               repo_refresh_checksums   TYPE string VALUE 'repo_refresh_checksums',
               repo_toggle_fav          TYPE string VALUE 'repo_toggle_fav',
               repo_transport_to_branch TYPE string VALUE 'repo_transport_to_branch',

               abapgit_home             TYPE string VALUE 'abapgit_home',
               abapgit_wiki             TYPE string VALUE 'abapgit_wiki',
               abapgit_install          TYPE string VALUE 'abapgit_install',
               abapgit_install_pi       TYPE string VALUE 'abapgit_install_pi',

               zip_import               TYPE string VALUE 'zip_import',
               zip_export               TYPE string VALUE 'zip_export',
               zip_package              TYPE string VALUE 'zip_package',
               zip_transport            TYPE string VALUE 'zip_transport',
               zip_object               TYPE string VALUE 'zip_object',

               git_pull                 TYPE string VALUE 'git_pull',
               git_reset                TYPE string VALUE 'git_reset',
               git_branch_create        TYPE string VALUE 'git_branch_create',
               git_branch_switch        TYPE string VALUE 'git_branch_switch',
               git_branch_delete        TYPE string VALUE 'git_branch_delete',
               git_commit               TYPE string VALUE 'git_commit',

               db_delete                TYPE string VALUE 'db_delete',
               db_update                TYPE string VALUE 'db_update',
               db_display               TYPE string VALUE 'db_display',
               db_edit                  TYPE string VALUE 'db_edit',
               bg_update                TYPE string VALUE 'bg_update',

               go_main                  TYPE string VALUE 'go_main',
               go_explore               TYPE string VALUE 'go_explore',
               go_db                    TYPE string VALUE 'go_db',
               go_background            TYPE string VALUE 'go_background',
               go_background_run        TYPE string VALUE 'go_background_run',
               go_diff                  TYPE string VALUE 'go_diff',
               go_stage                 TYPE string VALUE 'go_stage',
               go_commit                TYPE string VALUE 'go_commit',
               go_branch_overview       TYPE string VALUE 'go_branch_overview',
               go_playground            TYPE string VALUE 'go_playground',
               go_debuginfo             TYPE string VALUE 'go_debuginfo',
               go_settings              TYPE string VALUE 'go_settings',
               go_tutorial              TYPE string VALUE 'go_tutorial',

               jump                     TYPE string VALUE 'jump',
               jump_pkg                 TYPE string VALUE 'jump_pkg',
             END OF gc_action.

ENDINTERFACE.

*&---------------------------------------------------------------------*
*&  Include           ZABAPGIT_DEFINITIONS
*&---------------------------------------------------------------------*

TYPE-POOLS seop.

INTERFACE lif_defs.

  CONSTANTS: gc_xml_version  TYPE string VALUE 'v1.0.0',    "#EC NOTEXT
             gc_abap_version TYPE string VALUE 'v1.37.6'.   "#EC NOTEXT

  TYPES: ty_type    TYPE c LENGTH 6,
         ty_bitbyte TYPE c LENGTH 8,
         ty_sha1    TYPE c LENGTH 40.

  TYPES: BEGIN OF ty_file_signature,
           path     TYPE string,
           filename TYPE string,
           sha1     TYPE lif_defs=>ty_sha1,
         END OF ty_file_signature.

  TYPES: ty_file_signatures_tt TYPE STANDARD TABLE OF
           ty_file_signature WITH DEFAULT KEY.

  TYPES: ty_file_signatures_ts TYPE SORTED TABLE OF
           ty_file_signature WITH UNIQUE KEY path filename.

  TYPES: BEGIN OF ty_file.
      INCLUDE TYPE ty_file_signature.
  TYPES: data TYPE xstring,
         END OF ty_file.
  TYPES: ty_files_tt TYPE STANDARD TABLE OF ty_file WITH DEFAULT KEY.

  TYPES: ty_string_tt TYPE STANDARD TABLE OF string WITH DEFAULT KEY.

  TYPES: ty_icm_sinfo2_tt TYPE STANDARD TABLE OF icm_sinfo2 WITH DEFAULT KEY.

  TYPES:
    BEGIN OF ty_git_user,
      name  TYPE string,
      email TYPE string,
    END OF ty_git_user.

  TYPES:
    BEGIN OF ty_comment,
      committer TYPE ty_git_user,
      author    TYPE ty_git_user,
      comment   TYPE string,
    END OF ty_comment.

  TYPES: BEGIN OF ty_item,
           obj_type TYPE tadir-object,
           obj_name TYPE tadir-obj_name,
           devclass TYPE devclass,
         END OF ty_item,
         ty_items_tt TYPE STANDARD TABLE OF ty_item WITH DEFAULT KEY,
         ty_items_ts TYPE SORTED TABLE OF ty_item WITH UNIQUE KEY obj_type obj_name.

  TYPES: BEGIN OF ty_file_item,
           file TYPE lif_defs=>ty_file,
           item TYPE ty_item,
         END OF ty_file_item.
  TYPES: ty_files_item_tt TYPE STANDARD TABLE OF ty_file_item WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_metadata,
           class        TYPE string,
           version      TYPE string,
           late_deser   TYPE abap_bool,
           delete_tadir TYPE abap_bool,
           ddic         TYPE abap_bool,
         END OF ty_metadata.

  TYPES: BEGIN OF ty_web_asset,
           url     TYPE w3url,
           base64  TYPE string,
           content TYPE xstring,
         END OF ty_web_asset.
  TYPES  tt_web_assets TYPE STANDARD TABLE OF ty_web_asset WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_repo_file,
           path       TYPE string,
           filename   TYPE string,
           is_changed TYPE abap_bool,
           rstate     TYPE char1,
           lstate     TYPE char1,
         END OF ty_repo_file.
  TYPES  tt_repo_files TYPE STANDARD TABLE OF ty_repo_file WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_stage_files,
           local  TYPE lif_defs=>ty_files_item_tt,
           remote TYPE lif_defs=>ty_files_tt,
         END OF ty_stage_files.

  CONSTANTS: BEGIN OF gc_type,
               commit TYPE lif_defs=>ty_type VALUE 'commit', "#EC NOTEXT
               tree   TYPE lif_defs=>ty_type VALUE 'tree',  "#EC NOTEXT
               ref_d  TYPE lif_defs=>ty_type VALUE 'ref_d', "#EC NOTEXT
               blob   TYPE lif_defs=>ty_type VALUE 'blob',  "#EC NOTEXT
             END OF gc_type.

  TYPES: ty_chmod TYPE c LENGTH 6.

  TYPES: BEGIN OF ty_object,
           sha1 TYPE lif_defs=>ty_sha1,
           type TYPE lif_defs=>ty_type,
           data TYPE xstring,
         END OF ty_object.
  TYPES: ty_objects_tt TYPE STANDARD TABLE OF ty_object WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_tadir,
           pgmid    TYPE tadir-pgmid,
           object   TYPE tadir-object,
           obj_name TYPE tadir-obj_name,
           devclass TYPE tadir-devclass,
           korrnum  TYPE tadir-korrnum,
           path     TYPE string,
         END OF ty_tadir.
  TYPES: ty_tadir_tt TYPE STANDARD TABLE OF ty_tadir WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_result,
           obj_type TYPE tadir-object,
           obj_name TYPE tadir-obj_name,
           path     TYPE string,
           filename TYPE string,
           package  TYPE devclass,
           match    TYPE sap_bool,
           lstate   TYPE char1,
           rstate   TYPE char1,
         END OF ty_result.
  TYPES: ty_results_tt TYPE STANDARD TABLE OF ty_result WITH DEFAULT KEY.

  TYPES: ty_sval_tt TYPE STANDARD TABLE OF sval WITH DEFAULT KEY.

  TYPES: ty_seocompotx_tt TYPE STANDARD TABLE OF seocompotx WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_tpool.
      INCLUDE TYPE textpool.
  TYPES:   split TYPE c LENGTH 8.
  TYPES: END OF ty_tpool.

  TYPES: ty_tpool_tt TYPE STANDARD TABLE OF ty_tpool WITH DEFAULT KEY.

  TYPES: BEGIN OF ty_sotr,
           header  TYPE sotr_head,
           entries TYPE sotr_text_tt,
         END OF ty_sotr.

  TYPES: ty_sotr_tt TYPE STANDARD TABLE OF ty_sotr WITH DEFAULT KEY.

  TYPES:
    BEGIN OF ty_transport_to_branch,
      branch_name TYPE string,
      commit_text TYPE string,
    END OF ty_transport_to_branch.

  CONSTANTS: BEGIN OF gc_state, " https://git-scm.com/docs/git-status
               unchanged TYPE char1 VALUE '',
               added     TYPE char1 VALUE 'A',
               modified  TYPE char1 VALUE 'M',
               deleted   TYPE char1 VALUE 'D', "For future use
               mixed     TYPE char1 VALUE '*',
             END OF gc_state.

  CONSTANTS: BEGIN OF gc_chmod,
               file       TYPE ty_chmod VALUE '100644',
               executable TYPE ty_chmod VALUE '100755',
               dir        TYPE ty_chmod VALUE '40000 ',
             END OF gc_chmod.

  CONSTANTS: BEGIN OF gc_event_state,
               not_handled         VALUE 0,
               re_render           VALUE 1,
               new_page            VALUE 2,
               go_back             VALUE 3,
               no_more_act         VALUE 4,
               new_page_w_bookmark VALUE 5,
               go_back_to_bookmark VALUE 6,
               new_page_replacing  VALUE 7,
             END OF gc_event_state.

  CONSTANTS: BEGIN OF gc_html_opt,
               strong   TYPE c VALUE 'E',
               cancel   TYPE c VALUE 'C',
               crossout TYPE c VALUE 'X',
             END OF gc_html_opt.

  CONSTANTS: BEGIN OF gc_action_type,
               sapevent  TYPE c VALUE 'E',
               url       TYPE c VALUE 'U',
               onclick   TYPE c VALUE 'C',
               separator TYPE c VALUE 'S',
               dummy     TYPE c VALUE '_',
             END OF gc_action_type.

  CONSTANTS: gc_crlf    TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf.
  CONSTANTS: gc_newline TYPE abap_char1 VALUE cl_abap_char_utilities=>newline.

  CONSTANTS: gc_english TYPE spras VALUE 'E'.

  CONSTANTS: gc_root_dir     TYPE string VALUE '/',
             gc_dot_abapgit  TYPE string VALUE '.abapgit.xml' ##NO_TEXT,
             gc_author_regex TYPE string VALUE '^([\\\w\s\.@\-_1-9\(\) ]+) <(.*)> (\d{10})\s?.\d{4}$' ##NO_TEXT.

  CONSTANTS: BEGIN OF gc_action,
               repo_clone               TYPE string VALUE 'repo_clone',
               repo_refresh             TYPE string VALUE 'repo_refresh',
               repo_remove              TYPE string VALUE 'repo_remove',
               repo_settings            TYPE string VALUE 'repo_settings',
               repo_purge               TYPE string VALUE 'repo_purge',
               repo_newoffline          TYPE string VALUE 'repo_newoffline',
               repo_remote_attach       TYPE string VALUE 'repo_remote_attach',
               repo_remote_detach       TYPE string VALUE 'repo_remote_detach',
               repo_remote_change       TYPE string VALUE 'repo_remote_change',
               repo_refresh_checksums   TYPE string VALUE 'repo_refresh_checksums',
               repo_toggle_fav          TYPE string VALUE 'repo_toggle_fav',
               repo_transport_to_branch TYPE string VALUE 'repo_transport_to_branch',

               abapgit_home             TYPE string VALUE 'abapgit_home',
               abapgit_wiki             TYPE string VALUE 'abapgit_wiki',
               abapgit_install          TYPE string VALUE 'abapgit_install',
               abapgit_install_pi       TYPE string VALUE 'abapgit_install_pi',

               zip_import               TYPE string VALUE 'zip_import',
               zip_export               TYPE string VALUE 'zip_export',
               zip_package              TYPE string VALUE 'zip_package',
               zip_transport            TYPE string VALUE 'zip_transport',
               zip_object               TYPE string VALUE 'zip_object',

               git_pull                 TYPE string VALUE 'git_pull',
               git_reset                TYPE string VALUE 'git_reset',
               git_branch_create        TYPE string VALUE 'git_branch_create',
               git_branch_switch        TYPE string VALUE 'git_branch_switch',
               git_branch_delete        TYPE string VALUE 'git_branch_delete',
               git_commit               TYPE string VALUE 'git_commit',

               db_delete                TYPE string VALUE 'db_delete',
               db_update                TYPE string VALUE 'db_update',
               db_display               TYPE string VALUE 'db_display',
               db_edit                  TYPE string VALUE 'db_edit',
               bg_update                TYPE string VALUE 'bg_update',

               go_main                  TYPE string VALUE 'go_main',
               go_explore               TYPE string VALUE 'go_explore',
               go_db                    TYPE string VALUE 'go_db',
               go_background            TYPE string VALUE 'go_background',
               go_background_run        TYPE string VALUE 'go_background_run',
               go_diff                  TYPE string VALUE 'go_diff',
               go_stage                 TYPE string VALUE 'go_stage',
               go_commit                TYPE string VALUE 'go_commit',
               go_branch_overview       TYPE string VALUE 'go_branch_overview',
               go_playground            TYPE string VALUE 'go_playground',
               go_debuginfo             TYPE string VALUE 'go_debuginfo',
               go_settings              TYPE string VALUE 'go_settings',
               go_tutorial              TYPE string VALUE 'go_tutorial',

               jump                     TYPE string VALUE 'jump',
               jump_pkg                 TYPE string VALUE 'jump_pkg',
             END OF gc_action.

ENDINTERFACE.

fix #865

fix #865


*&---------------------------------------------------------------------*
*&  Include  zabapgit_object_dcls
*&---------------------------------------------------------------------*

CLASS lcl_object_dcls DEFINITION INHERITING FROM lcl_objects_super FINAL.

  PUBLIC SECTION.
    INTERFACES lif_object.
    ALIASES mo_files FOR lif_object~mo_files.

ENDCLASS.

CLASS lcl_object_dcls IMPLEMENTATION.

  METHOD lif_object~has_changed_since.
    rv_changed = abap_true.
  ENDMETHOD.

  METHOD lif_object~changed_by.
    rv_user = c_user_unknown.
  ENDMETHOD.

  METHOD lif_object~get_metadata.
    rs_metadata = get_metadata( ).

    rs_metadata-ddic         = abap_true.
    rs_metadata-delete_tadir = abap_true.
  ENDMETHOD.

  METHOD lif_object~exists.

    DATA: li_dcl TYPE REF TO object.

    TRY.
        CALL METHOD ('CL_ACM_DCL_HANDLER_FACTORY')=>('CREATE')
          RECEIVING
            ro_handler = li_dcl.

        CALL METHOD li_dcl->('CHECK_EXISTENCE')
          EXPORTING
            iv_objectname = ms_item-obj_name
          RECEIVING
            rv_exists     = rv_bool.

      CATCH cx_root.
        rv_bool = abap_false.
    ENDTRY.

  ENDMETHOD.

  METHOD lif_object~jump.

    DATA: adt_link          TYPE string,
          obj_name          TYPE e071-obj_name,
          li_object         TYPE REF TO cl_wb_object,
          li_adt            TYPE REF TO object,
          li_adt_uri_mapper TYPE REF TO object,
          li_adt_objref     TYPE REF TO object.

    FIELD-SYMBOLS: <uri> TYPE string.

    TRY.

        obj_name = ms_item-obj_name.

        li_object = cl_wb_object=>create_from_transport_key( p_object = ms_item-obj_type p_obj_name = obj_name ).

        CALL METHOD ('CL_ADT_TOOLS_CORE_FACTORY')=>('GET_INSTANCE')
          RECEIVING
            result = li_adt.

        CALL METHOD li_adt->('IF_ADT_TOOLS_CORE_FACTORY~GET_URI_MAPPER')
          RECEIVING
            result = li_adt_uri_mapper.

        CALL METHOD li_adt_uri_mapper->('IF_ADT_URI_MAPPER~MAP_WB_OBJECT_TO_OBJREF')
          EXPORTING
            wb_object = li_object
          RECEIVING
            result    = li_adt_objref.

        ASSIGN ('li_adt_objref->ref_data-uri') TO <uri>.

        CONCATENATE 'adt://' sy-sysid <uri> INTO adt_link.

        cl_gui_frontend_services=>execute( EXPORTING  document = adt_link
                                           EXCEPTIONS OTHERS   = 1 ).

      CATCH cx_root.
        lcx_exception=>raise( 'DCLS Jump Error' ).
    ENDTRY.

  ENDMETHOD.

  METHOD lif_object~delete.

    DATA: li_dcl TYPE REF TO object.

    TRY.
        CALL METHOD ('CL_ACM_DCL_HANDLER_FACTORY')=>('CREATE')
          RECEIVING
            ro_handler = li_dcl.

        CALL METHOD li_dcl->('DELETE')
          EXPORTING
            iv_dclname = ms_item-obj_name.

      CATCH cx_root.
        lcx_exception=>raise( 'DCLS error' ).
    ENDTRY.

  ENDMETHOD.

  METHOD lif_object~serialize.

    DATA: lr_data TYPE REF TO data,
          li_dcl  TYPE REF TO object.

    FIELD-SYMBOLS: <ls_data> TYPE any,
                   <field>   TYPE any.

    CREATE DATA lr_data TYPE ('ACM_S_DCLSRC').
    ASSIGN lr_data->* TO <ls_data>.

    TRY.
        CALL METHOD ('CL_ACM_DCL_HANDLER_FACTORY')=>('CREATE')
          RECEIVING
            ro_handler = li_dcl.

        CALL METHOD li_dcl->('READ')
          EXPORTING
            iv_dclname = ms_item-obj_name
          IMPORTING
            es_dclsrc  = <ls_data>.

        ASSIGN COMPONENT 'AS4USER' OF STRUCTURE <ls_data> TO <field>.
        ASSERT sy-subrc = 0.
        CLEAR <field>.

        ASSIGN COMPONENT 'AS4DATE' OF STRUCTURE <ls_data> TO <field>.
        ASSERT sy-subrc = 0.
        CLEAR <field>.

        ASSIGN COMPONENT 'AS4TIME' OF STRUCTURE <ls_data> TO <field>.
        ASSERT sy-subrc = 0.
        CLEAR <field>.

        ASSIGN COMPONENT 'CREATED_BY'
               OF STRUCTURE <ls_data>
               TO <field>.
        ASSERT sy-subrc = 0.
        CLEAR <field>.

        ASSIGN COMPONENT 'CREATED_DATE' OF STRUCTURE <ls_data> TO <field>.
        ASSERT sy-subrc = 0.
        CLEAR <field>.

        ASSIGN COMPONENT 'SOURCE' OF STRUCTURE <ls_data> TO <field>.
        ASSERT sy-subrc = 0.

        mo_files->add_string( iv_ext = 'asdcls'  iv_string = <field> ).

        CLEAR <field>.

        io_xml->add( iv_name = 'DCLS'
                     ig_data = <ls_data> ).

      CATCH cx_root.
        lcx_exception=>raise( 'DCLS error' ).
    ENDTRY.

  ENDMETHOD.

  METHOD lif_object~deserialize.

    DATA: lr_data TYPE REF TO data,
          li_dcl  TYPE REF TO object.

    FIELD-SYMBOLS: <ls_data> TYPE any,
                   <field>   TYPE any.

    CREATE DATA lr_data TYPE ('ACM_S_DCLSRC').
    ASSIGN lr_data->* TO <ls_data>.

    io_xml->read(
      EXPORTING
        iv_name = 'DCLS'
      CHANGING
        cg_data = <ls_data> ).

    ASSIGN COMPONENT 'SOURCE' OF STRUCTURE <ls_data> TO <field>.
    ASSERT sy-subrc = 0.
    <field> = mo_files->read_string( 'asdcls' ).

    TRY.
        CALL METHOD ('CL_ACM_DCL_HANDLER_FACTORY')=>('CREATE')
          RECEIVING
            ro_handler = li_dcl.

        CALL METHOD li_dcl->('SAVE')
          EXPORTING
            iv_dclname     = ms_item-obj_name
            iv_put_state   = 'A'
            is_dclsrc      = <ls_data>
            iv_devclass    = iv_package
            iv_access_mode = 'INSERT'.

        tadir_insert( iv_package ).

      CATCH cx_root.
        lcx_exception=>raise( 'DCLS error' ).
    ENDTRY.

    lcl_objects_activation=>add_item( ms_item ).

  ENDMETHOD.

  METHOD lif_object~compare_to_remote_version.
    CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result.
  ENDMETHOD.

ENDCLASS.

Update zabapgit_object_dcls.prog.abap

Update zabapgit_object_dcls.prog.abap


*&---------------------------------------------------------------------*
*&  Include           ZABAPGIT_OBJECT_WAPA
*&---------------------------------------------------------------------*

*----------------------------------------------------------------------*
*       CLASS lcl_object_wapa DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_object_wapa DEFINITION INHERITING FROM lcl_objects_super FINAL.

  PUBLIC SECTION.
    INTERFACES lif_object.
    ALIASES mo_files FOR lif_object~mo_files.

  PRIVATE SECTION.
    TYPES: BEGIN OF ty_page,
             attributes     TYPE o2pagattr,
             event_handlers TYPE o2pagevh_tabletype,
             parameters     TYPE o2pagpar_tabletype,
             types          TYPE rswsourcet,
           END OF ty_page.

    TYPES: ty_pages_tt TYPE STANDARD TABLE OF ty_page WITH DEFAULT KEY.

    CONSTANTS: c_active TYPE so2_version VALUE 'A'.

    METHODS:
      get_page_content
        IMPORTING io_page           TYPE REF TO cl_o2_api_pages
        RETURNING VALUE(rv_content) TYPE xstring,
      to_page_content
        IMPORTING iv_content        TYPE xstring
        RETURNING VALUE(rt_content) TYPE o2pageline_table,
      read_page
        IMPORTING is_page        TYPE o2pagattr
        RETURNING VALUE(rs_page) TYPE ty_page
        RAISING   lcx_exception.

ENDCLASS.                    "lcl_object_TRAN DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_object_wapa IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_object_wapa IMPLEMENTATION.

  METHOD lif_object~has_changed_since.
    rv_changed = abap_true.
  ENDMETHOD.  "lif_object~has_changed_since

  METHOD lif_object~changed_by.

    DATA: lv_name   TYPE o2applname,
          lt_pages  TYPE STANDARD TABLE OF o2pagdir WITH DEFAULT KEY,
          ls_latest LIKE LINE OF lt_pages.

    lv_name = ms_item-obj_name.

    SELECT * FROM o2pagdir INTO TABLE lt_pages WHERE applname = lv_name.
    IF sy-subrc <> 0.
      rv_user = c_user_unknown.
      RETURN.
    ENDIF.

    SORT lt_pages BY changedon DESCENDING changetime DESCENDING.

    READ TABLE lt_pages INDEX 1 INTO ls_latest.
    ASSERT sy-subrc = 0.

    rv_user = ls_latest-changedby.

  ENDMETHOD.

  METHOD lif_object~get_metadata.
    rs_metadata = get_metadata( ).
  ENDMETHOD.                    "lif_object~get_metadata

  METHOD lif_object~exists.

    DATA: lv_name TYPE o2applname.

    lv_name = ms_item-obj_name.

    cl_o2_api_application=>load(
      EXPORTING
        p_application_name  = lv_name
      EXCEPTIONS
        object_not_existing = 1
        permission_failure  = 2
        error_occured       = 3 ).
    rv_bool = boolc( sy-subrc = 0 ).

  ENDMETHOD.                    "lif_object~exists

  METHOD lif_object~jump.

    CALL FUNCTION 'RS_TOOL_ACCESS'
      EXPORTING
        operation     = 'SHOW'
        object_name   = ms_item-obj_name
        object_type   = ms_item-obj_type
        in_new_window = abap_true.

  ENDMETHOD.                    "jump

  METHOD lif_object~delete.

    DATA: lv_name    TYPE o2applname,
          lo_bsp     TYPE REF TO cl_o2_api_application,
          ls_pagekey TYPE o2pagkey,
          lv_object  TYPE seu_objkey,
          lt_pages   TYPE o2pagelist.

    FIELD-SYMBOLS: <ls_page> LIKE LINE OF lt_pages.

    lv_name = ms_item-obj_name.

    cl_o2_api_application=>load(
      EXPORTING
        p_application_name  = lv_name
      IMPORTING
        p_application       = lo_bsp
      EXCEPTIONS
        object_not_existing = 1
        permission_failure  = 2
        error_occured       = 3 ).
    ASSERT sy-subrc = 0.

    lo_bsp->set_changeable(
      p_changeable           = abap_true
      p_complete_application = abap_true ).

    cl_o2_api_pages=>get_all_pages(
      EXPORTING
        p_applname = lv_name
        p_version  = c_active
      IMPORTING
        p_pages    = lt_pages ).

    LOOP AT lt_pages ASSIGNING <ls_page>.
      CLEAR ls_pagekey.
      ls_pagekey-applname = lv_name.
      ls_pagekey-pagekey  = <ls_page>-pagekey.

      cl_o2_page=>delete_page_for_application(
        EXPORTING
          p_pagekey           = ls_pagekey
        EXCEPTIONS
          object_not_existing = 1
          error_occured       = 2 ).
      ASSERT sy-subrc = 0.
    ENDLOOP.

    lo_bsp->delete( ).

* release lock
    lv_object = lv_name.
    cl_o2_api_application=>call_access_permission(
      p_mode                 = 'FREE'
      p_object               = lv_object
      p_complete_application = abap_true ).

  ENDMETHOD.                    "delete

  METHOD lif_object~deserialize.

    DATA: lo_bsp        TYPE REF TO cl_o2_api_application,
          lv_name       TYPE o2applname,
          ls_attributes TYPE o2applattr,
          lt_nodes      TYPE o2applnode_table,
          lt_navgraph   TYPE o2applgrap_table,
          lv_objkey     TYPE seu_objkey,
          ls_item       LIKE ms_item,
          lv_extra      TYPE string,
          lv_content    TYPE xstring,
          lv_ext        TYPE string,
          lo_page       TYPE REF TO cl_o2_api_pages,
          lt_pages_info TYPE ty_pages_tt.

    FIELD-SYMBOLS: <ls_page> LIKE LINE OF lt_pages_info.

    lv_name = ms_item-obj_name.

    io_xml->read( EXPORTING iv_name = 'ATTRIBUTES'
                  CHANGING cg_data = ls_attributes ).
    io_xml->read( EXPORTING iv_name = 'NAVGRAPH'
                  CHANGING cg_data = lt_navgraph ).
    io_xml->read( EXPORTING iv_name = 'PAGES'
                  CHANGING cg_data = lt_pages_info ).

    ls_attributes-devclass = iv_package.

* todo: overwrite existing
    cl_o2_api_application=>create_new(
      EXPORTING
        p_application_data      = ls_attributes
        p_nodes                 = lt_nodes
        p_navgraph              = lt_navgraph
      IMPORTING
        p_application           = lo_bsp
      EXCEPTIONS
        object_already_existing = 1
        object_just_created     = 2
        not_authorized          = 3
        undefined_name          = 4
        author_not_existing     = 5
        action_cancelled        = 6
        error_occured           = 7
        invalid_parameter       = 8 ).
    IF sy-subrc <> 0.
      lcx_exception=>raise( |WAPA - error from create_new: { sy-subrc }| ).
    ENDIF.

    lo_bsp->save( ).

    lo_bsp->set_changeable(
      p_changeable           = abap_false
      p_complete_application = abap_true ).

    ls_item-obj_type = 'WAPD'.
    ls_item-obj_name = ms_item-obj_name.
    lcl_objects_activation=>add_item( ls_item ).

    lv_objkey = ls_item-obj_name.
* todo, hmm, the WAPD is not added to the worklist during activation
    cl_o2_api_application=>activate( lv_objkey ).

    LOOP AT lt_pages_info ASSIGNING <ls_page>.
      cl_o2_api_pages=>create_new_page(
        EXPORTING
          p_pageattrs = <ls_page>-attributes
        IMPORTING
          p_page      = lo_page ).

      SPLIT <ls_page>-attributes-pagename AT '.' INTO lv_extra lv_ext.
      REPLACE ALL OCCURRENCES OF '_-' IN lv_extra WITH '/'.
      lv_content = mo_files->read_raw( iv_extra = lv_extra
                                       iv_ext   = lv_ext ).
      lo_page->set_page( to_page_content( lv_content ) ).

      lo_page->set_event_handlers( <ls_page>-event_handlers ).
      lo_page->set_parameters( <ls_page>-parameters ).
      lo_page->set_type_source( <ls_page>-types ).

      lo_page->save( p_with_all_texts = abap_true ).

      ls_item-obj_type = 'WAPP'.
      ls_item-obj_name = cl_wb_object_type=>get_concatenated_key_from_id(
        p_key_component1 = <ls_page>-attributes-applname
        p_key_component2 = <ls_page>-attributes-pagekey
        p_external_id    = 'WG ' ).
      lcl_objects_activation=>add_item( ls_item ).
    ENDLOOP.

  ENDMETHOD.                    "deserialize

  METHOD lif_object~serialize.

    DATA: lv_name       TYPE o2applname,
          ls_attributes TYPE o2applattr,
          lt_navgraph   TYPE o2applgrap_table,
          lt_pages      TYPE o2pagelist,
          lt_pages_info TYPE ty_pages_tt,
          lo_bsp        TYPE REF TO cl_o2_api_application.

    FIELD-SYMBOLS: <ls_page> LIKE LINE OF lt_pages.

    lv_name = ms_item-obj_name.

    cl_o2_api_application=>load(
      EXPORTING
        p_application_name  = lv_name
      IMPORTING
        p_application       = lo_bsp
      EXCEPTIONS
        object_not_existing = 1
        permission_failure  = 2
        error_occured       = 3 ).
    IF sy-subrc <> 0.
      RETURN.
    ENDIF.

    lo_bsp->get_attributes(
      EXPORTING
        p_version    = c_active
      IMPORTING
        p_attributes = ls_attributes ).

    CLEAR: ls_attributes-author,
           ls_attributes-createdon,
           ls_attributes-changedby,
           ls_attributes-changedon,
           ls_attributes-devclass.

    io_xml->add( iv_name = 'ATTRIBUTES'
                 ig_data = ls_attributes ).

    lo_bsp->get_navgraph(
      EXPORTING
        p_version  = c_active
      IMPORTING
        p_navgraph = lt_navgraph ).

    io_xml->add( iv_name = 'NAVGRAPH'
                 ig_data = lt_navgraph ).

    cl_o2_api_pages=>get_all_pages(
      EXPORTING
        p_applname = lv_name
        p_version  = c_active
      IMPORTING
        p_pages    = lt_pages ).

    LOOP AT lt_pages ASSIGNING <ls_page>.
      APPEND read_page( <ls_page> ) TO lt_pages_info.
    ENDLOOP.

    io_xml->add( iv_name = 'PAGES'
                 ig_data = lt_pages_info ).

  ENDMETHOD.                    "serialize

  METHOD read_page.

    DATA: lv_name    TYPE o2applname,
          ls_pagekey TYPE o2pagkey,
          lv_content TYPE xstring,
          lv_extra   TYPE string,
          lv_ext     TYPE string,
          lo_page    TYPE REF TO cl_o2_api_pages.

    lv_name = ms_item-obj_name.

    ls_pagekey-applname = lv_name.
    ls_pagekey-pagekey = is_page-pagekey.

    cl_o2_api_pages=>load(
      EXPORTING
        p_pagekey = ls_pagekey
      IMPORTING
        p_page    = lo_page ).

    lo_page->get_event_handlers(
      IMPORTING
        p_ev_handler = rs_page-event_handlers
      EXCEPTIONS
        page_deleted = 1
        invalid_call = 2 ).
    ASSERT sy-subrc = 0.

    lo_page->get_parameters(
      IMPORTING
        p_parameters = rs_page-parameters
      EXCEPTIONS
        page_deleted = 1
        invalid_call = 2
        OTHERS       = 3 ).
    ASSERT sy-subrc = 0.

    lo_page->get_type_source(
      IMPORTING
        p_source     = rs_page-types
      EXCEPTIONS
        page_deleted = 1
        invalid_call = 2
        OTHERS       = 3 ).
    ASSERT sy-subrc = 0.

    lv_content = get_page_content( lo_page ).
    SPLIT is_page-pagename AT '.' INTO lv_extra lv_ext.
    REPLACE ALL OCCURRENCES OF '/' IN lv_extra WITH '_-'.
    mo_files->add_raw(
      iv_extra = lv_extra
      iv_ext   = lv_ext
      iv_data  = lv_content ).

    rs_page-attributes = is_page.

    CLEAR: rs_page-attributes-author,
           rs_page-attributes-createdon,
           rs_page-attributes-changedby,
           rs_page-attributes-changedon,
           rs_page-attributes-implclass,
           rs_page-attributes-gendate,
           rs_page-attributes-gentime.

  ENDMETHOD.

  METHOD to_page_content.

    DATA: lv_string TYPE string.

    lv_string = lcl_convert=>xstring_to_string_utf8( iv_content ).

    SPLIT lv_string AT gc_newline INTO TABLE rt_content.

  ENDMETHOD.

  METHOD get_page_content.

    DATA: lt_content TYPE o2pageline_table,
          lv_string  TYPE string.

    io_page->get_page(
      IMPORTING
        p_content = lt_content ).

    CONCATENATE LINES OF lt_content INTO lv_string SEPARATED BY gc_newline RESPECTING BLANKS.

    rv_content = lcl_convert=>string_to_xstring_utf8( lv_string ).

  ENDMETHOD.

  METHOD lif_object~compare_to_remote_version.
    CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result.
  ENDMETHOD.

ENDCLASS.                    "lcl_object_tran IMPLEMENTATION

Update zabapgit_object_wapa.prog.abap

Update zabapgit_object_wapa.prog.abap


class ZCL_AGS_REPO definition
  public
  create public .

public section.

  types:
    ty_repos_tt TYPE STANDARD TABLE OF zags_repos WITH DEFAULT KEY .
  types:
    ty_branches_tt TYPE STANDARD TABLE OF REF TO zcl_ags_branch WITH DEFAULT KEY .

  class-methods CREATE
    importing
      !IV_NAME type ZAGS_REPOS-NAME
      !IV_DESCRIPTION type ZAGS_REPOS-DESCRIPTION
    returning
      value(RO_REPO) type ref to ZCL_AGS_REPO
    raising
      ZCX_AGS_ERROR .
  class-methods LIST
    returning
      value(RT_LIST) type TY_REPOS_TT .
  methods CONSTRUCTOR
    importing
      !IV_NAME type ZAGS_REPOS-NAME
    raising
      ZCX_AGS_ERROR .
  methods DELETE
    raising
      ZCX_AGS_ERROR .
  methods GET_DATA
    returning
      value(RS_DATA) type ZAGS_REPOS .
  methods LIST_BRANCHES
    returning
      value(RT_LIST) type TY_BRANCHES_TT
    raising
      ZCX_AGS_ERROR .
  methods GET_BRANCH
    importing
      !IV_BRANCH_NAME type ZAGS_BRANCH_NAME
    returning
      value(RO_BRANCH) type ref to ZCL_AGS_BRANCH
    raising
      ZCX_AGS_ERROR .
  PROTECTED SECTION.
  PRIVATE SECTION.

    DATA ms_data TYPE zags_repos.
ENDCLASS.

CLASS ZCL_AGS_REPO IMPLEMENTATION.

  METHOD constructor.

    SELECT SINGLE * FROM zags_repos INTO ms_data
      WHERE name = iv_name.
    IF sy-subrc <> 0.
      RAISE EXCEPTION TYPE zcx_ags_error
        EXPORTING
          textid = zcx_ags_error=>m002.
    ENDIF.

  ENDMETHOD.

  METHOD create.

    DATA: lt_list TYPE ty_repos_tt,
          ls_repo TYPE zags_repos.

    ASSERT NOT iv_name CA '/\'.

    lt_list = list( ).
    READ TABLE lt_list WITH KEY name = iv_name TRANSPORTING NO FIELDS.
    IF sy-subrc = 0.
      RAISE EXCEPTION TYPE zcx_ags_error
        EXPORTING
          textid = zcx_ags_error=>m001.
    ENDIF.

    ls_repo-repo = zcl_ags_util=>uuid( ).
    ls_repo-name = iv_name.
    ls_repo-description = iv_description.
    ls_repo-head = 'master' ##NO_TEXT.

    INSERT zags_repos FROM ls_repo.
    ASSERT sy-subrc = 0.

    ro_repo = NEW zcl_ags_repo( iv_name ).
    zcl_ags_branch=>create( io_repo = ro_repo
                            iv_name = ls_repo-head ).

  ENDMETHOD.

  METHOD delete.

    DATA(lt_branches) = list_branches( ).
    LOOP AT lt_branches ASSIGNING FIELD-SYMBOL(<lo_branch>).
      <lo_branch>->delete( ).
    ENDLOOP.

    DELETE FROM zags_repos WHERE name = ms_data-name.
    ASSERT sy-subrc = 0.

  ENDMETHOD.

  METHOD get_branch.

    LOOP AT list_branches( ) INTO ro_branch.
      IF ro_branch->get_data( )-name = iv_branch_name.
        RETURN.
      ENDIF.
    ENDLOOP.

    ASSERT 0 = 1.

  ENDMETHOD.

  METHOD get_data.

    rs_data = ms_data.

  ENDMETHOD.

  METHOD list.

    SELECT * FROM zags_repos
      INTO TABLE rt_list.                               "#EC CI_NOWHERE

  ENDMETHOD.

  METHOD list_branches.

    DATA: lt_list   TYPE TABLE OF zags_branches-name,
          lo_branch TYPE REF TO zcl_ags_branch.

    SELECT name FROM zags_branches INTO TABLE lt_list
      WHERE repo = ms_data-repo.

    LOOP AT lt_list ASSIGNING FIELD-SYMBOL(<lv_list>).
      CREATE OBJECT lo_branch
        EXPORTING
          io_repo = me
          iv_name = <lv_list>.

      APPEND lo_branch TO rt_list.
    ENDLOOP.

  ENDMETHOD.
ENDCLASS.

CLASS zcl_ags_repo DEFINITION
  PUBLIC
  CREATE PUBLIC.

  PUBLIC SECTION.

    TYPES:
      ty_repos_tt TYPE STANDARD TABLE OF zags_repos WITH DEFAULT KEY.
    TYPES:
      ty_branches_tt TYPE STANDARD TABLE OF REF TO zcl_ags_branch WITH DEFAULT KEY.

    CLASS-METHODS create
      IMPORTING
        !iv_name        TYPE zags_repos-name
        !iv_description TYPE zags_repos-description
      RETURNING
        VALUE(ro_repo)  TYPE REF TO zcl_ags_repo
      RAISING
        zcx_ags_error.
    CLASS-METHODS list
      RETURNING
        VALUE(rt_list) TYPE ty_repos_tt.
    METHODS constructor
      IMPORTING
        !iv_name TYPE zags_repos-name
      RAISING
        zcx_ags_error.
    METHODS delete
      RAISING
        zcx_ags_error.
    METHODS get_data
      RETURNING
        VALUE(rs_data) TYPE zags_repos.
    METHODS list_branches
      RETURNING
        VALUE(rt_list) TYPE ty_branches_tt
      RAISING
        zcx_ags_error.
    METHODS get_branch
      IMPORTING
        !iv_branch_name  TYPE zags_branch_name
      RETURNING
        VALUE(ro_branch) TYPE REF TO zcl_ags_branch
      RAISING
        zcx_ags_error.
  PROTECTED SECTION.
  PRIVATE SECTION.

    DATA ms_data TYPE zags_repos.
ENDCLASS.

CLASS ZCL_AGS_REPO IMPLEMENTATION.

  METHOD constructor.

    SELECT SINGLE * FROM zags_repos INTO ms_data
      WHERE name = iv_name.
    IF sy-subrc <> 0.
      RAISE EXCEPTION TYPE zcx_ags_error
        EXPORTING
          textid = zcx_ags_error=>m002.
    ENDIF.

  ENDMETHOD.

  METHOD create.

    DATA: lt_list TYPE ty_repos_tt,
          ls_repo TYPE zags_repos.

    ASSERT NOT iv_name CA '/\'.

    lt_list = list( ).
    READ TABLE lt_list WITH KEY name = iv_name TRANSPORTING NO FIELDS.
    IF sy-subrc = 0.
      RAISE EXCEPTION TYPE zcx_ags_error
        EXPORTING
          textid = zcx_ags_error=>m001.
    ENDIF.

    ls_repo-repo = zcl_ags_util=>uuid( ).
    ls_repo-name = iv_name.
    ls_repo-description = iv_description.
    ls_repo-head = 'master' ##NO_TEXT.

    INSERT zags_repos FROM ls_repo.
    ASSERT sy-subrc = 0.

    ro_repo = NEW zcl_ags_repo( iv_name ).
    zcl_ags_branch=>create( io_repo = ro_repo
                            iv_name = ls_repo-head ).

  ENDMETHOD.

  METHOD delete.

    DATA(lt_branches) = list_branches( ).
    LOOP AT lt_branches ASSIGNING FIELD-SYMBOL(<lo_branch>).
      <lo_branch>->delete( ).
    ENDLOOP.

    DELETE FROM zags_repos WHERE name = ms_data-name.
    ASSERT sy-subrc = 0.

  ENDMETHOD.

  METHOD get_branch.

    LOOP AT list_branches( ) INTO ro_branch.
      IF ro_branch->get_data( )-name = iv_branch_name.
        RETURN.
      ENDIF.
    ENDLOOP.

    ASSERT 0 = 1.

  ENDMETHOD.

  METHOD get_data.

    rs_data = ms_data.

  ENDMETHOD.

  METHOD list.

    SELECT * FROM zags_repos
      INTO TABLE rt_list.                               "#EC CI_NOWHERE

  ENDMETHOD.

  METHOD list_branches.

    DATA: lt_list   TYPE TABLE OF zags_branches-name,
          lo_branch TYPE REF TO zcl_ags_branch.

    SELECT name FROM zags_branches INTO TABLE lt_list
      WHERE repo = ms_data-repo.

    LOOP AT lt_list ASSIGNING FIELD-SYMBOL(<lv_list>).
      CREATE OBJECT lo_branch
        EXPORTING
          io_repo = me
          iv_name = <lv_list>.

      APPEND lo_branch TO rt_list.
    ENDLOOP.

  ENDMETHOD.
ENDCLASS.

fix indentation

fix indentation


INTERFACE zif_abapgit_popups
  PUBLIC .

  TYPES:
    BEGIN OF ty_popup, " TODO remove, use zif_abapgit_services_repo=>ty_repo_params instead
      url              TYPE string,
      package          TYPE devclass,
      branch_name      TYPE string,
      display_name     TYPE string,
      folder_logic     TYPE string,
      ign_subpkg       TYPE abap_bool,
      master_lang_only TYPE abap_bool,
      cancel           TYPE abap_bool,
    END OF ty_popup .

  CONSTANTS c_new_branch_label TYPE string VALUE '+ create new ...' ##NO_TEXT.

  METHODS popup_search_help
    IMPORTING
      !iv_tab_field TYPE string
    RETURNING
      VALUE(rv_value) TYPE ddshretval-fieldval
    RAISING
      zcx_abapgit_exception .
  METHODS popup_package_export
    EXPORTING
      !ev_package                    TYPE devclass
      !ev_folder_logic               TYPE string
      !ev_serialize_master_lang_only TYPE abap_bool
    RAISING
      zcx_abapgit_exception .
  METHODS popup_folder_logic
    RETURNING
      VALUE(rv_folder_logic) TYPE string
    RAISING
      zcx_abapgit_exception .
  METHODS popup_object
    RETURNING
      VALUE(rs_tadir) TYPE zif_abapgit_definitions=>ty_tadir
    RAISING
      zcx_abapgit_exception .
  METHODS create_branch_popup
    IMPORTING
      iv_source_branch_name TYPE string
    EXPORTING
      !ev_name   TYPE string
      !ev_cancel TYPE abap_bool
    RAISING
      zcx_abapgit_exception .
  METHODS repo_new_offline
    RETURNING
      VALUE(rs_popup) TYPE ty_popup
    RAISING
      zcx_abapgit_exception .
  METHODS branch_list_popup
    IMPORTING
      !iv_url             TYPE string
      !iv_default_branch  TYPE string OPTIONAL
      !iv_show_new_option TYPE abap_bool OPTIONAL
      !iv_hide_branch     TYPE zif_abapgit_persistence=>ty_repo-branch_name OPTIONAL
      !iv_hide_head       TYPE abap_bool OPTIONAL
    RETURNING
      VALUE(rs_branch)    TYPE zif_abapgit_definitions=>ty_git_branch
    RAISING
      zcx_abapgit_exception .
  METHODS repo_popup
    IMPORTING
      !iv_url            TYPE string
      !iv_package        TYPE devclass OPTIONAL
      !iv_branch         TYPE string DEFAULT 'refs/heads/master'
      !iv_freeze_package TYPE abap_bool OPTIONAL
      !iv_freeze_url     TYPE abap_bool OPTIONAL
      !iv_title          TYPE clike DEFAULT 'New Online Project'
      !iv_display_name   TYPE string OPTIONAL
    RETURNING
      VALUE(rs_popup)    TYPE ty_popup
    RAISING
      zcx_abapgit_exception ##NO_TEXT.
  METHODS popup_to_confirm
    IMPORTING
      !iv_titlebar              TYPE clike
      !iv_text_question         TYPE clike
      !iv_text_button_1         TYPE clike DEFAULT 'Yes'
      !iv_icon_button_1         TYPE icon-name DEFAULT space
      !iv_text_button_2         TYPE clike DEFAULT 'No'
      !iv_icon_button_2         TYPE icon-name DEFAULT space
      !iv_default_button        TYPE char1 DEFAULT '1'
      !iv_display_cancel_button TYPE char1 DEFAULT abap_true
    RETURNING
      VALUE(rv_answer)          TYPE char1
    RAISING
      zcx_abapgit_exception .
  METHODS popup_to_inform
    IMPORTING
      !iv_titlebar     TYPE clike
      !iv_text_message TYPE clike
    RAISING
      zcx_abapgit_exception .
  METHODS popup_to_create_package
    EXPORTING
      !es_package_data TYPE scompkdtln
      !ev_create       TYPE abap_bool
    RAISING
      zcx_abapgit_exception .
  METHODS popup_to_create_transp_branch
    IMPORTING
      !it_transport_headers      TYPE trwbo_request_headers
    RETURNING
      VALUE(rs_transport_branch) TYPE zif_abapgit_definitions=>ty_transport_to_branch
    RAISING
      zcx_abapgit_exception.
  METHODS popup_to_select_transports
    RETURNING
      VALUE(rt_trkorr) TYPE trwbo_request_headers .
  METHODS popup_to_select_from_list
    IMPORTING
      !it_list               TYPE STANDARD TABLE
      !iv_title              TYPE lvc_title        DEFAULT space
      !iv_header_text        TYPE csequence        DEFAULT space
      !iv_start_column       TYPE i                DEFAULT 2
      !iv_end_column         TYPE i                DEFAULT 65
      !iv_start_line         TYPE i                DEFAULT 8
      !iv_end_line           TYPE i                DEFAULT 20
      !iv_striped_pattern    TYPE abap_bool        DEFAULT abap_false
      !iv_optimize_col_width TYPE abap_bool        DEFAULT abap_true
      !iv_selection_mode     TYPE salv_de_constant DEFAULT if_salv_c_selection_mode=>multiple
      !iv_select_column_text TYPE csequence        DEFAULT space
      !it_columns_to_display TYPE zif_abapgit_definitions=>ty_alv_column_tt
    EXPORTING
      VALUE(et_list)         TYPE STANDARD TABLE
    RAISING
      zcx_abapgit_exception .
  METHODS branch_popup_callback
    IMPORTING
      !iv_code       TYPE clike
    CHANGING
      !ct_fields     TYPE zif_abapgit_definitions=>ty_sval_tt
      !cs_error      TYPE svale
      !cv_show_popup TYPE char01
    RAISING
      zcx_abapgit_exception .
  METHODS package_popup_callback
    IMPORTING
      !iv_code       TYPE clike
    CHANGING
      !ct_fields     TYPE zif_abapgit_definitions=>ty_sval_tt
      !cs_error      TYPE svale
      !cv_show_popup TYPE char01
    RAISING
      zcx_abapgit_exception .
  METHODS popup_transport_request
    IMPORTING
      !is_transport_type  TYPE zif_abapgit_definitions=>ty_transport_type
    RETURNING
      VALUE(rv_transport) TYPE trkorr
    RAISING
      zcx_abapgit_exception.
  METHODS popup_proxy_bypass
    IMPORTING
      !it_proxy_bypass       TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url
    RETURNING
      VALUE(rt_proxy_bypass) TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url
    RAISING
      zcx_abapgit_exception.
ENDINTERFACE.

fix whitespace (#3690)

fix whitespace (#3690)


*&---------------------------------------------------------------------*
*&  Include  zabapgit_object_srfc
*&---------------------------------------------------------------------*

CLASS lcl_object_srfc DEFINITION INHERITING FROM lcl_objects_super FINAL.

  PUBLIC SECTION.
    INTERFACES lif_object.

ENDCLASS.

CLASS lcl_object_srfc IMPLEMENTATION.

  METHOD lif_object~has_changed_since.

    rv_changed = abap_true.

  ENDMETHOD.

  METHOD lif_object~changed_by.

    rv_user = c_user_unknown.

  ENDMETHOD.

  METHOD lif_object~get_metadata.

    rs_metadata = get_metadata( ).
    rs_metadata-delete_tadir = abap_true.

  ENDMETHOD.

  METHOD lif_object~exists.

    DATA: lo_object_data  TYPE REF TO if_wb_object_data_model,
          lo_srfc_persist TYPE REF TO if_wb_object_persist.

    CREATE OBJECT lo_srfc_persist TYPE ('CL_UCONRFC_OBJECT_PERSIST').

    TRY.
        lo_srfc_persist->get(
          EXPORTING
            p_object_key  = |{ ms_item-obj_name }|
            p_version     = 'A'
          CHANGING
            p_object_data = lo_object_data ).

      CATCH cx_swb_object_does_not_exist cx_swb_exception.
        rv_bool = abap_false.
        RETURN.
    ENDTRY.

    rv_bool = abap_true.

  ENDMETHOD.

  METHOD lif_object~serialize.

    DATA: lo_object_data  TYPE REF TO if_wb_object_data_model,
          lo_srfc_persist TYPE REF TO if_wb_object_persist,
          lr_srfc_data    TYPE REF TO data,
          lx_error        TYPE REF TO cx_root,
          lv_text         TYPE string.

    FIELD-SYMBOLS: <ls_srfc_data> TYPE any.

    TRY.
        CREATE DATA lr_srfc_data TYPE ('UCONRFCSERV_COMPLETE').
        ASSIGN lr_srfc_data->* TO <ls_srfc_data>.
        ASSERT sy-subrc = 0.

        CREATE OBJECT lo_srfc_persist TYPE ('CL_UCONRFC_OBJECT_PERSIST').

        lo_srfc_persist->get(
          EXPORTING
            p_object_key  = |{ ms_item-obj_name }|
            p_version     = 'A'
          CHANGING
            p_object_data = lo_object_data ).

        lo_object_data->get_data(
          IMPORTING
            p_data = <ls_srfc_data> ).

      CATCH cx_root INTO lx_error.
        lv_text = lx_error->get_text( ).
        zcx_abapgit_exception=>raise( lv_text ).
    ENDTRY.

    io_xml->add( iv_name = 'SRFC'
                 ig_data = <ls_srfc_data> ).

  ENDMETHOD.

  METHOD lif_object~deserialize.

    DATA: lo_srfc_persist TYPE REF TO if_wb_object_persist,
          lo_object_data  TYPE REF TO if_wb_object_data_model,
          lv_text         TYPE string,
          lr_srfc_data    TYPE REF TO data,
          lx_error        TYPE REF TO cx_root.

    FIELD-SYMBOLS: <ls_srfc_data> TYPE any.

    TRY.

        CREATE DATA lr_srfc_data TYPE ('UCONRFCSERV_COMPLETE').
        ASSIGN lr_srfc_data->* TO <ls_srfc_data>.
        ASSERT sy-subrc = 0.

        io_xml->read(
          EXPORTING
            iv_name = 'SRFC'
          CHANGING
            cg_data = <ls_srfc_data> ).

        CREATE OBJECT lo_srfc_persist TYPE ('CL_UCONRFC_OBJECT_PERSIST').
        CREATE OBJECT lo_object_data TYPE ('CL_UCONRFC_OBJECT_DATA').

        lo_object_data->set_data( p_data = <ls_srfc_data> ).

        lo_srfc_persist->save( lo_object_data ).

        tadir_insert( iv_package ).

      CATCH cx_root INTO lx_error.
        lv_text = lx_error->get_text( ).
        zcx_abapgit_exception=>raise( lv_text ).
    ENDTRY.

  ENDMETHOD.

  METHOD lif_object~delete.

    DATA: lo_srfc_persist TYPE REF TO if_wb_object_persist,
          lx_error        TYPE REF TO cx_swb_exception,
          lv_text         TYPE string.

    CREATE OBJECT lo_srfc_persist TYPE ('CL_UCONRFC_OBJECT_PERSIST').

    TRY.
        lo_srfc_persist->delete( p_object_key = |{ ms_item-obj_name }|
                                 p_version    = 'A' ).

      CATCH cx_swb_object_does_not_exist cx_swb_exception INTO lx_error.
        lv_text = lx_error->get_text( ).
        zcx_abapgit_exception=>raise( lv_text ).
    ENDTRY.

  ENDMETHOD.

  METHOD lif_object~jump.

    CALL FUNCTION 'RS_TOOL_ACCESS'
      EXPORTING
        operation           = 'SHOW'
        object_name         = ms_item-obj_name    " Object Name
        object_type         = ms_item-obj_type    " Object Type
        in_new_window       = abap_true
      EXCEPTIONS
        not_executed        = 1
        invalid_object_type = 2
        OTHERS              = 3.

    IF sy-subrc <> 0.
      zcx_abapgit_exception=>raise( 'error from RS_TOOL_ACCESS' ).
    ENDIF.

  ENDMETHOD.

  METHOD lif_object~compare_to_remote_version.

    CREATE OBJECT ro_comparison_result TYPE lcl_comparison_null.

  ENDMETHOD.

ENDCLASS.

*&---------------------------------------------------------------------*
*&  Include  zabapgit_object_srfc
*&---------------------------------------------------------------------*

CLASS lcl_object_srfc DEFINITION INHERITING FROM lcl_objects_super FINAL.

  PUBLIC SECTION.
    INTERFACES lif_object.

ENDCLASS.

CLASS lcl_object_srfc IMPLEMENTATION.

  METHOD lif_object~has_changed_since.

    rv_changed = abap_true.

  ENDMETHOD.

  METHOD lif_object~changed_by.

    rv_user = c_user_unknown.

  ENDMETHOD.

  METHOD lif_object~get_metadata.

    rs_metadata = get_metadata( ).
    rs_metadata-delete_tadir = abap_true.

  ENDMETHOD.

  METHOD lif_object~exists.

    DATA: lo_object_data  TYPE REF TO if_wb_object_data_model,
          lo_srfc_persist TYPE REF TO if_wb_object_persist.

    TRY.
        CREATE OBJECT lo_srfc_persist TYPE ('CL_UCONRFC_OBJECT_PERSIST').

        lo_srfc_persist->get(
          EXPORTING
            p_object_key  = |{ ms_item-obj_name }|
            p_version     = 'A'
          CHANGING
            p_object_data = lo_object_data ).

      CATCH cx_root.
        rv_bool = abap_false.
        RETURN.
    ENDTRY.

    rv_bool = abap_true.

  ENDMETHOD.

  METHOD lif_object~serialize.

    DATA: lo_object_data  TYPE REF TO if_wb_object_data_model,
          lo_srfc_persist TYPE REF TO if_wb_object_persist,
          lr_srfc_data    TYPE REF TO data,
          lx_error        TYPE REF TO cx_root,
          lv_text         TYPE string.

    FIELD-SYMBOLS: <ls_srfc_data> TYPE any.

    TRY.
        CREATE DATA lr_srfc_data TYPE ('UCONRFCSERV_COMPLETE').
        ASSIGN lr_srfc_data->* TO <ls_srfc_data>.
        ASSERT sy-subrc = 0.

        CREATE OBJECT lo_srfc_persist TYPE ('CL_UCONRFC_OBJECT_PERSIST').

        lo_srfc_persist->get(
          EXPORTING
            p_object_key  = |{ ms_item-obj_name }|
            p_version     = 'A'
          CHANGING
            p_object_data = lo_object_data ).

        lo_object_data->get_data(
          IMPORTING
            p_data = <ls_srfc_data> ).

      CATCH cx_root INTO lx_error.
        lv_text = lx_error->get_text( ).
        zcx_abapgit_exception=>raise( lv_text ).
    ENDTRY.

    io_xml->add( iv_name = 'SRFC'
                 ig_data = <ls_srfc_data> ).

  ENDMETHOD.

  METHOD lif_object~deserialize.

    DATA: lo_srfc_persist TYPE REF TO if_wb_object_persist,
          lo_object_data  TYPE REF TO if_wb_object_data_model,
          lv_text         TYPE string,
          lr_srfc_data    TYPE REF TO data,
          lx_error        TYPE REF TO cx_root.

    FIELD-SYMBOLS: <ls_srfc_data> TYPE any.

    TRY.
        CREATE DATA lr_srfc_data TYPE ('UCONRFCSERV_COMPLETE').
        ASSIGN lr_srfc_data->* TO <ls_srfc_data>.
        ASSERT sy-subrc = 0.

        io_xml->read(
          EXPORTING
            iv_name = 'SRFC'
          CHANGING
            cg_data = <ls_srfc_data> ).

        CREATE OBJECT lo_srfc_persist TYPE ('CL_UCONRFC_OBJECT_PERSIST').
        CREATE OBJECT lo_object_data TYPE ('CL_UCONRFC_OBJECT_DATA').

        lo_object_data->set_data( p_data = <ls_srfc_data> ).

        lo_srfc_persist->save( lo_object_data ).

        tadir_insert( iv_package ).

      CATCH cx_root INTO lx_error.
        lv_text = lx_error->get_text( ).
        zcx_abapgit_exception=>raise( lv_text ).
    ENDTRY.

  ENDMETHOD.

  METHOD lif_object~delete.

    DATA: lo_srfc_persist TYPE REF TO if_wb_object_persist,
          lx_error        TYPE REF TO cx_root,
          lv_text         TYPE string.

    TRY.
        CREATE OBJECT lo_srfc_persist TYPE ('CL_UCONRFC_OBJECT_PERSIST').

        lo_srfc_persist->delete( p_object_key = |{ ms_item-obj_name }|
                                 p_version    = 'A' ).

      CATCH cx_root INTO lx_error.
        lv_text = lx_error->get_text( ).
        zcx_abapgit_exception=>raise( lv_text ).
    ENDTRY.

  ENDMETHOD.

  METHOD lif_object~jump.

    CALL FUNCTION 'RS_TOOL_ACCESS'
      EXPORTING
        operation           = 'SHOW'
        object_name         = ms_item-obj_name    " Object Name
        object_type         = ms_item-obj_type    " Object Type
        in_new_window       = abap_true
      EXCEPTIONS
        not_executed        = 1
        invalid_object_type = 2
        OTHERS              = 3.

    IF sy-subrc <> 0.
      zcx_abapgit_exception=>raise( 'error from RS_TOOL_ACCESS' ).
    ENDIF.

  ENDMETHOD.

  METHOD lif_object~compare_to_remote_version.

    CREATE OBJECT ro_comparison_result TYPE lcl_comparison_null.

  ENDMETHOD.

ENDCLASS.

Unify exception handling

Unify exception handling


CLASS zcl_abapgit_settings DEFINITION
  PUBLIC
  CREATE PUBLIC .

  PUBLIC SECTION.

    CONSTANTS c_commitmsg_comment_length_dft TYPE i VALUE 50 ##NO_TEXT.
    CONSTANTS c_commitmsg_body_size_dft TYPE i VALUE 72 ##NO_TEXT.
    CONSTANTS:
      BEGIN OF c_icon_scaling,
        large TYPE c VALUE 'L',
        small TYPE c VALUE 'S',
      END OF c_icon_scaling .
    CONSTANTS:
      BEGIN OF c_ui_theme,
        default         TYPE string VALUE 'default',
        dark            TYPE string VALUE 'dark',
        belize          TYPE string VALUE 'belize',
        synced_with_gui TYPE string VALUE 'synced_with_gui',
      END OF c_ui_theme .

    METHODS set_proxy_url
      IMPORTING
        !iv_url TYPE string .
    METHODS set_proxy_port
      IMPORTING
        !iv_port TYPE string .
    METHODS set_proxy_authentication
      IMPORTING
        !iv_auth TYPE abap_bool .
    METHODS set_proxy_bypass
      IMPORTING
        !it_bypass TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url OPTIONAL .
    METHODS get_proxy_url
      RETURNING
        VALUE(rv_proxy_url) TYPE string .
    METHODS get_proxy_port
      RETURNING
        VALUE(rv_port) TYPE string .
    METHODS get_proxy_authentication
      RETURNING
        VALUE(rv_auth) TYPE abap_bool .
    METHODS get_proxy_bypass
      RETURNING
        VALUE(rt_bypass) TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url .
    METHODS set_run_critical_tests
      IMPORTING
        !iv_run TYPE abap_bool .
    METHODS get_run_critical_tests
      RETURNING
        VALUE(rv_run) TYPE abap_bool .
    METHODS set_experimental_features
      IMPORTING
        !iv_run TYPE abap_bool .
    METHODS get_experimental_features
      RETURNING
        VALUE(rv_run) TYPE abap_bool .
    METHODS set_max_lines
      IMPORTING
        !iv_lines TYPE i .
    METHODS get_max_lines
      RETURNING
        VALUE(rv_lines) TYPE i .
    METHODS set_adt_jump_enanbled
      IMPORTING
        !iv_adt_jump_enabled TYPE abap_bool .
    METHODS get_adt_jump_enabled
      RETURNING
        VALUE(rv_adt_jump_enabled) TYPE abap_bool .
    METHODS set_commitmsg_comment_length
      IMPORTING
        !iv_length TYPE i .
    METHODS get_commitmsg_comment_length
      RETURNING
        VALUE(rv_length) TYPE i .
    METHODS set_commitmsg_comment_default
      IMPORTING
        !iv_default TYPE string .
    METHODS get_commitmsg_comment_default
      RETURNING
        VALUE(rv_default) TYPE string .
    METHODS set_commitmsg_body_size
      IMPORTING
        !iv_length TYPE i .
    METHODS get_commitmsg_body_size
      RETURNING
        VALUE(rv_length) TYPE i .
    METHODS set_commitmsg_hide_author
      IMPORTING
        !iv_hide_author TYPE abap_bool.
    METHODS get_commitmsg_hide_author
      RETURNING
        VALUE(rv_hide_author) TYPE abap_bool.
    METHODS get_settings_xml
      RETURNING
        VALUE(rv_settings_xml) TYPE string
      RAISING
        zcx_abapgit_exception .
    METHODS get_user_settings
      RETURNING
        VALUE(rs_settings) TYPE zif_abapgit_definitions=>ty_s_user_settings
      RAISING
        zcx_abapgit_exception .
    METHODS set_xml_settings
      IMPORTING
        !iv_settings_xml TYPE string
      RAISING
        zcx_abapgit_exception .
    METHODS set_defaults .
    METHODS set_user_settings
      IMPORTING
        !is_user_settings TYPE zif_abapgit_definitions=>ty_s_user_settings .
    METHODS get_show_default_repo
      RETURNING
        VALUE(rv_show_default_repo) TYPE abap_bool .
    METHODS set_show_default_repo
      IMPORTING
        !iv_show_default_repo TYPE abap_bool .
    METHODS set_link_hints_enabled
      IMPORTING
        !iv_link_hints_enabled TYPE abap_bool .
    METHODS get_link_hints_enabled
      RETURNING
        VALUE(rv_link_hints_enabled) TYPE abap_bool
      RAISING
        zcx_abapgit_exception .
    METHODS set_link_hint_key
      IMPORTING
        !iv_link_hint_key TYPE string .
    METHODS get_link_hint_key
      RETURNING
        VALUE(rv_link_hint_key) TYPE string .
    METHODS set_parallel_proc_disabled
      IMPORTING
        !iv_disable_parallel_proc TYPE abap_bool .
    METHODS get_parallel_proc_disabled
      RETURNING
        VALUE(rv_disable_parallel_proc) TYPE abap_bool .
    METHODS get_icon_scaling
      RETURNING
        VALUE(rv_scaling) TYPE zif_abapgit_definitions=>ty_s_user_settings-icon_scaling .
    METHODS set_icon_scaling
      IMPORTING
        !iv_scaling TYPE zif_abapgit_definitions=>ty_s_user_settings-icon_scaling .
    METHODS get_ui_theme
      IMPORTING
        !iv_resolve_synced TYPE abap_bool DEFAULT abap_true
      RETURNING
        VALUE(rv_ui_theme) TYPE zif_abapgit_definitions=>ty_s_user_settings-ui_theme .
    METHODS set_ui_theme
      IMPORTING
        !iv_ui_theme TYPE zif_abapgit_definitions=>ty_s_user_settings-ui_theme .
    METHODS get_activate_wo_popup
      RETURNING
        VALUE(rv_act_wo_popup) TYPE zif_abapgit_definitions=>ty_s_user_settings-activate_wo_popup .
    METHODS set_activate_wo_popup
      IMPORTING
        !iv_act_wo_popup TYPE zif_abapgit_definitions=>ty_s_user_settings-activate_wo_popup .
  PROTECTED SECTION.
  PRIVATE SECTION.
    TYPES: BEGIN OF ty_s_settings,
             proxy_url                TYPE string,
             proxy_port               TYPE string,
             proxy_auth               TYPE string,
             proxy_bypass             TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url,
             run_critical_tests       TYPE abap_bool,
             experimental_features    TYPE abap_bool,
             commitmsg_comment_length TYPE i,
             commitmsg_comment_deflt  TYPE string,
             commitmsg_body_size      TYPE i,
             commitmsg_hide_author    TYPE abap_bool,
           END OF ty_s_settings.

    DATA: ms_settings      TYPE ty_s_settings,
          ms_user_settings TYPE zif_abapgit_definitions=>ty_s_user_settings.

    METHODS:
      set_default_link_hint_key.

ENDCLASS.

CLASS zcl_abapgit_settings IMPLEMENTATION.

  METHOD get_activate_wo_popup.
    rv_act_wo_popup = ms_user_settings-activate_wo_popup.
  ENDMETHOD.

  METHOD get_adt_jump_enabled.
    rv_adt_jump_enabled = ms_user_settings-adt_jump_enabled.
  ENDMETHOD.

  METHOD get_commitmsg_body_size.
    rv_length = ms_settings-commitmsg_body_size.
  ENDMETHOD.

  METHOD get_commitmsg_comment_default.
    rv_default = ms_settings-commitmsg_comment_deflt.
  ENDMETHOD.

  METHOD get_commitmsg_comment_length.
    rv_length = ms_settings-commitmsg_comment_length.
  ENDMETHOD.

  METHOD get_commitmsg_hide_author.
    rv_hide_author = ms_settings-commitmsg_hide_author.
  ENDMETHOD.

  METHOD get_experimental_features.
    rv_run = ms_settings-experimental_features.
  ENDMETHOD.

  METHOD get_icon_scaling.
    rv_scaling = ms_user_settings-icon_scaling.
  ENDMETHOD.

  METHOD get_link_hints_enabled.
    rv_link_hints_enabled = ms_user_settings-link_hints_enabled.
  ENDMETHOD.

  METHOD get_link_hint_key.
    rv_link_hint_key = ms_user_settings-link_hint_key.
  ENDMETHOD.

  METHOD get_max_lines.
    rv_lines = ms_user_settings-max_lines.
  ENDMETHOD.

  METHOD get_parallel_proc_disabled.
    rv_disable_parallel_proc = ms_user_settings-parallel_proc_disabled.
  ENDMETHOD.

  METHOD get_proxy_authentication.
    rv_auth = ms_settings-proxy_auth.
  ENDMETHOD.

  METHOD get_proxy_bypass.
    rt_bypass = ms_settings-proxy_bypass.
  ENDMETHOD.

  METHOD get_proxy_port.
    rv_port = ms_settings-proxy_port.
  ENDMETHOD.

  METHOD get_proxy_url.
    rv_proxy_url = ms_settings-proxy_url.
  ENDMETHOD.

  METHOD get_run_critical_tests.
    rv_run = ms_settings-run_critical_tests.
  ENDMETHOD.

  METHOD get_settings_xml.

    DATA: li_output TYPE REF TO zif_abapgit_xml_output.

    CREATE OBJECT li_output TYPE zcl_abapgit_xml_output.

    li_output->add( iv_name = zcl_abapgit_persistence_db=>c_type_settings
                    ig_data = ms_settings ).

    rv_settings_xml = li_output->render( ).

  ENDMETHOD.

  METHOD get_show_default_repo.
    rv_show_default_repo = ms_user_settings-show_default_repo.
  ENDMETHOD.

  METHOD get_ui_theme.
    DATA: lv_frontend_theme TYPE string.

    rv_ui_theme = ms_user_settings-ui_theme.

    IF rv_ui_theme = c_ui_theme-synced_with_gui AND iv_resolve_synced = abap_true.
      TRY.
          CALL METHOD ('CL_GUI_RESOURCES')=>get_themename
            IMPORTING
              themename              = lv_frontend_theme
            EXCEPTIONS
              get_std_resource_error = 1
              OTHERS                 = 2.
          IF sy-subrc <> 0.
            rv_ui_theme = c_ui_theme-default.
            RETURN.
          ENDIF.
        CATCH cx_sy_dyn_call_error.
          rv_ui_theme = c_ui_theme-default.
          RETURN.
      ENDTRY.

      CASE lv_frontend_theme.
        WHEN 'Belize'.
          rv_ui_theme = c_ui_theme-belize.
        WHEN OTHERS.
          rv_ui_theme = c_ui_theme-default.
      ENDCASE.
    ENDIF.
  ENDMETHOD.

  METHOD get_user_settings.
    rs_settings = ms_user_settings.
  ENDMETHOD.

  METHOD set_activate_wo_popup.
    ms_user_settings-activate_wo_popup = iv_act_wo_popup.
  ENDMETHOD.

  METHOD set_adt_jump_enanbled.
    ms_user_settings-adt_jump_enabled = iv_adt_jump_enabled.
  ENDMETHOD.

  METHOD set_commitmsg_body_size.
    ms_settings-commitmsg_body_size = iv_length.
  ENDMETHOD.

  METHOD set_commitmsg_comment_default.
    ms_settings-commitmsg_comment_deflt = iv_default.
  ENDMETHOD.

  METHOD set_commitmsg_comment_length.
    ms_settings-commitmsg_comment_length = iv_length.
  ENDMETHOD.

  METHOD set_commitmsg_hide_author.
    ms_settings-commitmsg_hide_author = iv_hide_author.
  ENDMETHOD.

  METHOD set_defaults.

    CLEAR ms_settings.

    set_proxy_authentication( abap_false ).
    set_run_critical_tests( abap_false ).
    set_experimental_features( abap_false ).
    set_max_lines( 500 ).
    set_adt_jump_enanbled( abap_true ).
    set_show_default_repo( abap_false ).
    set_commitmsg_comment_length( c_commitmsg_comment_length_dft ).
    set_commitmsg_body_size( c_commitmsg_body_size_dft ).
    set_default_link_hint_key( ).
    set_icon_scaling( '' ).

  ENDMETHOD.

  METHOD set_default_link_hint_key.
    set_link_hint_key( |f| ).
  ENDMETHOD.

  METHOD set_experimental_features.
    ms_settings-experimental_features = iv_run.
  ENDMETHOD.

  METHOD set_icon_scaling.
    ms_user_settings-icon_scaling = iv_scaling.
    IF ms_user_settings-icon_scaling NA c_icon_scaling.
      ms_user_settings-icon_scaling = ''. " Reset to default
    ENDIF.
  ENDMETHOD.

  METHOD set_link_hints_enabled.
    ms_user_settings-link_hints_enabled = iv_link_hints_enabled.
  ENDMETHOD.

  METHOD set_link_hint_key.
    ms_user_settings-link_hint_key = iv_link_hint_key.
  ENDMETHOD.

  METHOD set_max_lines.
    ms_user_settings-max_lines = iv_lines.
  ENDMETHOD.

  METHOD set_parallel_proc_disabled.
    ms_user_settings-parallel_proc_disabled = iv_disable_parallel_proc.
  ENDMETHOD.

  METHOD set_proxy_authentication.
    ms_settings-proxy_auth = iv_auth.
  ENDMETHOD.

  METHOD set_proxy_bypass.
    ms_settings-proxy_bypass = it_bypass.
  ENDMETHOD.

  METHOD set_proxy_port.
    ms_settings-proxy_port = iv_port.
  ENDMETHOD.

  METHOD set_proxy_url.
    ms_settings-proxy_url = iv_url.
  ENDMETHOD.

  METHOD set_run_critical_tests.
    ms_settings-run_critical_tests = iv_run.
  ENDMETHOD.

  METHOD set_show_default_repo.
    ms_user_settings-show_default_repo = iv_show_default_repo.
  ENDMETHOD.

  METHOD set_ui_theme.
    ms_user_settings-ui_theme = iv_ui_theme.
    IF ms_user_settings-ui_theme <> c_ui_theme-default
        AND ms_user_settings-ui_theme <> c_ui_theme-dark
        AND ms_user_settings-ui_theme <> c_ui_theme-belize
        AND ms_user_settings-ui_theme <> c_ui_theme-synced_with_gui.
      ms_user_settings-ui_theme = c_ui_theme-default. " Reset to default
    ENDIF.
  ENDMETHOD.

  METHOD set_user_settings.
    ms_user_settings = is_user_settings.

    IF ms_user_settings-link_hint_key IS INITIAL.
      set_default_link_hint_key( ).
    ENDIF.

  ENDMETHOD.

  METHOD set_xml_settings.

    DATA: lo_input TYPE REF TO zif_abapgit_xml_input.

    CREATE OBJECT lo_input TYPE zcl_abapgit_xml_input EXPORTING iv_xml = iv_settings_xml.

    CLEAR ms_settings.

    lo_input->read(
      EXPORTING
        iv_name = zcl_abapgit_persistence_db=>c_type_settings
      CHANGING
        cg_data = ms_settings ).

  ENDMETHOD.
ENDCLASS.

CLASS zcl_abapgit_settings DEFINITION
  PUBLIC
  CREATE PUBLIC .

  PUBLIC SECTION.

    CONSTANTS c_commitmsg_comment_length_dft TYPE i VALUE 50 ##NO_TEXT.
    CONSTANTS c_commitmsg_body_size_dft TYPE i VALUE 72 ##NO_TEXT.
    CONSTANTS:
      BEGIN OF c_icon_scaling,
        large TYPE c VALUE 'L',
        small TYPE c VALUE 'S',
      END OF c_icon_scaling .
    CONSTANTS:
      BEGIN OF c_ui_theme,
        default         TYPE string VALUE 'default',
        dark            TYPE string VALUE 'dark',
        belize          TYPE string VALUE 'belize',
        synced_with_gui TYPE string VALUE 'synced_with_gui',
      END OF c_ui_theme .

    METHODS set_proxy_url
      IMPORTING
        !iv_url TYPE string .
    METHODS set_proxy_port
      IMPORTING
        !iv_port TYPE string .
    METHODS set_proxy_authentication
      IMPORTING
        !iv_auth TYPE abap_bool .
    METHODS set_proxy_bypass
      IMPORTING
        !it_bypass TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url OPTIONAL .
    METHODS get_proxy_url
      RETURNING
        VALUE(rv_proxy_url) TYPE string .
    METHODS get_proxy_port
      RETURNING
        VALUE(rv_port) TYPE string .
    METHODS get_proxy_authentication
      RETURNING
        VALUE(rv_auth) TYPE abap_bool .
    METHODS get_proxy_bypass
      RETURNING
        VALUE(rt_bypass) TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url .
    METHODS set_run_critical_tests
      IMPORTING
        !iv_run TYPE abap_bool .
    METHODS get_run_critical_tests
      RETURNING
        VALUE(rv_run) TYPE abap_bool .
    METHODS set_experimental_features
      IMPORTING
        !iv_run TYPE abap_bool .
    METHODS get_experimental_features
      RETURNING
        VALUE(rv_run) TYPE abap_bool .
    METHODS set_max_lines
      IMPORTING
        !iv_lines TYPE i .
    METHODS get_max_lines
      RETURNING
        VALUE(rv_lines) TYPE i .
    METHODS set_adt_jump_enanbled
      IMPORTING
        !iv_adt_jump_enabled TYPE abap_bool .
    METHODS get_adt_jump_enabled
      RETURNING
        VALUE(rv_adt_jump_enabled) TYPE abap_bool .
    METHODS set_commitmsg_comment_length
      IMPORTING
        !iv_length TYPE i .
    METHODS get_commitmsg_comment_length
      RETURNING
        VALUE(rv_length) TYPE i .
    METHODS set_commitmsg_comment_default
      IMPORTING
        !iv_default TYPE string .
    METHODS get_commitmsg_comment_default
      RETURNING
        VALUE(rv_default) TYPE string .
    METHODS set_commitmsg_body_size
      IMPORTING
        !iv_length TYPE i .
    METHODS get_commitmsg_body_size
      RETURNING
        VALUE(rv_length) TYPE i .
    METHODS set_commitmsg_hide_author
      IMPORTING
        !iv_hide_author TYPE abap_bool.
    METHODS get_commitmsg_hide_author
      RETURNING
        VALUE(rv_hide_author) TYPE abap_bool.
    METHODS get_settings_xml
      RETURNING
        VALUE(rv_settings_xml) TYPE string
      RAISING
        zcx_abapgit_exception .
    METHODS get_user_settings
      RETURNING
        VALUE(rs_settings) TYPE zif_abapgit_definitions=>ty_s_user_settings
      RAISING
        zcx_abapgit_exception .
    METHODS set_xml_settings
      IMPORTING
        !iv_settings_xml TYPE string
      RAISING
        zcx_abapgit_exception .
    METHODS set_defaults .
    METHODS set_user_settings
      IMPORTING
        !is_user_settings TYPE zif_abapgit_definitions=>ty_s_user_settings .
    METHODS get_show_default_repo
      RETURNING
        VALUE(rv_show_default_repo) TYPE abap_bool .
    METHODS set_show_default_repo
      IMPORTING
        !iv_show_default_repo TYPE abap_bool .
    METHODS set_link_hints_enabled
      IMPORTING
        !iv_link_hints_enabled TYPE abap_bool .
    METHODS get_link_hints_enabled
      RETURNING
        VALUE(rv_link_hints_enabled) TYPE abap_bool
      RAISING
        zcx_abapgit_exception .
    METHODS set_link_hint_key
      IMPORTING
        !iv_link_hint_key TYPE string .
    METHODS get_link_hint_key
      RETURNING
        VALUE(rv_link_hint_key) TYPE string .
    METHODS set_parallel_proc_disabled
      IMPORTING
        !iv_disable_parallel_proc TYPE abap_bool .
    METHODS get_parallel_proc_disabled
      RETURNING
        VALUE(rv_disable_parallel_proc) TYPE abap_bool .
    METHODS get_icon_scaling
      RETURNING
        VALUE(rv_scaling) TYPE zif_abapgit_definitions=>ty_s_user_settings-icon_scaling .
    METHODS set_icon_scaling
      IMPORTING
        !iv_scaling TYPE zif_abapgit_definitions=>ty_s_user_settings-icon_scaling .
    METHODS get_ui_theme
      IMPORTING
        !iv_resolve_synced TYPE abap_bool DEFAULT abap_true
      RETURNING
        VALUE(rv_ui_theme) TYPE zif_abapgit_definitions=>ty_s_user_settings-ui_theme .
    METHODS set_ui_theme
      IMPORTING
        !iv_ui_theme TYPE zif_abapgit_definitions=>ty_s_user_settings-ui_theme .
    METHODS get_activate_wo_popup
      RETURNING
        VALUE(rv_act_wo_popup) TYPE zif_abapgit_definitions=>ty_s_user_settings-activate_wo_popup .
    METHODS set_activate_wo_popup
      IMPORTING
        !iv_act_wo_popup TYPE zif_abapgit_definitions=>ty_s_user_settings-activate_wo_popup .
  PROTECTED SECTION.
  PRIVATE SECTION.
    TYPES: BEGIN OF ty_s_settings,
             proxy_url                TYPE string,
             proxy_port               TYPE string,
             proxy_auth               TYPE string,
             proxy_bypass             TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url,
             run_critical_tests       TYPE abap_bool,
             experimental_features    TYPE abap_bool,
             commitmsg_comment_length TYPE i,
             commitmsg_comment_deflt  TYPE string,
             commitmsg_body_size      TYPE i,
             commitmsg_hide_author    TYPE abap_bool,
           END OF ty_s_settings.

    DATA: ms_settings      TYPE ty_s_settings,
          ms_user_settings TYPE zif_abapgit_definitions=>ty_s_user_settings.

    METHODS:
      set_default_link_hint_key.

ENDCLASS.

CLASS zcl_abapgit_settings IMPLEMENTATION.

  METHOD get_activate_wo_popup.
    rv_act_wo_popup = ms_user_settings-activate_wo_popup.
  ENDMETHOD.

  METHOD get_adt_jump_enabled.
    rv_adt_jump_enabled = ms_user_settings-adt_jump_enabled.
  ENDMETHOD.

  METHOD get_commitmsg_body_size.
    rv_length = ms_settings-commitmsg_body_size.
  ENDMETHOD.

  METHOD get_commitmsg_comment_default.
    rv_default = ms_settings-commitmsg_comment_deflt.
  ENDMETHOD.

  METHOD get_commitmsg_comment_length.
    rv_length = ms_settings-commitmsg_comment_length.
  ENDMETHOD.

  METHOD get_commitmsg_hide_author.
    rv_hide_author = ms_settings-commitmsg_hide_author.
  ENDMETHOD.

  METHOD get_experimental_features.
    IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_false.
      rv_run = ms_settings-experimental_features.
    ENDIF.
  ENDMETHOD.

  METHOD get_icon_scaling.
    rv_scaling = ms_user_settings-icon_scaling.
  ENDMETHOD.

  METHOD get_link_hints_enabled.
    rv_link_hints_enabled = ms_user_settings-link_hints_enabled.
  ENDMETHOD.

  METHOD get_link_hint_key.
    rv_link_hint_key = ms_user_settings-link_hint_key.
  ENDMETHOD.

  METHOD get_max_lines.
    rv_lines = ms_user_settings-max_lines.
  ENDMETHOD.

  METHOD get_parallel_proc_disabled.
    rv_disable_parallel_proc = ms_user_settings-parallel_proc_disabled.
  ENDMETHOD.

  METHOD get_proxy_authentication.
    rv_auth = ms_settings-proxy_auth.
  ENDMETHOD.

  METHOD get_proxy_bypass.
    rt_bypass = ms_settings-proxy_bypass.
  ENDMETHOD.

  METHOD get_proxy_port.
    rv_port = ms_settings-proxy_port.
  ENDMETHOD.

  METHOD get_proxy_url.
    rv_proxy_url = ms_settings-proxy_url.
  ENDMETHOD.

  METHOD get_run_critical_tests.
    IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_false.
      rv_run = ms_settings-run_critical_tests.
    ENDIF.
  ENDMETHOD.

  METHOD get_settings_xml.

    DATA: li_output TYPE REF TO zif_abapgit_xml_output.

    CREATE OBJECT li_output TYPE zcl_abapgit_xml_output.

    li_output->add( iv_name = zcl_abapgit_persistence_db=>c_type_settings
                    ig_data = ms_settings ).

    rv_settings_xml = li_output->render( ).

  ENDMETHOD.

  METHOD get_show_default_repo.
    rv_show_default_repo = ms_user_settings-show_default_repo.
  ENDMETHOD.

  METHOD get_ui_theme.
    DATA: lv_frontend_theme TYPE string.

    rv_ui_theme = ms_user_settings-ui_theme.

    IF rv_ui_theme = c_ui_theme-synced_with_gui AND iv_resolve_synced = abap_true.
      TRY.
          CALL METHOD ('CL_GUI_RESOURCES')=>get_themename
            IMPORTING
              themename              = lv_frontend_theme
            EXCEPTIONS
              get_std_resource_error = 1
              OTHERS                 = 2.
          IF sy-subrc <> 0.
            rv_ui_theme = c_ui_theme-default.
            RETURN.
          ENDIF.
        CATCH cx_sy_dyn_call_error.
          rv_ui_theme = c_ui_theme-default.
          RETURN.
      ENDTRY.

      CASE lv_frontend_theme.
        WHEN 'Belize'.
          rv_ui_theme = c_ui_theme-belize.
        WHEN OTHERS.
          rv_ui_theme = c_ui_theme-default.
      ENDCASE.
    ENDIF.
  ENDMETHOD.

  METHOD get_user_settings.
    rs_settings = ms_user_settings.
  ENDMETHOD.

  METHOD set_activate_wo_popup.
    ms_user_settings-activate_wo_popup = iv_act_wo_popup.
  ENDMETHOD.

  METHOD set_adt_jump_enanbled.
    ms_user_settings-adt_jump_enabled = iv_adt_jump_enabled.
  ENDMETHOD.

  METHOD set_commitmsg_body_size.
    ms_settings-commitmsg_body_size = iv_length.
  ENDMETHOD.

  METHOD set_commitmsg_comment_default.
    ms_settings-commitmsg_comment_deflt = iv_default.
  ENDMETHOD.

  METHOD set_commitmsg_comment_length.
    ms_settings-commitmsg_comment_length = iv_length.
  ENDMETHOD.

  METHOD set_commitmsg_hide_author.
    ms_settings-commitmsg_hide_author = iv_hide_author.
  ENDMETHOD.

  METHOD set_defaults.

    CLEAR ms_settings.

    set_proxy_authentication( abap_false ).
    set_run_critical_tests( abap_false ).
    set_experimental_features( abap_false ).
    set_max_lines( 500 ).
    set_adt_jump_enanbled( abap_true ).
    set_show_default_repo( abap_false ).
    set_commitmsg_comment_length( c_commitmsg_comment_length_dft ).
    set_commitmsg_body_size( c_commitmsg_body_size_dft ).
    set_default_link_hint_key( ).
    set_icon_scaling( '' ).

  ENDMETHOD.

  METHOD set_default_link_hint_key.
    set_link_hint_key( |f| ).
  ENDMETHOD.

  METHOD set_experimental_features.
    ms_settings-experimental_features = iv_run.
  ENDMETHOD.

  METHOD set_icon_scaling.
    ms_user_settings-icon_scaling = iv_scaling.
    IF ms_user_settings-icon_scaling NA c_icon_scaling.
      ms_user_settings-icon_scaling = ''. " Reset to default
    ENDIF.
  ENDMETHOD.

  METHOD set_link_hints_enabled.
    ms_user_settings-link_hints_enabled = iv_link_hints_enabled.
  ENDMETHOD.

  METHOD set_link_hint_key.
    ms_user_settings-link_hint_key = iv_link_hint_key.
  ENDMETHOD.

  METHOD set_max_lines.
    ms_user_settings-max_lines = iv_lines.
  ENDMETHOD.

  METHOD set_parallel_proc_disabled.
    ms_user_settings-parallel_proc_disabled = iv_disable_parallel_proc.
  ENDMETHOD.

  METHOD set_proxy_authentication.
    ms_settings-proxy_auth = iv_auth.
  ENDMETHOD.

  METHOD set_proxy_bypass.
    ms_settings-proxy_bypass = it_bypass.
  ENDMETHOD.

  METHOD set_proxy_port.
    ms_settings-proxy_port = iv_port.
  ENDMETHOD.

  METHOD set_proxy_url.
    ms_settings-proxy_url = iv_url.
  ENDMETHOD.

  METHOD set_run_critical_tests.
    ms_settings-run_critical_tests = iv_run.
  ENDMETHOD.

  METHOD set_show_default_repo.
    ms_user_settings-show_default_repo = iv_show_default_repo.
  ENDMETHOD.

  METHOD set_ui_theme.
    ms_user_settings-ui_theme = iv_ui_theme.
    IF ms_user_settings-ui_theme <> c_ui_theme-default
        AND ms_user_settings-ui_theme <> c_ui_theme-dark
        AND ms_user_settings-ui_theme <> c_ui_theme-belize
        AND ms_user_settings-ui_theme <> c_ui_theme-synced_with_gui.
      ms_user_settings-ui_theme = c_ui_theme-default. " Reset to default
    ENDIF.
  ENDMETHOD.

  METHOD set_user_settings.
    ms_user_settings = is_user_settings.

    IF ms_user_settings-link_hint_key IS INITIAL.
      set_default_link_hint_key( ).
    ENDIF.

  ENDMETHOD.

  METHOD set_xml_settings.

    DATA: lo_input TYPE REF TO zif_abapgit_xml_input.

    CREATE OBJECT lo_input TYPE zcl_abapgit_xml_input EXPORTING iv_xml = iv_settings_xml.

    CLEAR ms_settings.

    lo_input->read(
      EXPORTING
        iv_name = zcl_abapgit_persistence_db=>c_type_settings
      CHANGING
        cg_data = ms_settings ).

  ENDMETHOD.
ENDCLASS.

Disable "experimental" feature for stand-alone version (#5828)

Closes #5827