From b8b9a2f571c322bb3fe8a19c102a0f75fe9f3a9a Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Tue, 7 Mar 2023 22:12:52 -0600 Subject: [PATCH] Use relative option to hg.share When available. Signed-off-by: Felipe Contreras --- git-remote-hg | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/git-remote-hg b/git-remote-hg index 9105e7b..ce83b14 100755 --- a/git-remote-hg +++ b/git-remote-hg @@ -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: