示例#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)
示例#2
0
    def test_A_Breathing(self):
        remote = "origin"

        expected_branches = [
            'r/master/blah',
            'r/master/blah2',
            'r/master/blah3',
        ]

        for branch in expected_branches:
            phlgit_push.push_asymmetrical(self.repo_dev, 'master', branch,
                                          remote)

        self.repo_arcyd("fetch")

        branches = abdt_git.get_managed_branches(self.repo_arcyd, "repo",
                                                 abdt_rbranchnaming.Naming())

        actual_branches = [b.review_branch_name() for b in branches]

        self.assertSetEqual(set(expected_branches), set(actual_branches))

        for b in branches:

            self.repo_arcyd.archive_to_abandoned(b.review_branch_hash(),
                                                 b.review_branch_name(),
                                                 'master')

            self.repo_arcyd.archive_to_landed(b.review_branch_hash(),
                                              b.review_branch_name(), 'master',
                                              'LANDHASH', 'MESSAGE')
示例#3
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())
 def make_naming(self):
     return abdt_rbranchnaming.Naming()