def get_upgrades(self, remove_applied=True):
        """Get upgrades (ordered according to their dependencies).

        :param remove_applied: Set to false to return all upgrades, otherwise
            already applied upgrades are removed from their graph (incl. all
            their dependencies.
        """
        if self.upgrades is None:
            plugins = self._load_upgrades(remove_applied=remove_applied)

            # List of un-applied upgrades in topological order
            self.upgrades = self.order_upgrades(plugins, self.history)
        return self.upgrades