How to use the tsrc.git.run 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 / workspace / local_manifest.py View on Github external
def _reset_manifest_clone(self, url: str, *, branch: str) -> None:
        tsrc.git.run(self.clone_path, "remote", "set-url", "origin", url)

        tsrc.git.run(self.clone_path, "fetch")
        tsrc.git.run(self.clone_path, "checkout", "-B", branch)
        # fmt: off
        tsrc.git.run(
            self.clone_path, "branch", branch,
            "--set-upstream-to", "origin/%s" % branch
        )
        # fmt: on
        ref = "origin/%s" % branch
        tsrc.git.run(self.clone_path, "reset", "--hard", ref)
github TankerHQ / tsrc / tsrc / workspace / cloner.py View on Github external
def reset_repo(self, repo: tsrc.Repo) -> None:
        repo_path = self.workspace_path / repo.src
        ref = repo.sha1
        if ref:
            ui.info_2("Resetting", repo.src, "to", ref)
            try:
                tsrc.git.run(repo_path, "reset", "--hard", ref)
            except tsrc.Error:
                raise tsrc.Error("Resetting to", ref, "failed")
github TankerHQ / tsrc / tsrc / workspace / syncer.py View on Github external
def fetch(self, repo: tsrc.Repo) -> None:
        repo_path = self.workspace_path / repo.src
        for remote in repo.remotes:
            try:
                ui.info_2("Fetching", remote.name)
                cmd = ["fetch", "--tags", "--prune", remote.name]
                if self.force:
                    cmd.append("--force")
                tsrc.git.run(repo_path, *cmd)
            except tsrc.Error:
                raise tsrc.Error("fetch from %s failed" % remote.name)
github TankerHQ / tsrc / tsrc / workspace / local_manifest.py View on Github external
def _clone_manifest(self, url: str, *, branch: str) -> None:
        parent, name = self.clone_path.splitpath()
        parent.makedirs_p()
        tsrc.git.run(self.clone_path.parent, "clone", url, "--branch", branch, name)
github TankerHQ / tsrc / tsrc / workspace / syncer.py View on Github external
def sync_repo_to_ref(repo_path: Path, ref: str) -> None:
        ui.info_2("Resetting to", ref)
        status = tsrc.git.get_status(repo_path)
        if status.dirty:
            raise tsrc.Error("%s is dirty, skipping" % repo_path)
        try:
            tsrc.git.run(repo_path, "reset", "--hard", ref)
        except tsrc.Error:
            raise tsrc.Error("updating ref failed")
github TankerHQ / tsrc / tsrc / workspace / remote_setter.py View on Github external
def set_remote(self, repo: tsrc.Repo, remote: tsrc.Remote) -> None:
        full_path = self.workspace_path / repo.src
        # fmt: off
        ui.info_2(repo.src + ":", "Update remote", ui.reset,
                  ui.bold, remote.name, ui.reset,
                  "to new url:", ui.bold, remote.url)
        # fmt: on
        tsrc.git.run(full_path, "remote", "set-url", remote.name, remote.url)
github TankerHQ / tsrc / tsrc / workspace / local_manifest.py View on Github external
def _reset_manifest_clone(self, url: str, *, branch: str) -> None:
        tsrc.git.run(self.clone_path, "remote", "set-url", "origin", url)

        tsrc.git.run(self.clone_path, "fetch")
        tsrc.git.run(self.clone_path, "checkout", "-B", branch)
        # fmt: off
        tsrc.git.run(
            self.clone_path, "branch", branch,
            "--set-upstream-to", "origin/%s" % branch
        )
        # fmt: on
        ref = "origin/%s" % branch
        tsrc.git.run(self.clone_path, "reset", "--hard", ref)