anchor.diff:        RETURNING VALUE(ri_page) TYPE REF TO lif_gui_page
         RAISING   lcx_exception.
   
  +    METHODS get_page_diff
  +      IMPORTING iv_getdata     TYPE clike
  +      RETURNING VALUE(ri_page) TYPE REF TO lif_gui_page
  +      RAISING   lcx_exception.
  +
  +    METHODS get_page_stage
  +      IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
  +      RETURNING VALUE(ri_page) TYPE REF TO lif_gui_page
  +      RAISING   lcx_exception.
  +
       METHODS abapgit_installation
         RAISING lcx_exception.
   
       METHODS repo_clone
         IMPORTING iv_url TYPE string
  +      RAISING   lcx_exception.
  +
  +    METHODS repo_purge
  +      IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
  +      RAISING   lcx_exception.
  +
  +    METHODS repo_remove
  +      IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
  +      RAISING   lcx_exception.
  +
  +    METHODS repo_new_offline
  +      RAISING lcx_exception.
  +
  +    METHODS repo_package_zip
  +      RAISING lcx_exception.
  +
  +    METHODS repo_pull
  +      IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
         RAISING   lcx_exception.
   
   ENDCLASS.
  
positive.code: 
  CLASS lcl_gui_page_main IMPLEMENTATION.
  
    METHOD diff.
  
      DATA: lt_remote TYPE ty_files_tt,
            lt_local  TYPE ty_files_item_tt,
            lo_page   TYPE REF TO lcl_gui_page_diff,
            lo_repo   TYPE REF TO lcl_repo_online.
  
      FIELD-SYMBOLS: <ls_remote> LIKE LINE OF lt_remote,
                     <ls_local>  LIKE LINE OF lt_local.
  
  
      lo_repo  ?= lcl_repo_srv=>get( iv_key ).
      lt_remote = lo_repo->get_files_remote( ).
      lt_local  = lo_repo->get_files_local( ).
  
      READ TABLE lt_remote ASSIGNING <ls_remote>
        WITH KEY filename = is_file-filename
                 path     = is_file-path.
      IF sy-subrc <> 0.
        _raise 'file not found remotely'.
      ENDIF.
  
      READ TABLE lt_local ASSIGNING <ls_local>
        WITH KEY file-filename = is_file-filename
                 file-path     = is_file-path.
      IF sy-subrc <> 0.
        _raise 'file not found locally'.
      ENDIF.
  
      CREATE OBJECT lo_page
        EXPORTING
          is_local  = <ls_local>-file
          is_remote = <ls_remote>.
  
      lcl_gui=>get( )->call_page( lo_page ).
  
    ENDMETHOD.                    "diff
  
    METHOD pull.
  
      DATA: lo_repo TYPE REF TO lcl_repo_online.
  
  
      lo_repo ?= lcl_repo_srv=>get( iv_key ).
  
      lo_repo->refresh( ).
  
      lo_repo->deserialize( ).
  
      COMMIT WORK.
  
    ENDMETHOD.                    "pull
  
    METHOD stage.
  
      DATA: lo_repo  TYPE REF TO lcl_repo_online,
            lo_stage TYPE REF TO lcl_gui_page_stage.
  
  
      lo_repo ?= lcl_repo_srv=>get( iv_key ).
  
  * force refresh on stage, to make sure the latest local and remote files are used
      lo_repo->refresh( ).
  
      CREATE OBJECT lo_stage
        EXPORTING
          io_repo = lo_repo.
  
      lcl_gui=>get( )->call_page( lo_stage ).
  
    ENDMETHOD.
  
    METHOD render_obj_jump_link.
  
      DATA: lv_encode TYPE string.
  
