Exemplo n.º 1
0
def repo():
    """
    Open repository view.
    """
    project = get_config("project")
    organization = get_config("organization")
    click.launch(f"{organization}/{project}/_git/{get_repo_name()}")
Exemplo n.º 2
0
def prs():
    """
    Open active PRs for repository view.
    """
    project = get_config("project")
    organization = get_config("organization")
    click.launch(
        f"{organization}/{project}/_git/{get_repo_name()}/pullrequests?_a=active"
    )
Exemplo n.º 3
0
def branches():
    """
    Open an overview of the repositories' branches.
    """
    project = get_config("project")
    organization = get_config("organization")

    url = f"{organization}/{project}/_git/{get_repo_name()}/branches"
    click.launch(url)
Exemplo n.º 4
0
def branch(branch_name):
    """
    Open a specific BRANCH_NAME.
    """
    project = get_config("project")
    organization = get_config("organization")

    click.launch(
        f"{organization}/{project}/_git/{get_repo_name()}?version=GB{branch_name}"
    )
Exemplo n.º 5
0
def sprint():
    """
    Open current sprint view.
    """
    iteration = get_config("iteration")
    team = get_config("team")
    project = get_config("project")
    organization = get_config("organization")

    # Iterations often have backslashes and spaces, which must be encoded to a URL
    iteration = quote(os.path.basename(iteration.replace("\\", "/")))

    click.launch(
        f"{organization}/{project}/_sprints/taskboard/{team}/{iteration}")
Exemplo n.º 6
0
def pipe():
    """
    Open latest pipeline runs for repository view.
    """
    project = get_config("project")
    organization = get_config("organization")

    repo_pipes = run_command(
        f'az pipelines list --repository "{get_repo_name()}" --org "{organization}" -p "{project}"'
    )
    if len(repo_pipes) == 0:
        console.print(f"{get_repo_name()} has no pipelines defined currently")
        return None

    pipeline_id = repo_pipes[0].get("id")
    click.launch(f"{organization}/{project}/_build?definitionId={pipeline_id}")
Exemplo n.º 7
0
def board():
    """
    Open board view.
    """
    iteration = get_config("iteration")
    area = get_config("area")
    team = get_config("team")
    project = get_config("project")
    organization = get_config("organization")

    console.print(
        "[dark_orange3]>[/dark_orange3] Opening the Azure board. Make sure to filter on:"
    )

    iteration_short = os.path.basename(iteration.replace("\\", "/"))
    area_short = os.path.basename(area.replace("\\", "/"))
    console.print(f"\titeration = '{iteration_short}'")
    console.print(f"\tarea = '{area_short}'")

    click.launch(f"{organization}/{project}/_boards/board/t/{team}")
Exemplo n.º 8
0
def policies():
    """
    Open repository policy settings.

    Will show the default branch policies by default.
    """
    project = get_config("project")
    organization = get_config("organization")

    repo_name = get_repo_name()
    repo = run_command(f'az repos show --repository "{repo_name}"')

    repo_id = repo.get("id")
    assert len(repo_id) > 0
    default_branch = repo.get("defaultBranch").split("/")[-1]
    assert len(default_branch) > 0

    url = f"{organization}/{project}/_settings/repositories?repo={repo_id}"
    url += f"&_a=policiesMid&refs=refs%2Fheads%2F{default_branch}"
    click.launch(url)
Exemplo n.º 9
0
def issues():
    """
    Open all active issues view. Alternatively, use `doing list --web`.
    """
    iteration = get_config("iteration")
    area = get_config("area")
    project = get_config("project")
    organization = get_config("organization")

    query = work_item_query(assignee="",
                            author="",
                            label="",
                            state="open",
                            area=area,
                            iteration=iteration,
                            type="",
                            story_points="")

    # More on hyperlink query syntax:
    # https://docs.microsoft.com/en-us/azure/devops/boards/queries/define-query-hyperlink?view=azure-devops
    click.launch(
        f"{organization}/{project}/_workitems/?_a=query&wiql={quote(query)}")
Exemplo n.º 10
0
def close(work_item_id):
    """Close a specific WORK_ITEM_ID.

    A '#' prefix is allowed. You can specify multiple IDs by separating with a space.
    """
    organization = get_config("organization")
    state = "Closed"

    for id in work_item_id:
        id = str(id).lstrip("#")
        cmd = f"az boards work-item update --id {id} --state '{state}' "
        cmd += f"--org '{organization}'"
        result = run_command(cmd)
        assert result.get("fields").get("System.State") == state
        console.print(
            f"[dark_orange3]>[/dark_orange3] work item #{id} set to '{state}'")