def install_bower(self, package, save=True, save_dev=False):
        """Installs a bower package.

        :param save: if `True`, pins the package to the Hydrogen requirements
            YAML file.
        :param save_dev: if `True`, pins the package as a development
            dependency to the Hydrogen requirements YAML file.
        :param return: a list of tuples, containing all installed package names
            and versions, including any dependencies.
        """
        requirement = Requirement.coerce(package)
        url = Bower.get_package_url(requirement.package)

        installed = []
        for name, _ in self.get_bower_package(url):
            installed.append(Requirement(name, requirement.version))

        for requirement in installed:
            if save:
                self.requirements["bower"].add(requirement, replace=True)
            if save_dev:
                self.requirements["bower-dev"].add(requirement, replace=True)
            success("installed {}".format(str(requirement)))
        if save or save_dev:
            self.requirements.save()
        return installed
def _should_fetch(cls, dest, rev):
        """
        Return true if rev is a ref or is a commit that we don't have locally.

        Branches and tags are not considered in this method because they are
        assumed to be always available locally (which is a normal outcome of
        ``git clone`` and ``git fetch --tags``).
        """
        if rev.startswith("refs/"):
            # Always fetch remote refs.
            return True

        if not looks_like_hash(rev):
            # Git fetch would fail with abbreviated commits.
            return False

        if cls.has_commit(dest, rev):
            # Don't fetch if we have the commit locally.
            return False

        return True