"'Branch name', 'Latest commit', 'Related issues has Resolution'\n")
    for repository in REPOS:
        step = 0
        limit = 10
        while flag:
            branches = stash.get_branches(PROJECT_KEY,
                                          repository,
                                          start=step * limit,
                                          limit=limit,
                                          order_by='ALPHABETICAL')
            if len(branches) == 0:
                flag = False
                break
            for branch in branches:
                display_id = branch['displayId']
                committer_time_stamp = branch.get('metadata').get(
                    commit_info_key).get('committerTimestamp') / 1000
                last_date_commit = time.strftime(
                    '%Y-%m-%d %H:%M:%S', time.localtime(committer_time_stamp))
                if is_can_removed_branch(branch):
                    if not DRY_RUN:
                        stash.delete_branch(project=PROJECT_KEY,
                                            repository=repository,
                                            name=display_id,
                                            end_point=branch['latestCommit'])
                    log.write("{},{},{}\n".format(display_id, last_date_commit,
                                                  True))
            step += 1
    log.close()
    print("Done")
예제 #2
0
    for repository in REPOS:
        step = 0
        limit = 10
        while flag:
            branches = stash.get_branches(
                PROJECT_KEY,
                repository,
                start=step * limit,
                limit=limit,
                order_by="ALPHABETICAL",
            )
            if len(branches) == 0:
                flag = False
                break
            for branch in branches:
                display_id = branch["displayId"]
                committer_time_stamp = branch.get("metadata").get(commit_info_key).get("committerTimestamp") / 1000
                last_date_commit = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(committer_time_stamp))
                if is_can_removed_branch(branch):
                    if not DRY_RUN:
                        stash.delete_branch(
                            project_key=PROJECT_KEY,
                            repository_slug=repository,
                            name=display_id,
                            end_point=branch["latestCommit"],
                        )
                    log.write("{},{},{}\n".format(display_id, last_date_commit, True))
            step += 1
    log.close()
    print("Done")