mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +08:00
Refresh online repo: call BRANCH_LIST just once
Before this commit is applied BRANCH_LIST is called twice while refreshing an online repo. This leads to two identical HTTP calls. After this commit is applied BRANCH_LIST is only called once and therefore only one HTTP request is sent.
This commit is contained in:
parent
d7e90aae60
commit
bb82f2c8bd
|
@ -6,11 +6,12 @@ CLASS zcl_abapgit_git_porcelain DEFINITION
|
|||
PUBLIC SECTION.
|
||||
CLASS-METHODS pull
|
||||
IMPORTING
|
||||
!io_repo TYPE REF TO zcl_abapgit_repo_online
|
||||
!io_repo TYPE REF TO zcl_abapgit_repo_online
|
||||
EXPORTING
|
||||
!et_files TYPE zif_abapgit_definitions=>ty_files_tt
|
||||
!et_objects TYPE zif_abapgit_definitions=>ty_objects_tt
|
||||
!ev_branch TYPE zif_abapgit_definitions=>ty_sha1
|
||||
!et_files TYPE zif_abapgit_definitions=>ty_files_tt
|
||||
!et_objects TYPE zif_abapgit_definitions=>ty_objects_tt
|
||||
!ev_branch TYPE zif_abapgit_definitions=>ty_sha1
|
||||
!eo_branch_list TYPE REF TO zcl_abapgit_git_branch_list
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
CLASS-METHODS push
|
||||
|
@ -351,6 +352,7 @@ CLASS zcl_abapgit_git_porcelain IMPLEMENTATION.
|
|||
CLEAR et_files.
|
||||
CLEAR et_objects.
|
||||
CLEAR ev_branch.
|
||||
CLEAR eo_branch_list.
|
||||
|
||||
zcl_abapgit_git_transport=>upload_pack(
|
||||
EXPORTING
|
||||
|
@ -358,7 +360,8 @@ CLASS zcl_abapgit_git_porcelain IMPLEMENTATION.
|
|||
iv_branch_name = io_repo->get_branch_name( )
|
||||
IMPORTING
|
||||
et_objects = et_objects
|
||||
ev_branch = ev_branch ).
|
||||
ev_branch = ev_branch
|
||||
eo_branch_list = eo_branch_list ).
|
||||
|
||||
READ TABLE et_objects INTO ls_object WITH KEY sha1 = ev_branch type = zif_abapgit_definitions=>gc_type-commit.
|
||||
IF sy-subrc <> 0.
|
||||
|
|
|
@ -12,6 +12,7 @@ CLASS zcl_abapgit_git_transport DEFINITION
|
|||
it_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt OPTIONAL
|
||||
EXPORTING et_objects TYPE zif_abapgit_definitions=>ty_objects_tt
|
||||
ev_branch TYPE zif_abapgit_definitions=>ty_sha1
|
||||
eo_branch_list TYPE REF TO zcl_abapgit_git_branch_list
|
||||
RAISING zcx_abapgit_exception.
|
||||
|
||||
* local to remote
|
||||
|
@ -46,6 +47,7 @@ CLASS zcl_abapgit_git_transport DEFINITION
|
|||
iv_branch_name TYPE string
|
||||
EXPORTING eo_client TYPE REF TO zcl_abapgit_http_client
|
||||
ev_branch TYPE zif_abapgit_definitions=>ty_sha1
|
||||
eo_branch_list TYPE REF TO zcl_abapgit_git_branch_list
|
||||
RAISING zcx_abapgit_exception.
|
||||
|
||||
CLASS-METHODS parse
|
||||
|
@ -98,18 +100,16 @@ CLASS zcl_abapgit_git_transport IMPLEMENTATION.
|
|||
|
||||
METHOD find_branch.
|
||||
|
||||
DATA: lo_branch_list TYPE REF TO zcl_abapgit_git_branch_list.
|
||||
|
||||
branch_list(
|
||||
EXPORTING
|
||||
iv_url = iv_url
|
||||
iv_service = iv_service
|
||||
IMPORTING
|
||||
eo_client = eo_client
|
||||
eo_branch_list = lo_branch_list ).
|
||||
eo_branch_list = eo_branch_list ).
|
||||
|
||||
IF ev_branch IS SUPPLIED.
|
||||
ev_branch = lo_branch_list->find_by_name( iv_branch_name )-sha1.
|
||||
ev_branch = eo_branch_list->find_by_name( iv_branch_name )-sha1.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD. "find_branch
|
||||
|
@ -229,7 +229,9 @@ CLASS zcl_abapgit_git_transport IMPLEMENTATION.
|
|||
FIELD-SYMBOLS: <ls_branch> LIKE LINE OF lt_branches.
|
||||
|
||||
|
||||
CLEAR et_objects.
|
||||
CLEAR: et_objects,
|
||||
ev_branch,
|
||||
eo_branch_list.
|
||||
|
||||
find_branch(
|
||||
EXPORTING
|
||||
|
@ -238,6 +240,7 @@ CLASS zcl_abapgit_git_transport IMPLEMENTATION.
|
|||
iv_branch_name = iv_branch_name
|
||||
IMPORTING
|
||||
eo_client = lo_client
|
||||
eo_branch_list = eo_branch_list
|
||||
ev_branch = ev_branch ).
|
||||
|
||||
IF it_branches IS INITIAL.
|
||||
|
|
|
@ -91,7 +91,6 @@ CLASS zcl_abapgit_repo_online DEFINITION
|
|||
DATA mt_objects TYPE zif_abapgit_definitions=>ty_objects_tt .
|
||||
DATA mv_branch TYPE zif_abapgit_definitions=>ty_sha1 .
|
||||
DATA mv_initialized TYPE abap_bool .
|
||||
DATA mo_branches TYPE REF TO zcl_abapgit_git_branch_list .
|
||||
DATA mt_status TYPE zif_abapgit_definitions=>ty_results_tt .
|
||||
DATA mv_code_inspector_successful TYPE abap_bool .
|
||||
|
||||
|
@ -101,6 +100,8 @@ CLASS zcl_abapgit_repo_online DEFINITION
|
|||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS actualize_head_branch
|
||||
IMPORTING
|
||||
io_branch_list TYPE REF TO zcl_abapgit_git_branch_list
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
ENDCLASS.
|
||||
|
@ -112,7 +113,7 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
|
||||
METHOD actualize_head_branch.
|
||||
DATA lv_branch_name TYPE string.
|
||||
lv_branch_name = mo_branches->get_head( )-name.
|
||||
lv_branch_name = io_branch_list->get_head( )-name.
|
||||
|
||||
IF lv_branch_name <> ms_data-head_branch.
|
||||
set( iv_head_branch = lv_branch_name ).
|
||||
|
@ -362,8 +363,9 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
|
||||
METHOD refresh.
|
||||
|
||||
DATA: lo_progress TYPE REF TO zcl_abapgit_progress,
|
||||
lx_exception TYPE REF TO zcx_abapgit_exception.
|
||||
DATA: lo_progress TYPE REF TO zcl_abapgit_progress,
|
||||
lx_exception TYPE REF TO zcx_abapgit_exception,
|
||||
lo_branch_list TYPE REF TO zcl_abapgit_git_branch_list.
|
||||
|
||||
super->refresh( iv_drop_cache ).
|
||||
reset_status( ).
|
||||
|
@ -377,14 +379,14 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
|
||||
zcl_abapgit_git_porcelain=>pull(
|
||||
EXPORTING
|
||||
io_repo = me
|
||||
io_repo = me
|
||||
IMPORTING
|
||||
et_files = mt_remote
|
||||
et_objects = mt_objects
|
||||
ev_branch = mv_branch ).
|
||||
et_files = mt_remote
|
||||
et_objects = mt_objects
|
||||
ev_branch = mv_branch
|
||||
eo_branch_list = lo_branch_list ).
|
||||
|
||||
mo_branches = zcl_abapgit_git_transport=>branches( get_url( ) ).
|
||||
actualize_head_branch( ).
|
||||
actualize_head_branch( lo_branch_list ).
|
||||
|
||||
mv_initialized = abap_true.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user