All files / output zcl_abapgit_git_branch_utils.clas.mjs

44.85% Statements 48/107
81.81% Branches 9/11
12% Functions 3/25
44.85% Lines 48/107

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 99 100 101 102 103 104 105 106 1071x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x             1x       1x     1x                   1x     1x                               1x     1x 31x 31x 31x 31x 4x 31x     31x 31x 1x     1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 5x 7x                 7x 7x 1x     1x             1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_git_branch_utils.clas.abap
class zcl_abapgit_git_branch_utils {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_GIT_BRANCH_UTILS';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"GET_DISPLAY_NAME": {"visibility": "U", "parameters": {"RV_DISPLAY_NAME": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_BRANCH_NAME": {"type": () => {return new abap.types.Character();}, "is_optional": " "}}},
  "GET_TYPE": {"visibility": "U", "parameters": {"RV_TYPE": {"type": () => {return new abap.types.Character(2, {"qualifiedName":"zif_abapgit_git_definitions=>ty_git_branch_type"});}, "is_optional": " "}, "IV_BRANCH_NAME": {"type": () => {return new abap.types.Character();}, "is_optional": " "}, "IT_RESULT": {"type": () => {return abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");}, "is_optional": " "}, "IV_CURRENT_ROW_INDEX": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " "}}},
  "GET_DESCRIPTION": {"visibility": "U", "parameters": {"RV_DESCRIPTION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_BRANCH_NAME": {"type": () => {return new abap.types.Character();}, "is_optional": " "}}},
  "COMPLETE_HEADS_BRANCH_NAME": {"visibility": "U", "parameters": {"RV_NAME": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_BRANCH_NAME": {"type": () => {return new abap.types.Character();}, "is_optional": " "}}},
  "NORMALIZE_BRANCH_NAME": {"visibility": "U", "parameters": {"RV_NAME": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_BRANCH_NAME": {"type": () => {return new abap.types.Character();}, "is_optional": " "}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async complete_heads_branch_name(INPUT) {
    return zcl_abapgit_git_branch_utils.complete_heads_branch_name(INPUT);
  }
  static async complete_heads_branch_name(INPUT) {
    let rv_name = new abap.types.String({qualifiedName: "STRING"});
    let iv_branch_name = INPUT?.iv_branch_name;
    if (abap.compare.cp(iv_branch_name, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().heads)) {
      rv_name.set(iv_branch_name);
    } else {
      rv_name.set(abap.operators.concat(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().heads_prefix,iv_branch_name));
    }
    return rv_name;
  }
  async get_description(INPUT) {
    return zcl_abapgit_git_branch_utils.get_description(INPUT);
  }
  static async get_description(INPUT) {
    let rv_description = new abap.types.String({qualifiedName: "STRING"});
    let iv_branch_name = INPUT?.iv_branch_name;
    let unique125 = (await this.get_type({iv_branch_name: iv_branch_name}));
    if (abap.compare.eq(unique125, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch_type.get().branch)) {
      rv_description.set(abap.CharacterFactory.get(6, 'Branch'));
    } else if (abap.compare.eq(unique125, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch_type.get().lightweight_tag)) {
      rv_description.set(abap.CharacterFactory.get(3, 'Tag'));
    } else if (abap.compare.eq(unique125, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch_type.get().annotated_tag)) {
      rv_description.set(abap.CharacterFactory.get(13, 'Annotated Tag'));
    } else {
      rv_description.set(abap.CharacterFactory.get(6, 'Branch'));
    }
    rv_description.set(new abap.types.String().set(`${abap.templateFormatting(rv_description)} "${abap.templateFormatting((await this.get_display_name({iv_branch_name: iv_branch_name})))}"`));
    return rv_description;
  }
  async get_display_name(INPUT) {
    return zcl_abapgit_git_branch_utils.get_display_name(INPUT);
  }
  static async get_display_name(INPUT) {
    let rv_display_name = new abap.types.String({qualifiedName: "STRING"});
    let iv_branch_name = INPUT?.iv_branch_name;
    rv_display_name.set(iv_branch_name);
    if (abap.compare.cp(rv_display_name, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().heads)) {
      abap.statements.replace({target: rv_display_name, all: false, with: abap.CharacterFactory.get(1, ''), of: abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().heads_prefix});
    } else if (abap.compare.cp(rv_display_name, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().tags)) {
      rv_display_name.set((await abap.Classes['ZCL_ABAPGIT_GIT_TAG'].remove_tag_prefix({iv_text: (await abap.Classes['ZCL_ABAPGIT_GIT_TAG'].remove_peel({iv_text: rv_display_name}))})));
    }
    return rv_display_name;
  }
  async get_type(INPUT) {
    return zcl_abapgit_git_branch_utils.get_type(INPUT);
  }
  static async get_type(INPUT) {
    let rv_type = new abap.types.Character(2, {"qualifiedName":"zif_abapgit_git_definitions=>ty_git_branch_type"});
    let iv_branch_name = INPUT?.iv_branch_name;
    let it_result = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");
    if (INPUT && INPUT.it_result) {it_result.set(INPUT.it_result);}
    let iv_current_row_index = new abap.types.Integer({qualifiedName: "I"});
    if (INPUT && INPUT.iv_current_row_index) {iv_current_row_index.set(INPUT.iv_current_row_index);}
    let fs_lv_result_ = new abap.types.FieldSymbol(new abap.types.String({qualifiedName: "STRING"}));
    rv_type.set(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch_type.get().other);
    if (abap.compare.cp(iv_branch_name, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().heads) || abap.compare.eq(iv_branch_name, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_head_name)) {
      rv_type.set(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch_type.get().branch);
    } else if (abap.compare.cp(iv_branch_name, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().tags)) {
      abap.statements.readTable(it_result,{index: abap.operators.add(iv_current_row_index,abap.IntegerFactory.get(1)),
        assigning: fs_lv_result_});
      if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0)) && abap.compare.cp(fs_lv_result_, abap.operators.concat(abap.CharacterFactory.get(1, '*'),(await abap.Classes['ZCL_ABAPGIT_GIT_TAG'].add_peel({iv_text: iv_branch_name}))))) {
        rv_type.set(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch_type.get().annotated_tag);
      } else {
        rv_type.set(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch_type.get().lightweight_tag);
      }
    }
    return rv_type;
  }
  async normalize_branch_name(INPUT) {
    return zcl_abapgit_git_branch_utils.normalize_branch_name(INPUT);
  }
  static async normalize_branch_name(INPUT) {
    let rv_name = new abap.types.String({qualifiedName: "STRING"});
    let iv_branch_name = INPUT?.iv_branch_name;
    rv_name.set(iv_branch_name);
    abap.statements.replace({target: rv_name, all: true, with: abap.CharacterFactory.get(1, '-'), of: new abap.types.String().set(` `)});
    return rv_name;
  }
}
abap.Classes['ZCL_ABAPGIT_GIT_BRANCH_UTILS'] = zcl_abapgit_git_branch_utils;
export {zcl_abapgit_git_branch_utils};