Beispiel #1
0
    def hash_ref_pairs(self):
        """Return a list of (sha1, name) tuples from the repo's list of refs.

        :returns: a list of (sha1, name)

        """
        if self._hash_ref_pairs is None:
            self._hash_ref_pairs = phlgit_showref.hash_ref_pairs(self._repo)
        return self._hash_ref_pairs
    def hash_ref_pairs(self):
        """Return a list of (sha1, name) tuples from the repo's list of refs.

        :returns: a list of (sha1, name)

        """
        if self._hash_ref_pairs is None:
            self._hash_ref_pairs = phlgit_showref.hash_ref_pairs(self._repo)
        return self._hash_ref_pairs
    def hash_ref_pairs(self):
        """Return a list of (sha1, name) tuples from the repo's list of refs.

        :repo: a callable supporting git commands, e.g. repo("status")
        :returns: a list of (sha1, name)

        """
        if self._hash_ref_pairs is None:
            self._hash_ref_pairs = phlgit_showref.hash_ref_pairs(self._repo)
        return self._hash_ref_pairs
def _get_branch_to_hash(git):

    remote = git.get_remote()
    hash_ref_list = phlgit_showref.hash_ref_pairs(git)

    def is_remote(ref):
        return phlgitu_ref.is_under_remote(ref, remote)

    # XXX: can't use dictionary comprehensions until the linters don't complain
    full_to_short = phlgitu_ref.fq_remote_to_short_local
    branch_to_hash = dict([
        (full_to_short(r), h) for h, r in hash_ref_list if is_remote(r)
    ])

    return branch_to_hash
Beispiel #5
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))
Beispiel #6
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))