How to use the tsrc.Remote function in tsrc

To help you get started, we’ve selected a few tsrc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TankerHQ / tsrc / tsrc / manifest.py View on Github external
def _handle_remotes(self, repo_config: Any) -> List[tsrc.Remote]:
        remotes_config = repo_config.get("remotes")
        res = []  # type: List[tsrc.Remote]
        if remotes_config:
            for remote_config in remotes_config:
                remote = tsrc.Remote(
                    name=remote_config["name"], url=remote_config["url"]
                )
                res.append(remote)
        return res
github TankerHQ / tsrc / tsrc / workspace / remote_setter.py View on Github external
def get_remote(self, repo: tsrc.Repo, name: str) -> Optional[tsrc.Remote]:
        full_path = self.workspace_path / repo.src
        rc, url = tsrc.git.run_captured(
            full_path, "remote", "get-url", name, check=False
        )
        if rc != 0:
            return None
        else:
            return tsrc.Remote(name=name, url=url)
github TankerHQ / tsrc / tsrc / manifest.py View on Github external
def _handle_repo(self, repo_config: Any) -> None:
        src = repo_config["src"]
        branch = repo_config.get("branch", "master")
        tag = repo_config.get("tag")
        sha1 = repo_config.get("sha1")
        url = repo_config.get("url")
        if url:
            origin = tsrc.Remote(name="origin", url=url)
            remotes = [origin]
        else:
            remotes = self._handle_remotes(repo_config)
        repo = tsrc.Repo(src=src, branch=branch, sha1=sha1, tag=tag, remotes=remotes)
        self._repos.append(repo)