async def fetch(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 self.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, logfile=get_logfile(self)) 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, logfile=get_logfile(self)) await git.fetch(self.repo_dir, fail=False, logfile=get_logfile(self)) 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, logfile=get_logfile(self)) # fetch remote branches if not self.offline: await git.fetch(self.repo_dir, fail=False, logfile=get_logfile(self)) if checkout: commit = self.config.recipe_commit(self.name) or self.commit await git.checkout(self.repo_dir, commit, logfile=get_logfile(self)) await git.submodules_update(self.repo_dir, cached_dir, fail=False, offline=self.offline, logfile=get_logfile(self))
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()
def fetch(self, checkout=True): if not os.path.exists(self.repo_dir): git.init(self.repo_dir) for remote, url in self.remotes.iteritems(): 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)
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(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): if not os.path.exists(self.repo_dir): git.init(self.repo_dir) # add remotes from both upstream and config so user can easily # cherry-pick patches between branches for remote, url in self.remotes.iteritems(): git.add_remote(self.repo_dir, remote, url) for remote, url in self.config.recipe_remotes(self.name).iteritems(): 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)
def self_update(self): '''Update this instance of cerbero git repository''' if not self.args.self_update: return try: manifest = Manifest(self.args.self_update) manifest.parse() project = manifest.find_project('cerbero') git_dir = os.path.dirname(sys.argv[0]) git.add_remote(git_dir, project.remote, project.fetch_uri) run_until_complete(git.fetch(git_dir)) run_until_complete(git.checkout(git_dir, project.revision)) except FatalError as ex: self.log_error( _("ERROR: Failed to proceed with self update %s") % ex) sys.exit(0)