MCPcopy
hub / github.com/saltstack/salt / _fetch

Method _fetch

salt/utils/gitfs.py:1616–1652  ·  view source on GitHub ↗

Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False.

(self)

Source from the content-addressed store, hash-verified

1614 return self._get_envs_from_ref_paths(ref_paths)
1615
1616 def _fetch(self):
1617 """
1618 Fetch the repo. If the local copy was updated, return True. If the
1619 local copy was already up-to-date, return False.
1620 """
1621 origin = self.repo.remotes[0]
1622
1623 try:
1624 fetch_results = origin.fetch()
1625 except AssertionError:
1626 fetch_results = origin.fetch()
1627
1628 new_objs = False
1629
1630 for fetchinfo in fetch_results:
1631 if fetchinfo.old_commit is not None:
1632 log.debug(
1633 "%s has updated '%s' for remote '%s' from %s to %s",
1634 self.role,
1635 fetchinfo.name,
1636 self.id,
1637 fetchinfo.old_commit.hexsha[:7],
1638 fetchinfo.commit.hexsha[:7],
1639 )
1640 new_objs = True
1641 elif fetchinfo.flags in (fetchinfo.NEW_TAG, fetchinfo.NEW_HEAD):
1642 log.debug(
1643 "%s has fetched new %s '%s' for remote '%s'",
1644 self.role,
1645 "tag" if fetchinfo.flags == fetchinfo.NEW_TAG else "head",
1646 fetchinfo.name,
1647 self.id,
1648 )
1649 new_objs = True
1650
1651 cleaned = self.clean_stale_refs()
1652 return True if (new_objs or cleaned) else None
1653
1654 def file_list(self, tgt_env):
1655 """

Callers

nothing calls this directly

Calls 3

debugMethod · 0.80
fetchMethod · 0.45
clean_stale_refsMethod · 0.45

Tested by

no test coverage detected