Exemplo n.º 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)
Exemplo n.º 2
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
Exemplo n.º 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))
Exemplo n.º 4
0
    def _setup_for_untracked_branch(self, repo_name='name', branch_url=None):
        base = abdt_naming.EXAMPLE_REVIEW_BRANCH_BASE

        naming = abdt_classicnaming.Naming()

        branch_name = abdt_classicnaming.EXAMPLE_REVIEW_BRANCH_NAME
        self.repo_dev('checkout', '-b', branch_name)
        phlgit_push.push(self.repo_dev, branch_name, 'origin')

        self.repo_arcyd('fetch', 'origin')

        review_branch = naming.make_review_branch_from_name(branch_name)
        review_hash = phlgit_revparse.get_sha1_or_none(self.repo_arcyd,
                                                       review_branch.branch)

        branch = abdt_branch.Branch(self.repo_arcyd, review_branch,
                                    review_hash, None, None, None, repo_name,
                                    branch_url)

        # should not raise
        branch.verify_review_branch_base()

        return base, branch_name, branch
 def make_naming(self):
     return abdt_classicnaming.Naming()
 def make_naming(self):
     return abdt_compositenaming.Naming(abdt_classicnaming.Naming(),
                                        abdt_rbranchnaming.Naming())