Beispiel #1
0
def _process_repo(repo, unused_repo_name, args, arcyd_conduit, url_watcher,
                  mail_sender):

    fetch_if_needed(url_watcher, abdi_repoargs.get_repo_snoop_url(args), repo,
                    args.repo_desc)

    admin_emails = set(_flatten_list(args.admin_emails))

    # TODO: this should be a URI for users not conduit
    mailer = abdmail_mailer.Mailer(mail_sender, admin_emails, args.repo_desc,
                                   args.instance_uri)

    branch_url_callable = None
    if args.branch_url_format:

        def make_branch_url(branch_name):
            return args.branch_url_format.format(branch=branch_name,
                                                 repo_url=args.repo_url)

        branch_url_callable = make_branch_url

    branch_naming = abdt_compositenaming.Naming(abdt_classicnaming.Naming(),
                                                abdt_rbranchnaming.Naming())

    branches = abdt_git.get_managed_branches(repo, args.repo_desc,
                                             branch_naming,
                                             branch_url_callable)

    abdi_processrepo.process_branches(branches, arcyd_conduit, mailer)
Beispiel #2
0
def process(args):
    repo = phlsys_git.Repo('.')

    #
    # First, gather all the data
    #

    # XXX: only supports 'origin' remote at present
    remote = 'origin'

    hash_ref_pairs = phlgit_showref.hash_ref_pairs(repo)
    remote_branch_to_hash = _remote_branches_as_short_local(
        hash_ref_pairs, remote)
    # local_branch_to_hash = _short_local_branches(hash_ref_pairs)

    branch_naming = abdt_compositenaming.Naming(abdt_classicnaming.Naming(),
                                                abdt_rbranchnaming.Naming())

    branch_pairs = abdt_naming.get_branch_pairs(remote_branch_to_hash.keys(),
                                                branch_naming)

    managed_review_branches = _get_managed_review_branches(
        remote_branch_to_hash, branch_pairs)

    #
    # Finally, decide how to display it
    #

    if args.format_json:
        print(json.dumps(managed_review_branches, sort_keys=True, indent=2))
    elif args.format_python:
        pprint.pprint(managed_review_branches)
    elif args.format_string:
        for branch in managed_review_branches:
            print(args.format_string.format(**branch))
    else:  # args.format_summary
        if managed_review_branches:
            print("{:6} {:14} {}".format("ID", "status", "tracked name"))
            for branch in managed_review_branches:
                print("{review_id:6} {status:14} {tracked_name}".format(
                    **branch))
 def make_naming(self):
     return abdt_compositenaming.Naming(abdt_classicnaming.Naming(),
                                        abdt_rbranchnaming.Naming())