How to use the tsrc.git.get_status 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 / 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 / cli / version.py View on Github external
def get_details(location: Path) -> str:
    # Maybe we are importing from a wheel or an egg:
    if not location.isdir():
        return ""
    # Maybe we are not in a git repo:
    try:
        status = tsrc.git.get_status(location)
    except tsrc.git.CommandError:
        return ""
    res = " - git: %s" % status.sha1
    if status.dirty:
        res += " (dirty)"
    return res
github TankerHQ / tsrc / tsrc / cli / status.py View on Github external
def process(self, index: int, total: int, repo: tsrc.Repo) -> None:
        ui.info_count(index, total, repo.src, end="\r")
        full_path = self.workspace_path / repo.src

        if not full_path.exists():
            self.statuses[repo.src] = tsrc.errors.MissingRepo(repo.src)
            return

        try:
            self.statuses[repo.src] = tsrc.git.get_status(full_path)
        except Exception as e:
            self.statuses[repo.src] = e
        erase_last_line()