compute canonical name

This commit is contained in:
Dima Gerasimov 2019-05-14 13:52:04 +02:00
parent 52660f3744
commit 167ca8a8f3

View file

@ -12,11 +12,11 @@ import git # type: ignore
# TODO do something smarter... later
# TODO def run against bitbucket and gh backups
# TODO github/bitbucket repos?
# TODO FIXME syncthing? or not necessary with coding view??
SOURCES = [
'***REMOVED***',
'***REMOVED***',
'***REMOVED***',
'***REMOVED***',
# '***REMOVED***',
# '***REMOVED***',
'***REMOVED***',
]
@ -96,6 +96,7 @@ from git.repo.fun import is_git_dir # type: ignore
def iter_all_git_repos(dd: PathIsh) -> Iterator[Path]:
# TODO would that cover all repos???
dd = Path(dd)
assert dd.exists()
for xx in dd.glob('**/HEAD'): # ugh
c = xx.parent
if not is_git_dir(c):
@ -105,6 +106,21 @@ def iter_all_git_repos(dd: PathIsh) -> Iterator[Path]:
yield c
def canonical_name(repo: Path) -> str:
if repo.match('github/repositories/*/repository'):
return repo.parent.name
else:
return repo.name
# if r.name == 'repository': # 'repository' thing from github..
# rname = r.parent.name
# else:
# rname = r.name
# if 'backups/github' in repo:
# pass # TODO
pass
# TODO is it only used in wcommits?
def iter_multi_commits(sources):
for src in sources: