Exemplo n.º 1
0
def build_uplift_requirements(repo_dir):
    if os.path.exists(requirements_file) and util.ask_yn("Found existing requirements. Should they be used?"):
        bug_info = util.read_json(requirements_file)
    else:
        bug_info = {}
        enabled_branches = c.read_value('repository.enabled_branches')
        all_queries = c.read_value('queries')
        queries = []
        for branch in enabled_branches:
            queries.extend(all_queries[branch])

        bugs = [x for x in find_bugs(queries) if not is_skipable(x)]
        print "Fetching bug data"
        for bug_id in bugs:
            if is_skipable(bug_id):
                continue
            bug = bzapi.fetch_complete_bug(bug_id)
            print "+",
            needed_on = branch_logic.needed_on_branches(bug)
            if len(needed_on) == 0:
                continue
            b = bug_info[bug_id] = {}
            b['needed_on'] = needed_on
            b['already_fixed_on'] = branch_logic.fixed_on_branches(bug)
            b['summary'] = bug['summary']
        print "\nFinished fetching bug data"
        util.write_json(requirements_file, bug_info)
    return bug_info
Exemplo n.º 2
0
            print "  * guess-%d: %s" % (i+1, keys[i])
            print "    BECAUSE:"
            for reason in guesses[keys[i]]:
                for line in reason.split('\n'):
                    print "        ", "\n        ".join(textwrap.wrap(line))

    def _open_browser():
        open_bug_in_browser(bug_id)


    _open_browser()

    prompt = "%s\nBug %s's %%d commits:\n%%s\nEnter command: " % ('-' * 80, bug_id)
    print "=" * 80
    print "Needed on: %s" % util.e_join(branch_logic.needed_on_branches(bug_data))
    print "Fixed on: %s" % util.e_join(branch_logic.fixed_on_branches(bug_data))
    print "Type one of"
    if len(guesses) > 0:
        print "  * guess-all: add all guesses listed below"
        _show_guesses()
    print "  * sha1 commit: add a raw commit number"
    print "  * skip: add a bug to the list of permanently skipped bugs"
    print "  * delete-all: remove all commits from this bug"
    print "  * delete-N: delete entered commit"
    print "  * browser: (re)open the bug in a browser"

    user_input = raw_input(prompt % (len(commits), _list_commits())).strip()

    guess_re = re.compile('^guess-(?P<guess>\d+)$')
    delete_re = re.compile('^delete-(?P<delete>\d+)$')