mirror of
https://github.com/clearml/clearml
synced 2025-02-14 16:46:12 +00:00
Fix TRAINS_VCS_ROOT path conversion
This commit is contained in:
parent
41ca1a2e49
commit
101e5393d1
@ -224,19 +224,12 @@ class EnvDetector(Detector):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _normalize_root(root):
|
def _normalize_root(root):
|
||||||
"""
|
"""
|
||||||
Get the absolute location of the parent folder (where .git resides)
|
Convert to absolute and squash 'path/../folder'
|
||||||
"""
|
"""
|
||||||
root_parts = list(reversed(Path(root).parts))
|
try:
|
||||||
cwd_abs = list(reversed(Path.cwd().parts))
|
return os.path.abspath((Path.cwd() / root).absolute().as_posix())
|
||||||
count = len(cwd_abs)
|
except:
|
||||||
for i, p in enumerate(cwd_abs):
|
return Path.cwd()
|
||||||
if i >= len(root_parts):
|
|
||||||
break
|
|
||||||
if p == root_parts[i]:
|
|
||||||
count -= 1
|
|
||||||
cwd_abs.reverse()
|
|
||||||
root_abs_path = Path().joinpath(*cwd_abs[:count])
|
|
||||||
return str(root_abs_path)
|
|
||||||
|
|
||||||
def _get_info(self, _, include_diff=False):
|
def _get_info(self, _, include_diff=False):
|
||||||
repository_url = VCS_REPOSITORY_URL.get()
|
repository_url = VCS_REPOSITORY_URL.get()
|
||||||
|
Loading…
Reference in New Issue
Block a user