diff --git a/src/git/zcl_abapgit_git_porcelain.clas.abap b/src/git/zcl_abapgit_git_porcelain.clas.abap index 09e7bfe08..29f5f49fc 100644 --- a/src/git/zcl_abapgit_git_porcelain.clas.abap +++ b/src/git/zcl_abapgit_git_porcelain.clas.abap @@ -27,7 +27,7 @@ CLASS zcl_abapgit_git_porcelain DEFINITION IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo_online !iv_name TYPE string - !iv_from TYPE zif_abapgit_definitions=>ty_sha1 + iv_from TYPE zif_abapgit_definitions=>ty_sha1 RAISING zcx_abapgit_exception . CLASS-METHODS create_tag @@ -198,8 +198,6 @@ CLASS zcl_abapgit_git_porcelain IMPLEMENTATION. IF iv_name CS ` `. zcx_abapgit_exception=>raise( 'Branch name cannot contain blank spaces' ). - ELSEIF iv_from = ''. - zcx_abapgit_exception=>raise( 'New branch, "from" SHA1 empty' ). ENDIF. * "client MUST send an empty packfile" @@ -720,7 +718,7 @@ CLASS zcl_abapgit_git_porcelain IMPLEMENTATION. zcl_abapgit_git_transport=>receive_pack( iv_url = io_repo->get_url( ) iv_old = c_zero - iv_new = io_repo->get_sha1_local( ) + iv_new = is_tag-sha1 iv_branch_name = is_tag-name iv_pack = lv_pack ). diff --git a/src/persist/zcl_abapgit_persistence_repo.clas.abap b/src/persist/zcl_abapgit_persistence_repo.clas.abap index 337a6d7b2..3dc93b216 100644 --- a/src/persist/zcl_abapgit_persistence_repo.clas.abap +++ b/src/persist/zcl_abapgit_persistence_repo.clas.abap @@ -10,12 +10,6 @@ CLASS zcl_abapgit_persistence_repo DEFINITION VALUE(rt_repos) TYPE zif_abapgit_persistence=>tt_repo RAISING zcx_abapgit_exception . - METHODS update_sha1 - IMPORTING - !iv_key TYPE zif_abapgit_persistence=>ty_repo-key - !iv_branch_sha1 TYPE zif_abapgit_persistence=>ty_repo_xml-sha1 - RAISING - zcx_abapgit_exception . METHODS update_local_checksums IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key @@ -114,7 +108,7 @@ ENDCLASS. -CLASS ZCL_ABAPGIT_PERSISTENCE_REPO IMPLEMENTATION. +CLASS zcl_abapgit_persistence_repo IMPLEMENTATION. METHOD add. @@ -125,7 +119,6 @@ CLASS ZCL_ABAPGIT_PERSISTENCE_REPO IMPLEMENTATION. ls_repo-url = iv_url. ls_repo-branch_name = iv_branch_name. - ls_repo-sha1 = iv_branch. ls_repo-package = iv_package. ls_repo-offline = iv_offline. ls_repo-created_by = sy-uname. @@ -424,31 +417,6 @@ CLASS ZCL_ABAPGIT_PERSISTENCE_REPO IMPLEMENTATION. ENDMETHOD. "update_offline - METHOD update_sha1. - - DATA: lt_content TYPE zif_abapgit_persistence=>tt_content, - ls_content LIKE LINE OF lt_content, - ls_repo TYPE zif_abapgit_persistence=>ty_repo. - - - ASSERT NOT iv_key IS INITIAL. - - TRY. - ls_repo = read( iv_key ). - CATCH zcx_abapgit_not_found. - zcx_abapgit_exception=>raise( 'key not found' ). - ENDTRY. - - ls_repo-sha1 = iv_branch_sha1. - ls_content-data_str = to_xml( ls_repo ). - - mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo - iv_value = iv_key - iv_data = ls_content-data_str ). - - ENDMETHOD. - - METHOD update_url. DATA: lt_content TYPE zif_abapgit_persistence=>tt_content, diff --git a/src/persist/zif_abapgit_persistence.intf.abap b/src/persist/zif_abapgit_persistence.intf.abap index ab2e28739..dcba036e3 100644 --- a/src/persist/zif_abapgit_persistence.intf.abap +++ b/src/persist/zif_abapgit_persistence.intf.abap @@ -32,7 +32,6 @@ INTERFACE zif_abapgit_persistence PUBLIC. TYPES: BEGIN OF ty_repo_xml, url TYPE string, branch_name TYPE string, - sha1 TYPE zif_abapgit_definitions=>ty_sha1, package TYPE devclass, created_by TYPE xubname, created_at TYPE timestampl, diff --git a/src/ui/zcl_abapgit_gui_page_tag.clas.abap b/src/ui/zcl_abapgit_gui_page_tag.clas.abap index fe2648b6e..b2fa0ee19 100644 --- a/src/ui/zcl_abapgit_gui_page_tag.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_tag.clas.abap @@ -157,7 +157,7 @@ CLASS zcl_abapgit_gui_page_tag IMPLEMENTATION. ro_html->add( render_text_input( iv_name = 'sha1' iv_label = 'SHA1' - iv_value = mo_repo_online->get_sha1_local( ) ) ). + iv_value = mo_repo_online->get_sha1_remote( ) ) ). ro_html->add( render_text_input( iv_name = 'name' iv_label = 'tag name' ) ). diff --git a/src/ui/zcl_abapgit_services_git.clas.abap b/src/ui/zcl_abapgit_services_git.clas.abap index b290566c1..45d00d17b 100644 --- a/src/ui/zcl_abapgit_services_git.clas.abap +++ b/src/ui/zcl_abapgit_services_git.clas.abap @@ -145,7 +145,7 @@ CLASS zcl_abapgit_services_git IMPLEMENTATION. zcl_abapgit_git_porcelain=>create_branch( io_repo = lo_repo iv_name = lv_name - iv_from = lo_repo->get_sha1_local( ) ). + iv_from = lo_repo->get_sha1_remote( ) ). " automatically switch to new branch lo_repo->set_branch_name( lv_name ). diff --git a/src/zcl_abapgit_repo.clas.abap b/src/zcl_abapgit_repo.clas.abap index 2230ffd6d..38e4dd234 100644 --- a/src/zcl_abapgit_repo.clas.abap +++ b/src/zcl_abapgit_repo.clas.abap @@ -114,7 +114,6 @@ CLASS zcl_abapgit_repo DEFINITION METHODS set IMPORTING - !iv_sha1 TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL !it_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt OPTIONAL !iv_url TYPE zif_abapgit_persistence=>ty_repo-url OPTIONAL !iv_branch_name TYPE zif_abapgit_persistence=>ty_repo-branch_name OPTIONAL @@ -457,8 +456,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION. DATA: lo_persistence TYPE REF TO zcl_abapgit_persistence_repo. - ASSERT iv_sha1 IS SUPPLIED - OR it_checksums IS SUPPLIED + ASSERT it_checksums IS SUPPLIED OR iv_url IS SUPPLIED OR iv_branch_name IS SUPPLIED OR iv_head_branch IS SUPPLIED @@ -468,13 +466,6 @@ CLASS zcl_abapgit_repo IMPLEMENTATION. CREATE OBJECT lo_persistence. - IF iv_sha1 IS SUPPLIED. - lo_persistence->update_sha1( - iv_key = ms_data-key - iv_branch_sha1 = iv_sha1 ). - ms_data-sha1 = iv_sha1. - ENDIF. - IF it_checksums IS SUPPLIED. lo_persistence->update_local_checksums( iv_key = ms_data-key diff --git a/src/zcl_abapgit_repo_online.clas.abap b/src/zcl_abapgit_repo_online.clas.abap index 198bce4f8..e1a65cdbc 100644 --- a/src/zcl_abapgit_repo_online.clas.abap +++ b/src/zcl_abapgit_repo_online.clas.abap @@ -36,12 +36,9 @@ CLASS zcl_abapgit_repo_online DEFINITION !iv_branch_name TYPE zif_abapgit_persistence=>ty_repo-branch_name RAISING zcx_abapgit_exception . - METHODS get_sha1_local - RETURNING - VALUE(rv_sha1) TYPE zif_abapgit_persistence=>ty_repo-sha1 . METHODS get_sha1_remote RETURNING - VALUE(rv_sha1) TYPE zif_abapgit_persistence=>ty_repo-sha1 + VALUE(rv_sha1) TYPE zif_abapgit_definitions=>ty_sha1 RAISING zcx_abapgit_exception . METHODS get_objects @@ -137,7 +134,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION. METHOD delete_initial_online_repo. - IF me->is_offline( ) = abap_false AND me->get_sha1_local( ) IS INITIAL. + IF me->is_offline( ) = abap_false AND me->get_sha1_remote( ) IS INITIAL. zcl_abapgit_repo_srv=>get_instance( )->delete( me ). @@ -156,8 +153,6 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION. super->deserialize( is_checks ). - set( iv_sha1 = mv_branch ). - reset_status( ). COMMIT WORK AND WAIT. @@ -189,11 +184,6 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION. ENDMETHOD. "get_objects - METHOD get_sha1_local. - rv_sha1 = ms_data-sha1. - ENDMETHOD. "get_sha1_local - - METHOD get_sha1_remote. initialize( ). @@ -321,20 +311,15 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION. IMPORTING ev_branch = lv_branch et_updated_files = lt_updated_files ). - IF io_stage->get_branch_sha1( ) = get_sha1_local( ). -* pushing to the branch currently represented by this repository object + IF io_stage->get_branch_sha1( ) = get_sha1_remote( ). +* pushing to the branch currently represented by this repository object mv_branch = lv_branch. mv_branch = lv_branch. - set( iv_sha1 = lv_branch ). ELSE. refresh( ). ENDIF. update_local_checksums( lt_updated_files ). - IF zcl_abapgit_stage_logic=>count( me ) = 0. - set( iv_sha1 = lv_branch ). - ENDIF. - CLEAR: mv_code_inspector_successful. ENDMETHOD. "push @@ -342,20 +327,18 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION. METHOD rebuild_local_checksums. "REMOTE - DATA: lt_remote TYPE zif_abapgit_definitions=>ty_files_tt, - lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, - ls_last_item TYPE zif_abapgit_definitions=>ty_item, - lv_branch_equal TYPE abap_bool, - lt_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt. + DATA: lt_remote TYPE zif_abapgit_definitions=>ty_files_tt, + lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, + ls_last_item TYPE zif_abapgit_definitions=>ty_item, + lt_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt. FIELD-SYMBOLS: LIKE LINE OF lt_checksums, LIKE LINE OF -files, LIKE LINE OF lt_remote, LIKE LINE OF lt_local. - lt_remote = get_files_remote( ). - lt_local = get_files_local( ). - lv_branch_equal = boolc( get_sha1_remote( ) = get_sha1_local( ) ). + lt_remote = get_files_remote( ). + lt_local = get_files_local( ). DELETE lt_local " Remove non-code related files except .abapgit WHERE item IS INITIAL @@ -383,7 +366,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION. " If hashes are equal -> local sha1 is OK " Else if R-branch is ahead -> assume changes were remote, state - local sha1 " Else (branches equal) -> assume changes were local, state - remote sha1 - IF -file-sha1 <> -sha1 AND lv_branch_equal = abap_true. + IF -file-sha1 <> -sha1. -sha1 = -sha1. ENDIF. ENDLOOP. @@ -487,12 +470,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION. mv_initialized = abap_false. set( iv_url = iv_url iv_branch_name = iv_branch_name - iv_head_branch = '' - iv_sha1 = '' ). - - " If the SHA1 is empty, it's not possible to create tags or branches. - " Therefore we update the local SHA1 with the new remote SHA1 - set( iv_sha1 = get_sha1_remote( ) ). + iv_head_branch = '' ). ENDMETHOD. "set_new_remote diff --git a/src/zcl_abapgit_repo_srv.clas.abap b/src/zcl_abapgit_repo_srv.clas.abap index d284272fe..c92c2f7aa 100644 --- a/src/zcl_abapgit_repo_srv.clas.abap +++ b/src/zcl_abapgit_repo_srv.clas.abap @@ -310,7 +310,6 @@ CLASS zcl_abapgit_repo_srv IMPLEMENTATION. lo_repo->set( iv_url = zcl_abapgit_url=>name( lo_repo->ms_data-url ) iv_branch_name = '' - iv_sha1 = '' iv_head_branch = '' iv_offline = abap_true ). CREATE OBJECT TYPE zcl_abapgit_repo_offline diff --git a/src/zcl_abapgit_transport_2_branch.clas.abap b/src/zcl_abapgit_transport_2_branch.clas.abap index 8632b5700..ca7939d71 100644 --- a/src/zcl_abapgit_transport_2_branch.clas.abap +++ b/src/zcl_abapgit_transport_2_branch.clas.abap @@ -33,7 +33,7 @@ ENDCLASS. -CLASS ZCL_ABAPGIT_TRANSPORT_2_BRANCH IMPLEMENTATION. +CLASS zcl_abapgit_transport_2_branch IMPLEMENTATION. METHOD create. @@ -79,7 +79,7 @@ CLASS ZCL_ABAPGIT_TRANSPORT_2_BRANCH IMPLEMENTATION. zcl_abapgit_git_porcelain=>create_branch( io_repo = io_repository iv_name = iv_branch_name - iv_from = io_repository->get_sha1_local( ) ). + iv_from = io_repository->get_sha1_remote( ) ). io_repository->set_branch_name( iv_branch_name ). CATCH zcx_abapgit_exception.