anchor.diff:  ENDCLASS.                    "lcl_convert IMPLEMENTATION
   
   *----------------------------------------------------------------------*
  -*       CLASS lcl_serialize DEFINITION
  +*       INTERFACE lif_serialize IMPLEMENTATION
   *----------------------------------------------------------------------*
   *
   *----------------------------------------------------------------------*
  -CLASS lcl_serialize DEFINITION FINAL.
  +INTERFACE lif_serialize.
  +
  +  CLASS-METHODS: serialize IMPORTING iv_obj_name TYPE tadir-obj_name
  +                           RETURNING value(rt_files) TYPE tt_files
  +                           RAISING lcx_exception.
  +
  +  CLASS-METHODS: deserialize IMPORTING iv_obj_name TYPE tadir-obj_name
  +                                       it_files TYPE tt_files
  +                             RAISING lcx_exception.
  +
  +  CLASS-METHODS: exists IMPORTING iv_obj_name TYPE tadir-obj_name
  +                        RETURNING value(rv_exists) TYPE abap_bool
  +                        RAISING lcx_exception.
  +
  +ENDINTERFACE.                    "lif_serialize IMPLEMENTATION
  +
  +*----------------------------------------------------------------------*
  +*       CLASS lcl_serialize_prog DEFINITION
  +*----------------------------------------------------------------------*
  +*
  +*----------------------------------------------------------------------*
  +CLASS lcl_serialize_prog DEFINITION FINAL.
   
     PUBLIC SECTION.
  -    CLASS-METHODS serialize IMPORTING iv_obj_type TYPE tadir-object
  -                                      iv_obj_name TYPE tadir-obj_name
  -                            RETURNING value(rt_files) TYPE tt_files
  -                            RAISING lcx_exception.
  -
  -    CLASS-METHODS status    IMPORTING it_files TYPE tt_files
  -                            RETURNING value(rt_results) TYPE tt_results
  -                            RAISING lcx_exception.
  -
  -    CLASS-METHODS deserialize IMPORTING it_files TYPE tt_files
  -                            RAISING lcx_exception.
  +    INTERFACES lif_serialize.
  +
  +    ALIASES: serialize FOR lif_serialize~serialize,
  +             deserialize FOR lif_serialize~deserialize,
  +             exists FOR lif_serialize~exists.
   
     PRIVATE SECTION.
  -    CLASS-METHODS prog_serialize
  -                            IMPORTING iv_obj_name TYPE tadir-obj_name
  -                            RETURNING value(rt_files) TYPE tt_files
  -                            RAISING lcx_exception.
  -
  -    CLASS-METHODS prog_deserialize
  -                            IMPORTING it_files TYPE tt_files
  -                                      iv_obj_name TYPE tadir-obj_name
  -                            RAISING lcx_exception.
  -
  -    CLASS-METHODS prog_exists
  -                            IMPORTING iv_obj_name TYPE tadir-obj_name
  -                            RETURNING value(rv_bool) TYPE abap_bool.
  -
  -    CLASS-METHODS compare_files
  -                            IMPORTING it_repo TYPE tt_files
  -                                      it_sap TYPE tt_files
  -                            RETURNING value(rv_match) TYPE abap_bool
  -                            RAISING lcx_exception.
  -
  -ENDCLASS.                    "lcl_serialize DEFINITION
  -
  -*----------------------------------------------------------------------*
  -*       CLASS lcl_serialize IMPLEMENTATION
  +    CLASS-METHODS: serialize_dynpros IMPORTING iv_program_name TYPE programm
  +                                               io_xml TYPE REF TO lcl_xml
  +                                     RAISING lcx_exception.
  +
  +    CLASS-METHODS: serialize_includes IMPORTING iv_program_name TYPE programm
  +                                                io_xml TYPE REF TO lcl_xml
  +                                      CHANGING ct_files TYPE tt_files
  +                                      RAISING lcx_exception.
  +
  +ENDCLASS.                    "lcl_serialize_prog DEFINITION
  +
  +*----------------------------------------------------------------------*
  +*       CLASS lcl_serialize_prog IMPLEMENTATION
   *----------------------------------------------------------------------*
   *
   *----------------------------------------------------------------------*
  -CLASS lcl_serialize IMPLEMENTATION.
  -
  -  METHOD prog_exists.
  -
  -    DATA: lv_progname TYPE reposrc-progname.
  -
  -
  -    SELECT SINGLE progname FROM reposrc INTO lv_progname
  -      WHERE progname = iv_obj_name.                         "#EC WARNOK
  -    IF sy-subrc = 0.
  -      rv_bool = abap_true.
  -    ELSE.
  -      rv_bool = abap_false.
  -    ENDIF.
  -
  -  ENDMETHOD.                    "prog_exists
  -
  -  METHOD serialize.
  -
  -    CASE iv_obj_type.
  -      WHEN 'PROG'.
  -        rt_files = prog_serialize( iv_obj_name ).
  -      WHEN OTHERS.
  -        _raise 'Serialize, unknown type'.
  -    ENDCASE.
  -
  -* todo, duplicates in rt_files? via includes?
  -
  -  ENDMETHOD.                    "serialize
  -
  -  METHOD status.
  -
  -    DATA: lv_pre    TYPE tadir-obj_name,
  -          lt_files  TYPE tt_files,
  -          ls_result LIKE LINE OF rt_results,
  -          lv_type   TYPE string,
  -          lv_ext    TYPE string.
  -
  -    FIELD-SYMBOLS: <ls_file> LIKE LINE OF it_files.
  -
  -
  -    LOOP AT it_files ASSIGNING <ls_file>.
  -      SPLIT <ls_file>-filename AT '.' INTO lv_pre lv_type lv_ext.
  -      TRANSLATE lv_pre TO UPPER CASE.
  -      TRANSLATE lv_type TO UPPER CASE.
  -
  -      IF lv_ext <> 'xml'.
  -        CONTINUE. " current loop
  -      ENDIF.
  -
  -      CLEAR ls_result.
  -      ls_result-obj_type = lv_type.
  -      ls_result-obj_name = lv_pre.
  -
  -      CASE lv_type.
  -        WHEN 'PROG'.
  -          IF prog_exists( lv_pre ) = abap_true.
  -            lt_files = prog_serialize( lv_pre ).
  -            ls_result-match = compare_files( it_repo = it_files it_sap = lt_files ).
  -          ENDIF.
  -        WHEN OTHERS.
  -          _raise 'status, unknown type'.
  -      ENDCASE.
  -
  -      APPEND ls_result TO rt_results.
  -    ENDLOOP.
  -
  -* todo, how to handle deleted in repo?
  -
  -  ENDMETHOD.                    "status
  -
  -  METHOD deserialize.
  -
  -    DATA: lv_pre   TYPE tadir-obj_name,
  -          lv_type  TYPE string,
  -          lv_ext   TYPE string.
  -
  -    FIELD-SYMBOLS: <ls_file> LIKE LINE OF it_files.
  -
  -
  -    LOOP AT it_files ASSIGNING <ls_file>.
  -      SPLIT <ls_file>-filename AT '.' INTO lv_pre lv_type lv_ext.
  -      TRANSLATE lv_pre TO UPPER CASE.
  -      TRANSLATE lv_type TO UPPER CASE.
  -
  -      IF lv_ext <> 'xml'.
  -        CONTINUE. " current loop
  -      ENDIF.
  -
  -      CASE lv_type.
  -        WHEN 'PROG'.
  -          prog_deserialize( it_files = it_files iv_obj_name = lv_pre ).
  -        WHEN OTHERS.
  -          _raise 'deserialize, unknown type'.
  -      ENDCASE.
  -    ENDLOOP.
  -
  -  ENDMETHOD.                    "deserialize
  -
  -  METHOD compare_files.
  -
  -    FIELD-SYMBOLS: <ls_sap> TYPE st_file.
  -
  -
  -    LOOP AT it_sap ASSIGNING <ls_sap>.
  -      READ TABLE it_repo WITH KEY path = <ls_sap>-path
  -                                  filename = <ls_sap>-filename
  -                                  data = <ls_sap>-data
  -        TRANSPORTING NO FIELDS.
  -      IF sy-subrc <> 0.
  -        rv_match = abap_false.
  -        RETURN.
  -      ENDIF.
  -    ENDLOOP.
  -
  -    rv_match = abap_true.
  -
  -  ENDMETHOD.                    "compare_files
  -
  -  METHOD prog_serialize.
  +CLASS lcl_serialize_prog IMPLEMENTATION.
  +
  +  METHOD lif_serialize~serialize.
   
       DATA: ls_progdir      TYPE progdir,
             lv_program_name TYPE programm,
             lv_xml          TYPE string,
             lt_source       TYPE TABLE OF abaptxt255,
             lv_source       TYPE string,
  -          lt_files        LIKE rt_files,
  -          lt_dynpros      TYPE TABLE OF d020s,
  -          lt_includes     TYPE programt,
             lt_textelements TYPE textpool_table,
             ls_file         LIKE LINE OF rt_files,
             lo_xml          TYPE REF TO lcl_xml.
   
  -    FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes,
  -                   <ls_dynpro>  LIKE LINE OF lt_dynpros.
  -
   
       lv_program_name = iv_obj_name.
   
       CALL FUNCTION 'RPY_PROGRAM_READ'
         EXPORTING
           program_name     = lv_program_name
  +        with_lowercase   = abap_true
         TABLES
           source_extended  = lt_source
           textelements     = lt_textelements
  
positive.code: 
  
      lo_descr ?= cl_abap_typedescr=>describe_by_data( ig_structure ).
      lv_name = lo_descr->get_relative_name( ).
      IF lv_name IS INITIAL.
        _raise 'no name'.
  
negative.code:                        RETURNING value(rv_branch) TYPE t_sha1
                         RAISING lcx_exception.
  
  * todo, new files can/should be handled by push, so add is obsolete?
      CLASS-METHODS add IMPORTING is_repo TYPE st_repo
                                  is_comment TYPE st_comment
                                  it_files TYPE tt_files
  