def _fetch(self):
        '''
        Fetch the repo. If the local copy was updated, return True. If the
        local copy was already up-to-date, return False.
        '''
        origin = self.repo.remotes[0]
        try:
            fetch_results = origin.fetch()
        except __HOLE__:
            fetch_results = origin.fetch()

        new_objs = False
        for fetchinfo in fetch_results:
            if fetchinfo.old_commit is not None:
                log.debug(
                    '{0} has updated \'{1}\' for remote \'{2}\' '
                    'from {3} to {4}'.format(
                        self.role,
                        fetchinfo.name,
                        self.id,
                        fetchinfo.old_commit.hexsha[:7],
                        fetchinfo.commit.hexsha[:7]
                    )
                )
                new_objs = True
            elif fetchinfo.flags in (fetchinfo.NEW_TAG,
                                     fetchinfo.NEW_HEAD):
                log.debug(
                    '{0} has fetched new {1} \'{2}\' for remote \'{3}\' '
                    .format(
                        self.role,
                        'tag' if fetchinfo.flags == fetchinfo.NEW_TAG
                            else 'head',
                        fetchinfo.name,
                        self.id
                    )
                )
                new_objs = True

        cleaned = self.clean_stale_refs()
        return bool(new_objs or cleaned)
dataset/ETHPy150Open saltstack/salt/salt/utils/gitfs.py/GitPython._fetch