abapGit/src/zcl_abapgit_repo_offline.clas.abap
Marc Bernard e4bafbe715
Validate if branch exists when displaying repo (#3749)
* Validate if branch exists when displaying repo

* Validate if branch exists when displaying repo

* Lint

* Lint and 702

* Lint

* Rename validate_branch to validate

* Fix msg and branch display name

* Move msg to UI layer

* Lint

Co-authored-by: Lars Hvam <larshp@hotmail.com>
Co-authored-by: Frederik Hudák <frederik.hudak@sap.com>
2020-08-24 11:15:46 +02:00

70 lines
1.3 KiB
ABAP

CLASS zcl_abapgit_repo_offline DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_repo
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS get_name
REDEFINITION .
METHODS has_remote_source
REDEFINITION .
METHODS validate
REDEFINITION .
METHODS reset
REDEFINITION .
PROTECTED SECTION.
METHODS reset_remote
REDEFINITION .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_ABAPGIT_REPO_OFFLINE IMPLEMENTATION.
METHOD get_name.
rv_name = super->get_name( ).
IF rv_name IS INITIAL.
rv_name = ms_data-url.
ENDIF.
ENDMETHOD.
METHOD has_remote_source.
rv_yes = boolc( lines( mt_remote ) > 0 ).
ENDMETHOD.
METHOD reset.
" Nothing to do so far
ENDMETHOD.
METHOD reset_remote.
DATA lt_backup LIKE mt_remote.
" online repo has online source to renew data from, offline does not
" so offline repo preserves the remote
" in case of partial pull failure the user will immediately see the new difference
" UI will detect "pullable" content based on mt_status
" in the uniform way both for online and offline repos
" for more details see discussion in 2096 and 1953
lt_backup = mt_remote.
super->reset_remote( ).
set_files_remote( lt_backup ).
ENDMETHOD.
METHOD validate.
" Nothing to do so far
ENDMETHOD.
ENDCLASS.