Ejemplo n.º 1
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')
Ejemplo n.º 2
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)
Ejemplo n.º 3
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')
Ejemplo n.º 4
0
 def _get_updated_branch(self, branch_name):
     phlgit_fetch.all_prune(self.repo_arcyd)
     branch_list = abdt_git.get_managed_branches(
         self.repo_arcyd, "repo", abdt_classicnaming.Naming())
     self.assertEqual(len(branch_list), 1)
     branch = branch_list[0]
     self.assertEqual(branch.review_branch_name(), branch_name)
     return branch
Ejemplo n.º 5
0
 def _get_updated_branch(self, branch_name):
     phlgit_fetch.all_prune(self.repo_arcyd)
     branch_list = abdt_git.get_managed_branches(
         self.repo_arcyd, "repo", abdt_classicnaming.Naming())
     self.assertEqual(len(branch_list), 1)
     branch = branch_list[0]
     self.assertEqual(branch.review_branch_name(), branch_name)
     return branch
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)
def _do(repo, args, reporter, arcyd_reporter, conduits, url_watcher):

    with arcyd_reporter.tag_timer_context('process branches prolog'):

        arcyd_reporter.tag_timer_decorate_object_methods_individually(
            repo, 'git')

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

        options = _determine_options(args, repo)

        arcyd_conduit = _connect(conduits, args, arcyd_reporter)

        reporter.set_config(options)

        sender = phlmail_sender.MailSender(
            phlsys_sendmail.Sendmail(), arcyd_reporter.arcyd_email)

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

        pluginManager = phlsys_pluginmanager.PluginManager(
            args.plugins, args.trusted_plugins)

        branch_url_callable = None
        if options.branch_url_format:
            def make_branch_url(branch_name):
                return options.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,
            options.description,
            branch_naming,
            branch_url_callable)

        for branch in branches:
            arcyd_reporter.tag_timer_decorate_object_methods_individually(
                branch, 'branch')

    try:
        with arcyd_reporter.tag_timer_context('process branches'):
            abdi_processrepo.process_branches(
                branches,
                arcyd_conduit,
                mailer,
                pluginManager,
                reporter)
    except Exception:
        reporter.on_traceback(traceback.format_exc())
        raise

    reporter.on_completed()