mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
Merge pull request #322 from sbcgua/master
head_branch_name in repo persistence
This commit is contained in:
commit
8c7d8680ad
|
@ -105,6 +105,7 @@ CLASS lcl_persistence_repo DEFINITION FINAL.
|
|||
offline TYPE sap_bool,
|
||||
local_checksums TYPE ty_local_checksum_tt,
|
||||
master_language TYPE spras,
|
||||
head_branch TYPE string,
|
||||
END OF ty_repo_xml.
|
||||
|
||||
TYPES: BEGIN OF ty_repo,
|
||||
|
@ -139,6 +140,11 @@ CLASS lcl_persistence_repo DEFINITION FINAL.
|
|||
iv_branch_name TYPE ty_repo_xml-branch_name
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS update_head_branch
|
||||
IMPORTING iv_key TYPE ty_repo-key
|
||||
iv_head_branch TYPE ty_repo_xml-head_branch
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS add
|
||||
IMPORTING iv_url TYPE string
|
||||
iv_branch_name TYPE string
|
||||
|
@ -1393,6 +1399,34 @@ CLASS lcl_persistence_repo IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD update_head_branch.
|
||||
|
||||
DATA: lt_content TYPE lcl_persistence_db=>tt_content,
|
||||
ls_content LIKE LINE OF lt_content,
|
||||
ls_repo TYPE ty_repo.
|
||||
|
||||
|
||||
IF iv_head_branch IS INITIAL.
|
||||
lcx_exception=>raise( 'update, head branch empty' ).
|
||||
ENDIF.
|
||||
|
||||
ASSERT NOT iv_key IS INITIAL.
|
||||
|
||||
TRY.
|
||||
ls_repo = read( iv_key ).
|
||||
CATCH lcx_not_found.
|
||||
lcx_exception=>raise( 'key not found' ).
|
||||
ENDTRY.
|
||||
|
||||
ls_repo-head_branch = iv_head_branch.
|
||||
ls_content-data_str = to_xml( ls_repo ).
|
||||
|
||||
mo_db->update( iv_type = c_type_repo
|
||||
iv_value = iv_key
|
||||
iv_data = ls_content-data_str ).
|
||||
|
||||
ENDMETHOD. "update_head_branch
|
||||
|
||||
METHOD update_sha1.
|
||||
|
||||
DATA: lt_content TYPE lcl_persistence_db=>tt_content,
|
||||
|
|
|
@ -61,6 +61,7 @@ CLASS lcl_repo DEFINITION ABSTRACT.
|
|||
it_checksums TYPE lcl_persistence_repo=>ty_local_checksum_tt OPTIONAL
|
||||
iv_url TYPE lcl_persistence_repo=>ty_repo-url OPTIONAL
|
||||
iv_branch_name TYPE lcl_persistence_repo=>ty_repo-branch_name OPTIONAL
|
||||
iv_head_branch TYPE lcl_persistence_repo=>ty_repo-head_branch OPTIONAL
|
||||
RAISING lcx_exception.
|
||||
|
||||
ENDCLASS. "lcl_repo DEFINITION
|
||||
|
@ -80,6 +81,8 @@ CLASS lcl_repo_online DEFINITION INHERITING FROM lcl_repo FINAL.
|
|||
RETURNING VALUE(rv_url) TYPE lcl_persistence_repo=>ty_repo-url,
|
||||
get_branch_name
|
||||
RETURNING VALUE(rv_name) TYPE lcl_persistence_repo=>ty_repo-branch_name,
|
||||
get_head_branch_name
|
||||
RETURNING VALUE(rv_name) TYPE lcl_persistence_repo=>ty_repo-head_branch,
|
||||
get_branches
|
||||
RETURNING VALUE(ro_branches) TYPE REF TO lcl_git_branch_list,
|
||||
set_url
|
||||
|
@ -119,6 +122,8 @@ CLASS lcl_repo_online DEFINITION INHERITING FROM lcl_repo FINAL.
|
|||
IMPORTING io_stage TYPE REF TO lcl_stage
|
||||
RAISING lcx_exception,
|
||||
initialize
|
||||
RAISING lcx_exception,
|
||||
actualize_head_branch
|
||||
RAISING lcx_exception.
|
||||
|
||||
ENDCLASS. "lcl_repo_online DEFINITION
|
||||
|
|
|
@ -74,6 +74,7 @@ CLASS lcl_repo_online IMPLEMENTATION.
|
|||
ev_branch = mv_branch ).
|
||||
|
||||
mo_branches = lcl_git_transport=>branches( get_url( ) ).
|
||||
actualize_head_branch( ).
|
||||
|
||||
find_dot_abapgit( ).
|
||||
|
||||
|
@ -81,6 +82,16 @@ CLASS lcl_repo_online IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "refresh
|
||||
|
||||
METHOD actualize_head_branch.
|
||||
DATA lv_branch_name TYPE string.
|
||||
lv_branch_name = mo_branches->get_head( )-name.
|
||||
|
||||
IF lv_branch_name <> ms_data-head_branch.
|
||||
set( iv_head_branch = lv_branch_name ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD. "actualize_head_branch
|
||||
|
||||
METHOD get_sha1_remote.
|
||||
initialize( ).
|
||||
|
||||
|
@ -107,7 +118,14 @@ CLASS lcl_repo_online IMPLEMENTATION.
|
|||
rv_name = ms_data-branch_name.
|
||||
ENDMETHOD. "get_branch_name
|
||||
|
||||
METHOD get_head_branch_name.
|
||||
rv_name = ms_data-head_branch.
|
||||
ENDMETHOD. "get_head_branch_name
|
||||
|
||||
METHOD get_branches.
|
||||
IF mo_branches IS NOT BOUND.
|
||||
mo_branches = lcl_git_transport=>branches( get_url( ) ).
|
||||
ENDIF.
|
||||
ro_branches = mo_branches.
|
||||
ENDMETHOD. "get_branches
|
||||
|
||||
|
@ -225,7 +243,8 @@ CLASS lcl_repo IMPLEMENTATION.
|
|||
ASSERT iv_sha1 IS SUPPLIED
|
||||
OR it_checksums IS SUPPLIED
|
||||
OR iv_url IS SUPPLIED
|
||||
OR iv_branch_name IS SUPPLIED.
|
||||
OR iv_branch_name IS SUPPLIED
|
||||
OR iv_head_branch IS SUPPLIED.
|
||||
|
||||
CREATE OBJECT lo_persistence.
|
||||
|
||||
|
@ -257,6 +276,13 @@ CLASS lcl_repo IMPLEMENTATION.
|
|||
ms_data-branch_name = iv_branch_name.
|
||||
ENDIF.
|
||||
|
||||
IF iv_head_branch IS SUPPLIED.
|
||||
lo_persistence->update_head_branch(
|
||||
iv_key = ms_data-key
|
||||
iv_head_branch = iv_head_branch ).
|
||||
ms_data-head_branch = iv_head_branch.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD. "set_sha1
|
||||
|
||||
METHOD build_local_checksums.
|
||||
|
|
Loading…
Reference in New Issue
Block a user