def process(args):
    # XXX: only supports 'origin' remote at present

    clone = phlsys_git.GitClone('.')

    _fetch_log(clone, args.update, args.no_update, args.prompt_update)

    log = abdt_landinglog.get_log(clone)
    log_dict = {i.review_sha1: (i.name, i.landed_sha1) for i in log}

    local_branches = phlgit_branch.get_local_with_sha1(clone)

    if args.force:
        did_something = _prune_branches(
            clone, args, prune_force, log_dict, local_branches)
        if not did_something:
            print "nothing to do."
        else:
            print "done."
    else:
        assert args.interactive
        would_do_something = _prune_branches(
            clone, args, prune_dryrun, log_dict, local_branches)
        if not would_do_something:
            print "nothing to do."
        else:
            choice = phlsys_choice.yes_or_no("perform the pruning?", 'no')
            print
            if choice:
                _prune_branches(
                    clone, args, prune_force, log_dict, local_branches)
                print "done."
            else:
                print "stopped."
Example #2
0
def linterate(args, conduit, revision, error_revisions, error_filter):
    if not args.silent:
        print(revision.id, revision.title)

    try:
        errors = None

        if os.path.isdir('right'):
            errors = phlsys_cppcheck.run('right')
            errors = error_filter.filter_ignored(revision, errors)

        if errors:
            if args.silent:
                print(revision.id, revision.title)

            print(phlsys_cppcheck.summarize_results(errors))
            print(revision.uri)

            error_revisions.append(str(revision.id))
            if not args.non_interactive and phlsys_choice.yes_or_no('comment'):
                print("commenting..")
                for e in errors:
                    first_line = min(e.line_numbers)
                    last_line = max(e.line_numbers)
                    line_range = last_line - first_line
                    if line_range > 10:
                        for line in e.line_numbers:
                            phlcon_differential.create_inline_comment(
                                conduit, revision.id, e.path, line, e.message)
                    else:
                        phlcon_differential.create_inline_comment(
                            conduit,
                            revision.id,
                            e.path,
                            first_line,
                            e.message,
                            line_count=line_range)

                # XXX: only leave draft inline comments for now, so the user
                #      may review them in context and manually finish the
                #      comment
                #
                # message = "LINTERATOR SEE POSSIBLE ERROR"
                # phlcon_differential.create_comment(
                #     conduit, revision.id, message, attach_inlines=True)

            print()
    except phlsys_subprocess.CalledProcessError as e:
        if not args.silent:
            print(' ', e)
def linterate(args, conduit, revision, error_revisions, error_filter):
    if not args.silent:
        print(revision.id, revision.title)

    try:
        errors = None

        if os.path.isdir('right'):
            errors = phlsys_cppcheck.run('right')
            errors = error_filter.filter_ignored(revision, errors)

        if errors:
            if args.silent:
                print(revision.id, revision.title)

            print(phlsys_cppcheck.summarize_results(errors))
            print(revision.uri)

            error_revisions.append(str(revision.id))
            if not args.non_interactive and phlsys_choice.yes_or_no('comment'):
                print("commenting..")
                for e in errors:
                    first_line = min(e.line_numbers)
                    last_line = max(e.line_numbers)
                    line_range = last_line - first_line
                    if line_range > 10:
                        for line in e.line_numbers:
                            phlcon_differential.create_inline_comment(
                                conduit, revision.id, e.path, line, e.message)
                    else:
                        phlcon_differential.create_inline_comment(
                            conduit,
                            revision.id,
                            e.path,
                            first_line,
                            e.message,
                            line_count=line_range)

                # XXX: only leave draft inline comments for now, so the user
                #      may review them in context and manually finish the
                #      comment
                #
                # message = "LINTERATOR SEE POSSIBLE ERROR"
                # phlcon_differential.create_comment(
                #     conduit, revision.id, message, attach_inlines=True)

            print()
    except phlsys_subprocess.CalledProcessError as e:
        if not args.silent:
            print(' ', e)
def process(args):
    # XXX: only supports 'origin' remote at present

    print """
::DEPRECATION NOTICE::
the 'refs/arcyd/landinglog' ref is no longer being updated, for new
branches do:

    git fetch origin refs/arcyd/landed:refs/arcyd/landed
    git branch --merged refs/arcyd/landed | grep -v '*' | xargs git branch -D
    """.strip()
    print

    repo = phlsys_git.Repo('.')

    _fetch_log(repo, args.update, args.no_update, args.prompt_update)

    log = abdt_landinglog.get_log(repo)
    log_dict = {i.review_sha1: (i.name, i.landed_sha1) for i in log}

    local_branches = phlgit_branch.get_local_with_sha1(repo)

    if args.force:
        did_something = _prune_branches(
            repo, args, prune_force, log_dict, local_branches)
        if not did_something:
            print "nothing to do."
        else:
            print "done."
    else:
        assert args.interactive
        would_do_something = _prune_branches(
            repo, args, prune_dryrun, log_dict, local_branches)
        if not would_do_something:
            print "nothing to do."
        else:
            choice = phlsys_choice.yes_or_no("perform the pruning?", 'no')
            print
            if choice:
                _prune_branches(
                    repo, args, prune_force, log_dict, local_branches)
                print "done."
            else:
                print "stopped."
Example #5
0
def process(args):
    # XXX: only supports 'origin' remote at present

    print("""
::DEPRECATION NOTICE::
the 'refs/arcyd/landinglog' ref is no longer being updated, for new
branches do:

    git fetch origin refs/arcyd/landed:refs/arcyd/landed
    git branch --merged refs/arcyd/landed | grep -v '*' | xargs git branch -D
    """.strip())
    print()

    repo = phlsys_git.Repo('.')

    _fetch_log(repo, args.update, args.no_update, args.prompt_update)

    log = abdt_landinglog.get_log(repo)
    log_dict = {i.review_sha1: (i.name, i.landed_sha1) for i in log}

    local_branches = phlgit_branch.get_local_with_sha1(repo)

    if args.force:
        did_something = _prune_branches(
            repo, args, prune_force, log_dict, local_branches)
        if not did_something:
            print("nothing to do.")
        else:
            print("done.")
    else:
        assert args.interactive
        would_do_something = _prune_branches(
            repo, args, prune_dryrun, log_dict, local_branches)
        if not would_do_something:
            print("nothing to do.")
        else:
            choice = phlsys_choice.yes_or_no("perform the pruning?", 'no')
            print()
            if choice:
                _prune_branches(
                    repo, args, prune_force, log_dict, local_branches)
                print("done.")
            else:
                print("stopped.")