Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 10x 10x 10x 10x 10x 10x 10x 10x 10x 1x 10x 10x 10x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 2x 2x 2x 1x 1x 1x 1x 1x 1x 4x 4x 4x 1x 9x 9x 9x 9x 9x 9x 9x 9x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_git_url.clas.abap class zcl_abapgit_git_url { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'ZCL_ABAPGIT_GIT_URL'; static IMPLEMENTED_INTERFACES = []; static ATTRIBUTES = {}; static METHODS = {"GET_DEFAULT_COMMIT_DISPLAY_URL": {"visibility": "O", "parameters": {"RV_COMMIT_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_REPO_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_HASH": {"type": () => {return new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"});}, "is_optional": " "}}}, "GET_COMMIT_DISPLAY_URL": {"visibility": "U", "parameters": {"RV_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "II_REPO_ONLINE": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_REPO_ONLINE", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_REPO_ONLINE"});}, "is_optional": " "}}}, "VALIDATE_URL": {"visibility": "U", "parameters": {"IV_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}}; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "get_default_commit_display_url": this.get_default_commit_display_url.bind(this), "get_commit_display_url": this.get_commit_display_url.bind(this), "validate_url": this.validate_url.bind(this), }; } async constructor_(INPUT) { if (super.constructor_) { await super.constructor_(INPUT); } return this; } async get_commit_display_url(INPUT) { let rv_url = new abap.types.String({qualifiedName: "STRING"}); let ii_repo_online = INPUT?.ii_repo_online; if (ii_repo_online?.getQualifiedName === undefined || ii_repo_online.getQualifiedName() !== "ZIF_ABAPGIT_REPO_ONLINE") { ii_repo_online = undefined; } if (ii_repo_online === undefined) { ii_repo_online = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_REPO_ONLINE", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_REPO_ONLINE"}).set(INPUT.ii_repo_online); } let li_exit = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_EXIT", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_EXIT"}); let li_repo = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_REPO", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_REPO"}); li_repo.set(ii_repo_online); rv_url.set((await this.get_default_commit_display_url({iv_repo_url: (await ii_repo_online.get().zif_abapgit_repo_online$get_url()), iv_hash: (await ii_repo_online.get().zif_abapgit_repo_online$get_current_remote())}))); li_exit.set((await abap.Classes['ZCL_ABAPGIT_EXIT'].get_instance())); await li_exit.get().zif_abapgit_exit$adjust_display_commit_url({iv_repo_url: (await ii_repo_online.get().zif_abapgit_repo_online$get_url()), iv_repo_name: (await li_repo.get().zif_abapgit_repo$get_name()), iv_repo_key: (await li_repo.get().zif_abapgit_repo$get_key()), iv_commit_hash: (await ii_repo_online.get().zif_abapgit_repo_online$get_current_remote()), cv_display_url: rv_url}); if (abap.compare.initial(rv_url)) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`provider not yet supported`)}); } return rv_url; } async get_default_commit_display_url(INPUT) { let rv_commit_url = new abap.types.String({qualifiedName: "STRING"}); let iv_repo_url = INPUT?.iv_repo_url; if (iv_repo_url?.getQualifiedName === undefined || iv_repo_url.getQualifiedName() !== "STRING") { iv_repo_url = undefined; } if (iv_repo_url === undefined) { iv_repo_url = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_repo_url); } let iv_hash = INPUT?.iv_hash; if (iv_hash?.getQualifiedName === undefined || iv_hash.getQualifiedName() !== "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_SHA1") { iv_hash = undefined; } if (iv_hash === undefined) { iv_hash = new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}).set(INPUT.iv_hash); } let ls_result = new abap.types.Structure({ "line": new abap.types.Integer({qualifiedName: "I"}), "offset": new abap.types.Integer({qualifiedName: "I"}), "length": new abap.types.Integer({qualifiedName: "I"}), "submatches": abap.types.TableFactory.construct(new abap.types.Structure({ "offset": new abap.types.Integer({qualifiedName: "I"}), "length": new abap.types.Integer({qualifiedName: "I"})}, "SUBMATCH_RESULT", "SUBMATCH_RESULT", {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "SUBMATCH_RESULT_TAB")}, "MATCH_RESULT", "MATCH_RESULT", {}, {}); let fs_ls_provider_match_ = new abap.types.FieldSymbol(new abap.types.Structure({ "offset": new abap.types.Integer({qualifiedName: "I"}), "length": new abap.types.Integer({qualifiedName: "I"})}, "SUBMATCH_RESULT", "SUBMATCH_RESULT", {}, {})); rv_commit_url.set(iv_repo_url); abap.statements.find(rv_commit_url, {regex: abap.CharacterFactory.get(68, '^http(?:s)?:\\/\\/(?:www\\.)?(github\\.com|bitbucket\\.org|gitlab\\.com)\\/'), results: ls_result}); if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { abap.statements.readTable(ls_result.get().submatches,{index: abap.IntegerFactory.get(1), assigning: fs_ls_provider_match_}); let unique229 = rv_commit_url.getOffset({offset: fs_ls_provider_match_.get().offset, length: fs_ls_provider_match_.get().length}); if (abap.compare.eq(unique229, abap.CharacterFactory.get(10, 'github.com'))) { abap.statements.replace({target: rv_commit_url, all: false, with: abap.builtin.space, regex: abap.CharacterFactory.get(6, '\\.git$')}); rv_commit_url.set(abap.operators.concat(rv_commit_url,abap.operators.concat(new abap.types.String().set(`/commit/`),iv_hash))); } else if (abap.compare.eq(unique229, abap.CharacterFactory.get(13, 'bitbucket.org'))) { abap.statements.replace({target: rv_commit_url, all: false, with: abap.builtin.space, regex: abap.CharacterFactory.get(6, '\\.git$')}); rv_commit_url.set(abap.operators.concat(rv_commit_url,abap.operators.concat(new abap.types.String().set(`/commits/`),iv_hash))); } else if (abap.compare.eq(unique229, abap.CharacterFactory.get(10, 'gitlab.com'))) { abap.statements.replace({target: rv_commit_url, all: false, with: abap.builtin.space, regex: abap.CharacterFactory.get(6, '\\.git$')}); rv_commit_url.set(abap.operators.concat(rv_commit_url,abap.operators.concat(new abap.types.String().set(`/-/commit/`),iv_hash))); } } return rv_commit_url; } async validate_url(INPUT) { let iv_url = INPUT?.iv_url; if (iv_url?.getQualifiedName === undefined || iv_url.getQualifiedName() !== "STRING") { iv_url = undefined; } if (iv_url === undefined) { iv_url = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_url); } let lv_provider = new abap.types.String({qualifiedName: "STRING"}); lv_provider.set((await abap.Classes['ZCL_ABAPGIT_URL'].host({iv_url: abap.builtin.to_lower({val: iv_url})}))); if (abap.compare.cs(lv_provider, abap.CharacterFactory.get(10, 'gitlab.com'))) { abap.statements.find(iv_url, {regex: abap.CharacterFactory.get(6, '\\.git$'), ignoringCase: true}); if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(38, 'Repo URL for GitLab must end in ".git"')}); } } else if (abap.compare.cs(lv_provider, abap.CharacterFactory.get(13, 'dev.azure.com'))) { abap.statements.find(iv_url, {regex: abap.CharacterFactory.get(6, '\\.git$'), ignoringCase: true}); if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(48, 'Repo URL for Azure DevOps must not end in ".git"')}); } } } } abap.Classes['ZCL_ABAPGIT_GIT_URL'] = zcl_abapgit_git_url; export {zcl_abapgit_git_url}; |