MCPcopy
hub / github.com/nosarthur/gita / get_repos

Function get_repos

gita/utils.py:42–63  ·  view source on GitHub ↗

Return a `dict` of repo name to repo absolute path and repo type Parameters: skip_validation (bool): Returns repos in config even if their path do not exists.

(skip_validation: bool = False)

Source from the content-addressed store, hash-verified

40
41@lru_cache()
42def get_repos(skip_validation: bool = False) -> Dict[str, Dict[str, str]]:
43 """
44 Return a `dict` of repo name to repo absolute path and repo type
45
46 Parameters:
47 skip_validation (bool): Returns repos in config even if their path do not exists.
48 """
49 path_file = common.get_config_fname("repos.csv")
50 repos = {}
51 if os.path.isfile(path_file) and os.stat(path_file).st_size > 0:
52 with open(path_file) as f:
53 rows = csv.DictReader(
54 f, ["path", "name", "type", "flags"], restval=""
55 ) # it's actually a reader
56 for r in rows:
57 if skip_validation or is_git(r["path"], include_bare=True):
58 repos[r["name"]] = {
59 "path": r["path"],
60 "type": r["type"],
61 "flags": r["flags"].split(),
62 }
63 return repos
64
65
66@lru_cache()

Callers 3

get_groupsFunction · 0.85
get_choicesFunction · 0.85
parse_repos_and_restFunction · 0.85

Calls 1

is_gitFunction · 0.85

Tested by

no test coverage detected