def fetch(self, checkout=True): self._git_env_setup() if not os.path.exists(self.repo_dir): git.init(self.repo_dir) # First try to get the sources from the cached dir if there is one cached_dir = os.path.join(self.config.cached_sources, self.name) if os.path.isdir(os.path.join(cached_dir, ".git")): for remote, url in self.remotes.items(): git.add_remote(self.repo_dir, remote, "file://" + cached_dir) for remote, url in self.config.recipe_remotes(self.name).items(): git.add_remote(self.repo_dir, remote, "file://" + cached_dir) git.fetch(self.repo_dir, fail=False) else: cached_dir = None # add remotes from both upstream and config so user can easily # cherry-pick patches between branches for remote, url in self.remotes.items(): git.add_remote(self.repo_dir, remote, url) for remote, url in self.config.recipe_remotes(self.name).items(): git.add_remote(self.repo_dir, remote, url) # fetch remote branches git.fetch(self.repo_dir, fail=False) if checkout: commit = self.config.recipe_commit(self.name) or self.commit git.checkout(self.repo_dir, commit) git.submodules_update(self.repo_dir, cached_dir, fail=False) self._git_env_restore()
def fetch_impl(self, checkout=True): # First try to get the sources from the cached dir if there is one cached_dir = os.path.join(self.config.cached_sources, self.name) if not os.path.exists(self.repo_dir): if not cached_dir and offline: msg = 'Offline mode: git repo for {!r} not found in cached sources ({}) or local sources ({})' raise FatalError( msg.format(self.name, self.config.cached_sources, self.repo_dir)) git.init(self.repo_dir) if os.path.isdir(os.path.join(cached_dir, ".git")): for remote, url in self.remotes.items(): git.add_remote(self.repo_dir, remote, "file://" + cached_dir) git.fetch(self.repo_dir, fail=False) else: cached_dir = None # add remotes from both upstream and config so user can easily # cherry-pick patches between branches for remote, url in self.remotes.items(): git.add_remote(self.repo_dir, remote, url) # fetch remote branches if not self.offline: git.fetch(self.repo_dir, fail=False) if checkout: commit = self.config.recipe_commit(self.name) or self.commit git.checkout(self.repo_dir, commit) git.submodules_update(self.repo_dir, cached_dir, fail=False, offline=self.offline)
def fetch(self, checkout=True): if not os.path.exists(self.repo_dir): git.init(self.repo_dir) # First try to get the sources from the cached dir if there is one cached_dir = os.path.join(self.config.cached_sources, self.name) if os.path.isdir(os.path.join(cached_dir, ".git")): for remote, url in self.remotes.items(): git.add_remote(self.repo_dir, remote, "file://" + cached_dir) for remote, url in self.config.recipe_remotes(self.name).items(): git.add_remote(self.repo_dir, remote, "file://" + cached_dir) git.fetch(self.repo_dir, fail=False) else: cached_dir = None # add remotes from both upstream and config so user can easily # cherry-pick patches between branches for remote, url in self.remotes.items(): git.add_remote(self.repo_dir, remote, url) for remote, url in self.config.recipe_remotes(self.name).items(): git.add_remote(self.repo_dir, remote, url) # fetch remote branches git.fetch(self.repo_dir, fail=False) if checkout: commit = self.config.recipe_commit(self.name) or self.commit git.checkout(self.repo_dir, commit) git.submodules_update(self.repo_dir, cached_dir, fail=False)
def fetch(self, checkout=True): self._git_env_setup() # First try to get the sources from the cached dir if there is one cached_dir = os.path.join(self.config.cached_sources, self.name) if not os.path.exists(self.repo_dir): if not cached_dir and offline: msg = 'Offline mode: git repo for {!r} not found in cached sources ({}) or local sources ({})' raise FatalError(msg.format(self.name, self.config.cached_sources, self.repo_dir)) git.init(self.repo_dir) if os.path.isdir(os.path.join(cached_dir, ".git")): for remote, url in self.remotes.items(): git.add_remote(self.repo_dir, remote, "file://" + cached_dir) git.fetch(self.repo_dir, fail=False) else: cached_dir = None # add remotes from both upstream and config so user can easily # cherry-pick patches between branches for remote, url in self.remotes.items(): git.add_remote(self.repo_dir, remote, url) # fetch remote branches if not self.offline: git.fetch(self.repo_dir, fail=False) if checkout: commit = self.config.recipe_commit(self.name) or self.commit git.checkout(self.repo_dir, commit) git.submodules_update(self.repo_dir, cached_dir, fail=False, offline=self.offline) self._git_env_restore()