negative.code: 
    ENDMETHOD.                    "repo_clone
  
    METHOD repo_purge.
  
      DATA: lt_tadir    TYPE lcl_tadir=>ty_tadir_tt,
            lv_count    TYPE c LENGTH 3,
            lv_answer   TYPE c LENGTH 1,
            lo_repo     TYPE REF TO lcl_repo,
            lv_package  TYPE devclass,
            lv_question TYPE c LENGTH 100.
  
  
      lo_repo = lcl_repo_srv=>get( iv_key ).
      lv_package = lo_repo->get_package( ).
  
      lt_tadir = lcl_tadir=>read( lv_package ).
  
      IF lines( lt_tadir ) > 0.
        lv_count = lines( lt_tadir ).
  
        CONCATENATE 'This will delete all objects in package' lv_package
          INTO lv_question
          SEPARATED BY space.                                 "#EC NOTEXT
  
        CONCATENATE lv_question '(' lv_count 'objects)'
          INTO lv_question
          SEPARATED BY space.                                 "#EC NOTEXT
  
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            titlebar              = 'Uninstall'
            text_question         = lv_question
            text_button_1         = 'Delete'
            icon_button_1         = 'ICON_DELETE'
            text_button_2         = 'Cancel'
            icon_button_2         = 'ICON_CANCEL'
            default_button        = '2'
            display_cancel_button = abap_false
          IMPORTING
            answer                = lv_answer
          EXCEPTIONS
            text_not_found        = 1
            OTHERS                = 2.                        "#EC NOTEXT
        IF sy-subrc <> 0.
          _raise 'error from POPUP_TO_CONFIRM'.
        ENDIF.
  
        IF lv_answer = '2'.
          RETURN.
        ENDIF.
  
        lcl_objects=>delete( lt_tadir ).
  
      ENDIF.
  
      lcl_repo_srv=>delete( lo_repo ).
  
      COMMIT WORK.
  
    ENDMETHOD.                    "repo_purge
  
    METHOD repo_remove.
  
      DATA: lv_answer   TYPE c LENGTH 1,
            lo_repo     TYPE REF TO lcl_repo,
            lv_package  TYPE devclass,
            lv_question TYPE c LENGTH 100.
  
  
      lo_repo = lcl_repo_srv=>get( iv_key ).
      lv_package = lo_repo->get_package( ).
  
      CONCATENATE 'This will remove the repository reference to the package'
        lv_package
        INTO lv_question
        SEPARATED BY space.                                   "#EC NOTEXT
  
      CALL FUNCTION 'POPUP_TO_CONFIRM'
        EXPORTING
          titlebar              = 'Remove'
          text_question         = lv_question
          text_button_1         = 'Remove'
          icon_button_1         = 'ICON_WF_UNLINK'
          text_button_2         = 'Cancel'
          icon_button_2         = 'ICON_CANCEL'
          default_button        = '2'
          display_cancel_button = abap_false
        IMPORTING
          answer                = lv_answer
        EXCEPTIONS
          text_not_found        = 1
          OTHERS                = 2.                          "#EC NOTEXT
      IF sy-subrc <> 0.
        _raise 'error from POPUP_TO_CONFIRM'.
      ENDIF.
  
      IF lv_answer = '2'.
        RETURN.
      ENDIF.
  
      lcl_repo_srv=>delete( lo_repo ).
  
      COMMIT WORK.
  
    ENDMETHOD.                    "repo_remove
  
    METHOD repo_new_offline.
  
      DATA: lv_returncode TYPE c,
            lv_url        TYPE string,
            lv_package    TYPE devclass,
            lt_fields     TYPE TABLE OF sval.
  
      FIELD-SYMBOLS: <ls_field> LIKE LINE OF lt_fields.
  
      "               TAB           FLD       LABEL     DEF                 ATTR
      _add_dialog_fld 'ABAPTXT255' 'LINE'     'Name'    ''                  ''.
      _add_dialog_fld 'TDEVC'      'DEVCLASS' 'Package' ''                  ''.
  
      CALL FUNCTION 'POPUP_GET_VALUES'
        EXPORTING
          no_value_check  = abap_true
          popup_title     = 'New Offline Project'             "#EC NOTEXT
        IMPORTING
          returncode      = lv_returncode
        TABLES
          fields          = lt_fields
        EXCEPTIONS
          error_in_fields = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        _raise 'Error from POPUP_GET_VALUES'.
      ENDIF.
      IF lv_returncode = 'A'.
        RETURN.
      ENDIF.
  
      READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
      ASSERT sy-subrc = 0.
      lv_url = <ls_field>-value.
  
      READ TABLE lt_fields INDEX 2 ASSIGNING <ls_field>.
      ASSERT sy-subrc = 0.
      lv_package = <ls_field>-value.
      TRANSLATE lv_package TO UPPER CASE.
  
      lcl_repo_srv=>new_offline(
        iv_url     = lv_url
        iv_package = lv_package ).
  
      COMMIT WORK.
  
    ENDMETHOD.                    "repo_new_offline
  
    METHOD repo_package_zip.
  
      DATA: lo_repo       TYPE REF TO lcl_repo_offline,
            ls_data       TYPE lcl_persistence_repo=>ty_repo,
            lv_returncode TYPE c,
            lv_url        TYPE string,
            lt_fields     TYPE TABLE OF sval.
  
      FIELD-SYMBOLS: <ls_field> LIKE LINE OF lt_fields.
  
      "               TAB           FLD       LABEL     DEF                 ATTR
      _add_dialog_fld 'TDEVC'      'DEVCLASS' 'Package' ''                  ''.
  
      CALL FUNCTION 'POPUP_GET_VALUES'
        EXPORTING
          no_value_check  = abap_true
          popup_title     = 'Export'             "#EC NOTEXT
        IMPORTING
          returncode      = lv_returncode
        TABLES
          fields          = lt_fields
        EXCEPTIONS
          error_in_fields = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        _raise 'Error from POPUP_GET_VALUES'.
      ENDIF.
      IF lv_returncode = 'A'.
        RETURN.
      ENDIF.
  
      READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
      ASSERT sy-subrc = 0.
      TRANSLATE <ls_field>-value TO UPPER CASE.
  
      ls_data-key             = 'DUMMY'.
      ls_data-package         = <ls_field>-value.
      ls_data-master_language = sy-langu.
  
      CREATE OBJECT lo_repo
        EXPORTING
          is_data = ls_data.
  
      lcl_zip=>export( lo_repo ).
  
    ENDMETHOD.                    "repo_package_zip
  
    METHOD repo_pull.
  
      DATA: lo_repo TYPE REF TO lcl_repo_online.
  
      lo_repo ?= lcl_repo_srv=>get( iv_key ).
      lo_repo->refresh( ).
      lo_repo->deserialize( ).
  
      COMMIT WORK.
  
    ENDMETHOD.                    "pull
  
    METHOD get_page_stage.
  
      DATA: lo_repo  TYPE REF TO lcl_repo_online,
            lo_stage TYPE REF TO lcl_gui_page_stage.
  
  
      lo_repo ?= lcl_repo_srv=>get( iv_key ).
  
      " force refresh on stage, to make sure the latest local and remote files are used
      lo_repo->refresh( ).
  
      CREATE OBJECT lo_stage
        EXPORTING
          io_repo = lo_repo.
  
      ri_page = lo_stage.
  
    ENDMETHOD.
  
  
  ENDCLASS.           " lcl_gui_router
  