Use relative option to hg.share

When available.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
Felipe Contreras
2023-03-07 22:12:52 -06:00
parent 4c50223dba
commit b8b9a2f571

View File

@@ -441,12 +441,16 @@ def get_repo(url, alias):
os.makedirs(dirname)
local_path = os.path.join(dirname, 'clone')
if not os.path.exists(local_path):
hg.share(myui, shared_path.encode(), local_path.encode(), update=False)
if check_version(4, 2):
if not os.path.exists(local_path):
hg.share(myui, shared_path.encode(), local_path.encode(), update=False, relative=True)
else:
# make sure the shared path is always up-to-date
hg_path = os.path.join(shared_path, '.hg')
util.writefile(os.path.join(local_path, '.hg', 'sharedpath').encode(), hg_path.encode())
if not os.path.exists(local_path):
hg.share(myui, shared_path.encode(), local_path.encode(), update=False)
else:
# make sure the shared path is always up-to-date
hg_path = os.path.join(shared_path, '.hg')
util.writefile(os.path.join(local_path, '.hg', 'sharedpath').encode(), hg_path.encode())
repo = hg.repository(myui, local_path.encode())
try: